Skip to content

Commit

Permalink
Merge pull request #29 from duncdrum/feat-secondary-works
Browse files Browse the repository at this point in the history
Feat secondary works
  • Loading branch information
annekauf authored Jan 12, 2024
2 parents 4d7f4a6 + d55441f commit 00df588
Show file tree
Hide file tree
Showing 11 changed files with 795 additions and 71 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ jobs:
uses: cypress-io/github-action@v6
with:
build: npm install
config: baseUrl=https://stabikat.de/
spec: cypress/e2e/spec.cy.js
# browser: firefox
config: baseUrl=https://stabikat.de/search/
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
# browser: firefox
# Lint Yaml
- name: Yaml Lint
run: npm run lint
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Um direkt mit dem [Findex](https://github.com/gbv/findex-config) zu kommuniziere

```powershell
$env:HTTP_PROXY = "http://proxy.spk-berlin.de:3128"
$env:HTTPS_PROXY = "HTTPS_PROXY=http://proxy-dev.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"
```

Expand Down Expand Up @@ -72,14 +73,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.

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
```

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.
Expand All @@ -91,4 +91,12 @@ The following policies were detected that may prevent Cypress from automating Ch
For more information, see https://on.cypress.io/bad-browser-policy
```

In diese Fällen müssen Tests in `Electron` ausgeführt werden.
In diese Fällen müssen Tests in `Electron` ausgeführt werden.

### Yaml Prüfung

Um die yaml Dateien im `vufind/` Ordner auf Syntaxfehler zu überprüfen:

```powershell
npm run lint
```
112 changes: 112 additions & 0 deletions cypress/e2e/author.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
describe('Author Search', () => {
// see #14
describe('glaser karin' , () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'glaser karin',
type: 'Author'
}
})
})

// erster Treffer von Autorin
it('first hit should be by the author', () => {
cy.get('#result0')
.find('.resultlist-data')
.contains('Karin Glaser')
})
})

describe('阎连科', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: '阎连科',
type: 'Author'
}
})
})

// see #22
it('CJK author search should return translations', () => {
cy.get('.record-list')
.contains('Yan, Lianke')
})
})

describe('"Corte, Justine del"', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: '"Corte, Justine del"',
type: 'allFields'
}
})
})

it('strict search should only contain works by that author', () => {
cy.get('.resultlist-data')
.should('have.length.gte', 3)
.and('contain','Corte, Justine del')
})
})

describe('Samuel Scheidt' , () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Samuel Scheidt',
type: 'Author',
limit: '5'
}
})
})

// (DP): 182 (or 90?)works by author but 200 hits.
// within top 20 6 works unrelated to search 14 by author
// Top 5 in author search should all be by author
// see #28
it.skip('TOP 5 should all be by author', () => {
cy.get('.resultlist-data')
.find('[href*=Author]')
.each(($el, index, $lis) => {
cy.wrap($el)
.contains('Scheidt, Samuel')
})
.then(($lis) => {
cy.wrap($lis)
.should('have.length', '5')
})

})
})

describe('oliver heaviside' , () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'oliver heaviside',
type: 'allFields'
}
})
})

it('should appear in each of top 20', () => {
cy.get('.resultlist')
.each(($el, index, $lis) => {
cy.wrap($el)
.contains('Heaviside', {matchCase: false})
})
.then(($lis) => {
cy.wrap($lis)
.should('have.length', '20')
})
})
})
})
38 changes: 38 additions & 0 deletions cypress/e2e/multi-lang-phrase.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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', 'المعانی الثانیة للأمر فی النص المصری القدیم دراسة بلاغیة مقارنة ')

})

// see #27
it.skip('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('المعانی الثانیة للأمر فی النص المصری القدیم دراسة بلاغیة مقارنة ')

})
})
82 changes: 82 additions & 0 deletions cypress/e2e/nested.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
describe('Nested Work', () => {
// see #8
describe('African American Review', () => {
// 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
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'African American Review',
type: 'Title',
"filter[]": '~remote_bool:"false"'
}
})
})

// see #25
it.skip('should appear before child work', () => {
cy.get('#result0')
.find('.media-type')
.contains(' Zeitschrift (gedruckt) ')
cy.get('#result1')
.find('.media-type')
.contains(' Band einer Zeitschrift/Zeitung ')
})
})

describe('Nachrichten Organ Bergbau Hüttenbetrieb', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Nachrichten Organ Bergbau Hüttenbetrieb',
type: 'allFields'
}
})
})

// (DP): 3 hits no child works as far as I can see
// PPN: 168000709
it('first hit should be parent work', () => {
cy.get('[href*="168000709"]')
.should('exist')
})
})

describe('Journal of Comparative Law 2021', () => {
// (DP): parent work not in top 20
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Journal of Comparative Law 2021',
type: 'allFields'
}
})
})


// PPN: 1755480725
it('first hit should be 2021 child work based on search term', () => {
cy.get('#result0')
.find('[href*="1755480725"]')
.should('exist')
})

// see #25
it.skip('parent work should appear in initial results', () => {
cy.get('[href*="521689139"]')
.should('exist')
})

// This asssumes de default view
it('first hit should be child volume based on search term', () => {
cy.get('#result0')
.find('.media-type')
.should('contain', 'Band einer Zeitschrift/Zeitung')
.and('not.contain', 'Serial Volume')
})
})
})
Loading

0 comments on commit 00df588

Please sign in to comment.