From 796afe75d5c8b570050bfb7f29a69b5b7603f2ac Mon Sep 17 00:00:00 2001 From: duncdrum Date: Fri, 1 Dec 2023 10:48:17 +0100 Subject: [PATCH 1/8] docs(readme): add Electron note --- README.md | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e5f0818..527be4b 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,34 @@ 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. + + +```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 From 3b0e0dd1c6134d323e9f10fdebb0ed460d986a3b Mon Sep 17 00:00:00 2001 From: duncdrum Date: Thu, 7 Dec 2023 11:30:05 +0100 Subject: [PATCH 2/8] chore(cypress): minor bump --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7323ef0..77c29d8 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.1", "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.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.1.tgz", + "integrity": "sha512-k1Wl5PQcA/4UoTffYKKaxA0FJKwg8yenYNYRzLt11CUR0Kln+h7Udne6mdU1cUIdXBDTVZWtmiUjzqGs7/pEpw==", "dev": true, "hasInstallScript": true, "dependencies": { diff --git a/package.json b/package.json index 37d50ac..1647fca 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.1", "yamljs": "^0.3.0" } } From 9366e820e2ec49e6f1162c4fca475ebf3fde0415 Mon Sep 17 00:00:00 2001 From: duncdrum Date: Thu, 7 Dec 2023 11:50:20 +0100 Subject: [PATCH 3/8] chore(git): ignore videos --- .gitignore | 1 + 1 file changed, 1 insertion(+) 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 From 17f6eca92a49686a6642801476c6b72363e9d8a2 Mon Sep 17 00:00:00 2001 From: duncdrum Date: Thu, 7 Dec 2023 15:13:12 +0100 Subject: [PATCH 4/8] fix(simple): phrase search en start with basic assertions see #6 --- cypress/e2e/simple.cy.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/cypress/e2e/simple.cy.js b/cypress/e2e/simple.cy.js index 399c0be..b9c81dc 100644 --- a/cypress/e2e/simple.cy.js +++ b/cypress/e2e/simple.cy.js @@ -30,6 +30,44 @@ describe('simple GUI spec', () => { }) +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: 'Egyptian Language', + type: 'AllFields' + } + }) + cy.get('.resultlist') + // PPN JST063665204 + .contains('The Egyptian Language') + cy.get('.resultlist') + // PPN DOAJ008736839 + .should('not.contain', 'المعانی الثانیة للأمر فی النص المصری القدیم دراسة بلاغیة مقارنة ') + + }) + + it('en subject query matches en and ar', () => { + cy.visit({ + url: '/Results', + qs: { + lookfor: 'Egyptian Language', + type: 'Subject' + } + }) + 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({ From 6ce190bf43eaab1a246687b73fa17d07ea04c74c Mon Sep 17 00:00:00 2001 From: duncdrum Date: Fri, 5 Jan 2024 15:57:57 +0100 Subject: [PATCH 5/8] chore(npm): bump cypress --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 77c29d8..bb5e84d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "MIT", "devDependencies": { - "cypress": "^13.6.1", + "cypress": "^13.6.2", "yamljs": "^0.3.0" } }, @@ -559,9 +559,9 @@ } }, "node_modules/cypress": { - "version": "13.6.1", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-13.6.1.tgz", - "integrity": "sha512-k1Wl5PQcA/4UoTffYKKaxA0FJKwg8yenYNYRzLt11CUR0Kln+h7Udne6mdU1cUIdXBDTVZWtmiUjzqGs7/pEpw==", + "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 1647fca..de132b1 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/duncdrum/sbb-relevance-test#readme", "devDependencies": { - "cypress": "^13.6.1", + "cypress": "^13.6.2", "yamljs": "^0.3.0" } } From 2afd2142d423073e1c932521ccea4933d30236da Mon Sep 17 00:00:00 2001 From: duncdrum Date: Fri, 5 Jan 2024 16:14:14 +0100 Subject: [PATCH 6/8] fix(simple): weaken dad assertion --- cypress/e2e/simple.cy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/simple.cy.js b/cypress/e2e/simple.cy.js index b9c81dc..3082f2b 100644 --- a/cypress/e2e/simple.cy.js +++ b/cypress/e2e/simple.cy.js @@ -13,8 +13,8 @@ describe('simple GUI spec', () => { }) it('passes via Browser', () => { - cy.get('.result-body') - .contains('Dad : Roman') + cy.get('#content') + .contains('Dad') }) // This will be a 403 from world should connect from internal network From 918d9bde36c4d64eb257d881ad516e5a2f84f68d Mon Sep 17 00:00:00 2001 From: duncdrum Date: Fri, 5 Jan 2024 16:14:50 +0100 Subject: [PATCH 7/8] docs(readme): add local command cleanup up --- README.md | 8 +++++++- cypress/e2e/simple.cy.js | 4 ++-- notes/Notes.md | 1 - 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 527be4b..1f67275 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,13 @@ Oder via Browser GUI modus: npx cypress open ``` -Caveat: Sollte ein eine Browser spezifische Warnung erscheinen verhindern Windows Systemeinstellungen die automatisierte Nutzung des gewählten Browsers. +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 diff --git a/cypress/e2e/simple.cy.js b/cypress/e2e/simple.cy.js index 3082f2b..0d7a574 100644 --- a/cypress/e2e/simple.cy.js +++ b/cypress/e2e/simple.cy.js @@ -12,13 +12,13 @@ describe('simple GUI spec', () => { }) }) - it('passes via Browser', () => { + it('should see matching search results', () => { cy.get('#content') .contains('Dad') }) // This will be a 403 from world should connect from internal network - it('passes via http request', () => { + it('should also pass via http request', () => { cy.request({ url: '/Results', qs: { 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) :-) - From fea0ec77a36e7657f52c148b9e2c636568d9af13 Mon Sep 17 00:00:00 2001 From: duncdrum Date: Fri, 5 Jan 2024 18:00:11 +0100 Subject: [PATCH 8/8] fix(simple): parents first should pass after 09.01.24 deployment close #8 --- cypress/e2e/known-Item.cy.js | 14 +++---- cypress/e2e/simple.cy.js | 77 ++++++++++++++++++++---------------- 2 files changed, 51 insertions(+), 40 deletions(-) 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 0d7a574..80b08ea 100644 --- a/cypress/e2e/simple.cy.js +++ b/cypress/e2e/simple.cy.js @@ -2,35 +2,35 @@ describe('simple GUI spec', () => { - before(() => { - cy.visit({ - url: '/Results', - qs: { - lookfor: 'dad', - type: 'AllFields' - } - }) - }) - - it('should see matching search results', () => { - cy.get('#content') - .contains('Dad') + before(() => { + cy.visit({ + url: '/Results', + qs: { + lookfor: 'dad', + type: 'AllFields' + } }) + }) - // 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) - }) + 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', () => { + }) + + describe('Foreign language phrase search', () => { // See #6 // Thematische Suche#L30 it('en all fields query matches en not ar', () => { @@ -61,24 +61,35 @@ describe('Foreign language phrase search', () => { cy.get('.resultlist') // PPN JST063665204 .contains('The Egyptian Language') - cy.get('.resultlist') + 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