diff --git a/.gitignore b/.gitignore index 7ea0b1a..1a37af2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ node_modules/ .env cypress.env.json cypress/screenshots/ +cypress/videos notes/DP.md .DS_Store diff --git a/README.md b/README.md index e5f0818..1f67275 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ npm i ### Konfiguration -Um direkt mit dem Findex zu kommunizieren müssen die [Proxy Einstellungen](https://docs.cypress.io/guides/references/proxy-configuration) der cypress Umgebung manuel angepasst werden. +Um direkt mit dem [Findex](https://github.com/gbv/findex-config) zu kommunizieren müssen die [Proxy Einstellungen](https://docs.cypress.io/guides/references/proxy-configuration) der Cypress Umgebung manuell angepasst werden. ```powershell $env:HTTP_PROXY = "http://proxy.spk-berlin.de:3128" @@ -55,10 +55,40 @@ Zugangsdaten für den `vf6_user` müssen in der `cypress.env.json` eingetragen } ``` -### Benutzung +## Benutzung Zum ausführen der Tests: +Entweder in der Kommandozeile: + ```powershell npx cypress run -``` \ No newline at end of file +``` + +Oder via Browser GUI modus: + + +```powershell +npx cypress open +``` + +Caveat: Sollte ein eine Browser spezifische Warnung erscheinen, verhindern Windows Systemeinstellungen die automatisierte Nutzung des gewählten Browsers. + +Für die Reproduktion der CI Testläufe gegen den produktiven Stabikat von ausserhalb des Hausnetzes: + +```powerhshell +CYPRESS_BASE_URL=https://stabikat.de/search/ npx cypress run -s cypress/e2e/simple.cy.js +``` + + +```powershell +Cypress detected policy settings on your computer that may cause issues. + +The following policies were detected that may prevent Cypress from automating Chrome: + + - HKEY_CURRENT_USER\Software\Policies\Google\Chrome\ProxySettings + +For more information, see https://on.cypress.io/bad-browser-policy +``` + +In diese Fällen müssen Tests in `Electron` ausgeführt werden. \ No newline at end of file diff --git a/cypress/e2e/known-Item.cy.js b/cypress/e2e/known-Item.cy.js index 7310464..4f9db73 100644 --- a/cypress/e2e/known-Item.cy.js +++ b/cypress/e2e/known-Item.cy.js @@ -25,13 +25,13 @@ describe.skip('known item searches', () => { }) }) - it('Parent before child', () => { - cy.visit('/', { - qs: { - q: 'African American Review' - }, - }) - }) + // it('Parent before child', () => { + // cy.visit('/', { + // qs: { + // q: 'African American Review' + // }, + // }) + // }) it('child should be first when child is searched', () => { cy.visit('/', { diff --git a/cypress/e2e/simple.cy.js b/cypress/e2e/simple.cy.js index 399c0be..80b08ea 100644 --- a/cypress/e2e/simple.cy.js +++ b/cypress/e2e/simple.cy.js @@ -2,45 +2,94 @@ describe('simple GUI spec', () => { - before(() => { + before(() => { + cy.visit({ + url: '/Results', + qs: { + lookfor: 'dad', + type: 'AllFields' + } + }) + }) + + it('should see matching search results', () => { + cy.get('.resultlist') + .contains('Dad') + }) + + // This will be a 403 from world should connect from internal network + it('should also pass via http request', () => { + cy.request({ + url: '/Results', + qs: { + lookfor: 'dad' + } + }).then((resp) => { + expect(resp.status).to.eq(200) + }) + + }) + + describe('Foreign language phrase search', () => { + // See #6 + // Thematische Suche#L30 + it('en all fields query matches en not ar', () => { cy.visit({ url: '/Results', qs: { - lookfor: 'dad', + lookfor: 'Egyptian Language', type: 'AllFields' } }) - }) + cy.get('.resultlist') + // PPN JST063665204 + .contains('The Egyptian Language') + cy.get('.resultlist') + // PPN DOAJ008736839 + .should('not.contain', 'المعانی الثانیة للأمر فی النص المصری القدیم دراسة بلاغیة مقارنة ') - it('passes via Browser', () => { - cy.get('.result-body') - .contains('Dad : Roman') }) - // This will be a 403 from world should connect from internal network - it('passes via http request', () => { - cy.request({ + it('en subject query matches en and ar', () => { + cy.visit({ url: '/Results', qs: { - lookfor: 'dad' + lookfor: 'Egyptian Language', + type: 'Subject' } - }).then((resp) => { - expect(resp.status).to.eq(200) }) + cy.get('.resultlist') + // PPN JST063665204 + .contains('The Egyptian Language') + cy.get('.resultlist') + // PPN DOAJ008736839 + .contains('المعانی الثانیة للأمر فی النص المصری القدیم دراسة بلاغیة مقارنة ') }) + }) - // TODO(DP): get json repsonse from console - it('passes via http request', () => { - cy.request({ + // see #8 + // Title search and online access false to limit noise + // check if exact match first list item is the journal parent and subsequent entries are child works + // a more elaborate test would compare the value of '.record-number' within the same family + // + describe('Parent Work', () => { + it('should appear before child work', () => { + cy.visit({ url: '/Results', qs: { - lookfor: 'dad' + lookfor: 'African American Review', + type: 'Title', + "filter[]": '~remote_bool:"false"' } - }).then((resp) => { - expect(resp.status).to.eq(200) - cy.log(resp) }) + cy.get('#result0') + .find('.media-type') + .contains(' Zeitschrift (gedruckt) ') + cy.get('#result1') + .find('.media-type') + .contains(' Band einer Zeitschrift/Zeitung ') }) - }) \ No newline at end of file + }) +}) \ No newline at end of file diff --git a/notes/Notes.md b/notes/Notes.md index 67ea640..466457b 100644 --- a/notes/Notes.md +++ b/notes/Notes.md @@ -63,4 +63,3 @@ https://github.com/sul-dlss/sw_index_tests https://github.com/sul-dlss/searchwor https://github.com/traject/traject https://github.com/sul-dlss/traject_plus (https://github.com/sul-dlss/folio_qa_tests) :-) - diff --git a/package-lock.json b/package-lock.json index 7323ef0..bb5e84d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "cypress": "^13.5.1", + "cypress": "^13.6.2", "yamljs": "^0.3.0" } }, @@ -559,9 +559,9 @@ } }, "node_modules/cypress": { - "version": "13.5.1", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.5.1.tgz", - "integrity": "sha512-yqLViT0D/lPI8Kkm7ciF/x/DCK/H/DnogdGyiTnQgX4OVR2aM30PtK+kvklTOD1u3TuItiD9wUQAF8EYWtyZug==", + "version": "13.6.2", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.2.tgz", + "integrity": "sha512-TW3bGdPU4BrfvMQYv1z3oMqj71YI4AlgJgnrycicmPZAXtvywVFZW9DAToshO65D97rCWfG/kqMFsYB6Kp91gQ==", "dev": true, "hasInstallScript": true, "dependencies": { diff --git a/package.json b/package.json index 37d50ac..de132b1 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/duncdrum/sbb-relevance-test#readme", "devDependencies": { - "cypress": "^13.5.1", + "cypress": "^13.6.2", "yamljs": "^0.3.0" } }