Skip to content

Commit

Permalink
Merge pull request #38 from duncdrum/Konfliktspiel
Browse files Browse the repository at this point in the history
Fix_28
  • Loading branch information
duncdrum authored Jan 19, 2024
2 parents e80cdb9 + 347a3f0 commit 4e36064
Show file tree
Hide file tree
Showing 7 changed files with 914 additions and 28 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
with:
build: npm install
config: baseUrl=https://stabikat.de/search/
env: grepUntagged=true
spec: |
cypress/e2e/spec.cy.js
cypress/e2e/author.cy.js
Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,36 @@ Oder via Browser GUI modus:
npx cypress open
```

Für die Reproduktion der CI Testläufe gegen den produktiven Stabikat von ausserhalb des Hausnetzes:
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 -s cypress/e2e/simple.cy.js
CYPRESS_BASE_URL=https://stabikat.de/search/ npx cypress run --spec cypress/e2e/simple.cy.js --env grepUntagged=true
```

### Tagging

Zur besseren Organisation der Tests via tags:

- `@next` für Tests die in der Testinstanz `Vufind-6` laufen, aber noch nicht im produktivem Stabikat

```js
// This works on Vufind6 but not on stabi
it('CJK author search should return translations', {tags: ['@next']}, () => {
cy.get('.record-list')
.contains('Yan, Lianke')
})

// This works on both
it('CJK author search should match latinized family name', () => {
cy.get('.record-list')
.contains('Yan')
})
```

Wenn die nötigen Änderungen der `searchpsec.yaml` im Stabikat live gegangen sind, müssen die entsprechenden `@next` Tags entfernt werden.

Für Tests die in beiden Instanzen (noch) nicht laufen: `.skip`

### Yaml Prüfung

Um die yaml Dateien im `vufind/` Ordner auf Syntaxfehler zu überprüfen:
Expand Down
60 changes: 55 additions & 5 deletions cypress/e2e/author.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ describe('Author Search', () => {
})

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

})
})

Expand All @@ -31,12 +32,32 @@ describe('Author Search', () => {
})

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

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

// see #22
it('CJK strict search should not return translations', () => {
cy.get('.record-list')
.contains('阎连科')
.should('not.contain', 'Yan, Lianke')

})
})

describe('"Corte, Justine del"', () => {
beforeEach(() => {
cy.visit({
Expand All @@ -55,7 +76,7 @@ describe('Author Search', () => {
})
})

describe('Samuel Scheidt' , () => {
describe('Samuel Scheidt', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
Expand All @@ -71,7 +92,7 @@ describe('Author Search', () => {
// 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', () => {
it('TOP 5 should all be by author', {tags: ['@next']}, () => {
cy.get('.resultlist-data')
.find('[href*=Author]')
.each(($el, index, $lis) => {
Expand All @@ -83,6 +104,35 @@ describe('Author Search', () => {
.should('have.length', '5')
})

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

}
})
})


// Top 20 in author search should all be by author
// see #28
it('Top 20 should all be by author', {tags: ['@next']}, () => {
cy.get('.resultlist-data')
.find('[href*=Author]')
.each(($el, index, $lis) => {
cy.wrap($el)
.contains('Schiller, Friedrich')
})
.then(($lis) => {
cy.wrap($lis)
.should('have.length', '20')
})

})
})

Expand Down
8 changes: 8 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
// Import commands.js using ES2015 syntax:
import './commands'

// cypress/support/index.js
// if you want to use the "import" keyword
// note: `./index.d.ts` currently extends the global Cypress types and
// does not define `registerCypressGrep` so the import path is directly
// pointed to the `support.js` file
import registerCypressGrep from '@cypress/grep/src/support'
registerCypressGrep()


// Alternatively you can use CommonJS syntax:
// require('./commands')
Expand Down
Loading

0 comments on commit 4e36064

Please sign in to comment.