diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c3eb066..5c33d11 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,16 +25,6 @@ jobs: build: npm install config: baseUrl=https://stabikat.de/search/ env: grepUntagged=true - spec: | - cypress/e2e/spec.cy.js - cypress/e2e/author.cy.js - cypress/e2e/reviews.cy.js - cypress/e2e/nested.cy.js - cypress/e2e/multi-lang-phrase.cy.js - cypress/e2e/place.cy.js - cypress/e2e/chronology.cy.js - cypress/e2e/topical.cy.js - cypress/e2e/duplicates.cy.js # browser: firefox # Lint Yaml - name: Yaml Lint diff --git a/README.md b/README.md index 58a950d..4177eea 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # sbb-relevance-test -Relevanztests für die Discovery Suche im K10+. +Relevanztests für die Discovery Suche der SBB. See [Ziele.md](notes/Ziele.md) @@ -22,62 +22,55 @@ v18.16.0 ## Installation -Dieses Repo Klonen, und dann denn geklonten Ordner in Powershell öffnen: +Dieses Repo klonen, und dann denn geklonten Ordner in der Kommandozeile öffnen: ```powershell npm i ``` -### Konfiguration +### Installation (SBB) -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. +1. Für die Installation via NPM müssen die [Proxy Einstellungen](https://docs.cypress.io/guides/references/proxy-configuration) der lokalen Umgebung manuell angepasst werden. ```powershell $env:HTTP_PROXY = "http://proxy.spk-berlin.de:3128" -$env:HTTPS_PROXY = "HTTPS_PROXY=http://proxy-dev.spk-berlin.de:3128" +$env:HTTPS_PROXY = "http://proxy.spk-berlin.de:3128" $env:NO_PROXY = "b-dev20220203-vufind-6, localhost, 127.0.0.1, 10.0.0.0/8, 172.16.200.0/24, 194.94.132.0/22, .sbb.spk-berlin.de, .staatsbibliothek-berlin.de, .dev.sbb.berlin, smb.museum, .pk.de" ``` -Permanente Einrichtung des `http_proxy`: +2. Strikten SSL modus deaktivieren (einmalig) + +Da der Proxy über `http` aufgerufen wird, muss unter Umständen der strikte ssl modus deaktiviert werden. + ```powershell -setx HTTP_PROXY http://proxy.spk-berlin.de:3128 +npm set strict-ssl false ``` -Zugangsdaten für den `vf6_user` müssen in der `cypress.env.json` eingetragen werden: +3. Installation via NPM -```json -{ - "vf6_user": { - "vf6_name": "root", - "vf6_pw": "" - }, - "NO_PROXY": "b-dev20220203-vufind-6, localhost, 127.0.0.1, 10.0.0.0/8, 172.16.200.0/24, 194.94.132.0/22, .sbb.spk-berlin.de, .staatsbibliothek-berlin.de, .dev.sbb.berlin, smb.museum, .pk.de", - "HTTP_PROXY": "http://proxy.spk-berlin.de:3128" -} +Dieses Repo klonen, und dann die Kommandozeile in dem geklonten Ordner öffnen: + +```powershell +npm i ``` ## Benutzung -Zum ausführen der Tests: +Zum Ausführen der Tests den geklonten Ordner in der Kommandozeile öffnen: -Entweder in der Kommandozeile: +Ohne GUI: ```powershell npx cypress run ``` -Oder via Browser GUI modus: - +Mit GUI: ```powershell npx cypress open ``` -Für die Reproduktion der CI Testläufe gegen den produktiven Stabikat der `simple.cs.js` spec: - -```bash -CYPRESS_BASE_URL=https://stabikat.de/search/ npx cypress run --spec cypress/e2e/simple.cy.js --env grepUntagged=true -``` +Per Default laufen die Tests gegen den [Vufind-6 Server](http://b-dev20220203-vufind-6/). Die `searchspecs.yml` befindet sich im Verzeichnis: `/var/www/vufind/local/config/vufind` ### Tagging @@ -103,7 +96,19 @@ Wenn die nötigen Änderungen der `searchpsec.yaml` im Stabikat live gegangen si Für Tests die in beiden Instanzen (noch) nicht laufen: `.skip` -### Yaml Prüfung +Für die Reproduktion der CI Testläufe gegen den produktiven Stabikat der `simple.cs.js` spec: + +- Ändere `BASE_URL` zum [Stabikat](https://stabikat.de) +- Spezifiziere welche Testdatei via `--spec`, und +- nur Tests ohne tag, via `--env` + +```bash +CYPRESS_BASE_URL=https://stabikat.de/search/ npx cypress run --spec cypress/e2e/simple.cy.js --env grepUntagged=true +``` + +Für weitere Optionen siehe [Cypress command-line](https://docs.cypress.io/guides/guides/command-line) + +## Yaml Prüfung Um die yaml Dateien im `vufind/` Ordner auf Syntaxfehler zu überprüfen: @@ -111,11 +116,13 @@ Um die yaml Dateien im `vufind/` Ordner auf Syntaxfehler zu überprüfen: npm run lint ``` +Dieser Test wird auf GitHub automatisch ausgeführt. + ## Troubleshooting ### Cypress Browser Warning -Sollte ein eine Browser spezifische Warnung erscheinen, verhindern Windows Systemeinstellungen die automatisierte Nutzung des gewählten Browsers. +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. @@ -129,10 +136,14 @@ For more information, see https://on.cypress.io/bad-browser-policy In diese Fällen müssen Tests in `Electron` ausgeführt werden. -### NPM Installationsprobleme +### Findex Availability -Da der Proxy über `http` aufgerufen wird, muss unter Umständen der strikte ssl modus deaktiviert werden. +Die Proxy Einstellungen für die direkte Kommunikation mit dem [Findex](https://github.com/gbv/findex-config) können in einer `cypress.env.json` hinterlegt werden. -```powershell -npm set strict-ssl false -``` \ No newline at end of file +```json +{ + "NO_PROXY": "b-dev20220203-vufind-6, localhost, 127.0.0.1, 10.0.0.0/8, 172.16.200.0/24, 194.94.132.0/22, .sbb.spk-berlin.de, .staatsbibliothek-berlin.de, .dev.sbb.berlin, smb.museum, .pk.de", + "HTTP_PROXY": "http://proxy.spk-berlin.de:3128", + "HTTPS_PROXY": "http://proxy.spk-berlin.de:3128" +} +``` diff --git a/cypress/e2e/duplicates.cy.js b/cypress/e2e/duplicates.cy.js index 68c54ab..4ed57dc 100644 --- a/cypress/e2e/duplicates.cy.js +++ b/cypress/e2e/duplicates.cy.js @@ -66,7 +66,7 @@ describe('duplicate entries', () => { qs: { lookfor: 'Todessymbolik', type: 'allFields', - limit: '30' + limit: '40' } }) }) diff --git a/cypress/e2e/known-Item.cy.js b/cypress/e2e/known-Item.cy.js index 4f9db73..37f6170 100644 --- a/cypress/e2e/known-Item.cy.js +++ b/cypress/e2e/known-Item.cy.js @@ -1,166 +1,22 @@ -const YAML = require('yamljs') - - -describe.skip('known item searches', () => { - // If using Testserver visit page - // before(() => { - // cy.readFile('vufind/searchspecs.yaml').then((str) => { - // parse the string into object literal - // const searchspec = YAML.parse(str) - // }) - - it('Newer should be higher', () => { - cy.visit('/', { - qs: { - q: 'Klaus Hurrelmann, Gudrun Quenzel: Lebensphase Jugend' - }, - }) - }) - - it('Newer should be higher', () => { - cy.visit('/', { - qs: { - q: 'Lehrbuch Organisationspsychologie' - }, - }) - }) - - // it('Parent before child', () => { - // cy.visit('/', { - // qs: { - // q: 'African American Review' - // }, - // }) - // }) - - it('child should be first when child is searched', () => { - cy.visit('/', { - qs: { - q: 'Journal of Comparative Law 2021' - }, - }) - }) - - it('Newest is first', () => { - cy.visit('/', { - qs: { - q: 'Alois Hahn Konstruktionen des Selbst' - }, - }) - }) - - it('primary before secondar work', () => { - cy.visit('/', { - qs: { - q: 'Die Organisierte Welt Internationale Beziehungen und Organisationsforschung' - }, - }) - }) - - it('primary before secondar work', () => { - cy.visit('/', { - qs: { - q: 'Young, Iris Marion (2002): Inclusion and Democracy. Oxford: Oxford University Press' - }, - }) - }) - it('dupes', () => { - cy.visit('/', { - qs: { - q: 'The Law of nature in the thought of Hugo grotius' - }, - }) - }) - it('exactness (mm)', () => { - cy.visit('/', { - qs: { - q: 'Boundary and the Making of Home' - }, - }) - }) - - it('author all fields', () => { - cy.visit('/', { - qs: { - q: 'glaser karin' - }, - }) - }) - it('primary before secondar work', () => { - cy.visit('/', { - qs: { - q: '36 strategeme harro von senger' - }, - }) - }) - it('linguistic context cjk', () => { - cy.visit('/', { - qs: { - q: '阎连科' - }, - }) - }) - it('passes', () => { - cy.visit('/', { - qs: { - q: 'Samuel Scheidt' - }, - }) - }) - it('passes', () => { - cy.visit('/', { - qs: { - q: 'Karte von Tschili und Schantung' - }, - }) - }) - it('primary before secondar work', () => { - cy.visit('/', { - qs: { - q: 'Liberty manik' - }, - }) - }) - it('Pro Print', () => { - cy.visit('/', { - qs: { - q: 'Sadeleer, Environmental principles. From political slogans to legal rules' - }, - }) - }) - it('passes', () => { - cy.visit('/', { - qs: { - q: 'Selam Berlin Yade Kara' - }, - }) - }) - it('strict search', () => { - cy.visit('/', { - qs: { - q: '"Corte, Justine del"' - }, - }) - }) - it('parent before child', () => { - cy.visit('/', { - qs: { - q: 'Allg. polit. Nachrichten Organ Bergbau Hüttenbetrieb 1858-' - }, - }) - }) - it('passes', () => { - cy.visit('/', { - qs: { - q: 'Die Organisierte Welt Internationale Beziehungen und Organisationsforschung' - }, - }) - }) - it('data poverty', () => { - cy.visit('/', { - qs: { - q: 'Eight International Congress of Refrigeration' - }, - }) - }) +describe('known item searches', () => { + // see #7 + // see https://forum.sbb.spk-berlin.de/t/warum-erscheinen-diese-treffer-fur-meine-anfrage/5599 + + describe('Metzler-Lexikon Theatertheorie', () => { + beforeEach(() => { + cy.visit({ + url: '/Results', + qs: { + lookfor: 'Metzler-Lexikon Theatertheorie', + type: 'allFields' + } + }) + }) + + // I don't understand the reasoning behind the requirement + it('should find exactly two matches', () => { + cy.get('[id*="result"]') + .should('have.length', 2) + }) +}) }) \ No newline at end of file diff --git a/cypress/e2e/simple-api.cy.js b/cypress/e2e/simple-api.cy.js deleted file mode 100644 index 1f23979..0000000 --- a/cypress/e2e/simple-api.cy.js +++ /dev/null @@ -1,34 +0,0 @@ -describe('simple api spec', () => { - // Broken spec, findex rejects direct requests with 403 even from internatl network - - // before(() => { - // cy.visit('select', { - // headers: { - // 'accept': 'application/json, text/plain, */*' - // }, - // qs: { - // q: 'dad' - // } - // }) - // }) - - - it.skip('connects via BaseURL', () => { - cy.visit('select?q=collection%3AFID') - }) - - // This will be a 403 for world should connect from internal network - // https://findex.gbv.de/index/11/select?q=collection%3AFID - it('connects via http request', () => { - cy.request({ - url: 'https://findex.gbv.de/index/11/select', - qs: { - q: 'dad' - } - }).then((resp) => { - expect(resp.status).to.eq(200) - }) - - }) -}) - diff --git a/cypress/e2e/simple.cy.js b/cypress/e2e/simple.cy.js index 69588b1..d173835 100644 --- a/cypress/e2e/simple.cy.js +++ b/cypress/e2e/simple.cy.js @@ -1,32 +1,53 @@ -// Results?lookfor=dad&type=AllFields +// test different connection options +// unskip for local debugging +describe.skip('connecting to ', () => { + describe('Stabikat', () => { + beforeEach(() => { + cy.visit({ + url: 'https://stabikat.de/search/Results', + qs: { + lookfor: 'dad', + type: 'AllFields' + } + }) + }) -describe('simple GUI spec', () => { - before(() => { - cy.visit({ - url: '/Results', - qs: { - lookfor: 'dad', - type: 'AllFields' - } + // requires https-proxy and no-proxy to work + it('should see results in GUI', () => { + cy.get('.resultlist') + .contains('Dad') }) }) - it('should see matching search results', () => { - cy.get('.resultlist') - .contains('Dad') - }) + describe('vudfind 6', () => { + // This requires http proxy and should only work from internal network + it('should GET results via request', () => { + cy.request({ + url: 'http://b-dev20220203-vufind-6/Search/Results', + qs: { + lookfor: 'dad' + } + }).then((resp) => { + expect(resp.status).to.eq(200) + }) - // 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('Findex', () => { + // this should only work from internal network + + it('should see 9k hits or more', () => { + const results = + cy.request({ + url: 'https://findex.gbv.de/index/11/select', + qs: { + q: 'dad' + } + }) + .its('body.response.numFound') + .should('be.at.least', 9000) + }) }) }) \ No newline at end of file diff --git a/cypress/e2e/spec.cy.js b/cypress/e2e/spec.cy.js deleted file mode 100644 index 5e3e2f6..0000000 --- a/cypress/e2e/spec.cy.js +++ /dev/null @@ -1,36 +0,0 @@ -describe('template spec', () => { - it('passes', () => { - cy.visit('/') - }) - - // This will be a 403 for world should connect from internal network - it.skip('passes', () => { - cy.request('/index/11', { - qs: { - select: { - fl: '*', - year: '2024', - 'shards.tolerant': 'true', - 'q.op': 'AND', - 'facet.threads': '4', - spellcheck: 'true', - sort: 'score+desc', - hl: 'false', - 'spellcheck.dictionary': 'default', - wt: 'json', - 'json.nl': 'arrarr', - rows: '20', - start: '0', - 'spellcheck.q': 'adad', - qf: 'title_short^750+title_full_unstemmed^600+title_full^400+title^500+title_alt^200+title_new^100+series^50+series^100+author^300+contents^10+topic_unstemmed^1050+topic^1000+geographic^300+class^500+bklname^500+genre^300+allfields_unstemmed^0.1+fulltext_unstemmed^0.1+allfields^0.1+fulltext^0.1+description^0.1+isbn+issn+long_lat_display^0.1+allfieldsGer^0.1+id^50+hierarchy_top_id+journal^500+is_hierarchy_title^500+hierarchy_top_title^500', - qt: 'edismax', - bq: ['format:eJournal^237', 'format:Journal^284', 'format:eBook^255', 'format:Book^500', 'format:Article^620', 'format:"electronic+Article"^620', 'format_facet:"Serienband"^0.1', 'publishDateSort:2023^280', 'publishDateSort:2022^260', 'publishDateSort:2021^240', 'publishDateSort:2020^220', 'publishDateSort:2019^200', 'publishDateSort:2018^180', 'publishDateSort:2017^160', 'publishDateSort:2016^150', 'publishDateSort:2015^140', 'publishDateSort:2014^130', 'publishDateSort:2013^120', 'publishDateSort:202*^500'], - mm: '0%', - q: 'adad', - fq: ['(collection:GVK+AND+collection_details:GBV_ILN_11)+OR+(collection:OLC+AND+collection_details:GBV_ILN_11)+OR+collection:NL+OR+collection:JSTOR+OR+collection:DOAJ+OR+collection:SBB-Crossref', 'NOT+id:859116190', 'NOT+signature_iln_str_mv:11\:vergriffen+OR+NOT+signature_iln_str_mv:"11\:nicht+beschaffbar"+OR+NOT+signature_iln_str_mv:11\:storniert+OR+NOT+signature_iln_str_mv:"11\:nicht+erschienen"'] - } - }, - }) - }) -}) -