Skip to content

Commit

Permalink
feat(cypress): add tags
Browse files Browse the repository at this point in the history
install grep adjust CI
tag author spec

see #28
  • Loading branch information
duncdrum committed Jan 19, 2024
1 parent ca05860 commit f510852
Show file tree
Hide file tree
Showing 6 changed files with 846 additions and 11 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
19 changes: 10 additions & 9 deletions cypress/e2e/author.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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('Glaser, Karin')
Expand All @@ -32,7 +32,7 @@ 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')
})
Expand All @@ -50,9 +50,10 @@ describe('Author Search', () => {
})

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

})
})
Expand All @@ -75,7 +76,7 @@ describe('Author Search', () => {
})
})

describe('Samuel Scheidt' , () => {
describe('Samuel Scheidt', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
Expand All @@ -91,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 @@ -103,9 +104,9 @@ describe('Author Search', () => {
.should('have.length', '5')
})

})
})
})
describe('Friedrich Schiller' , () => {
describe('Friedrich Schiller', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
Expand All @@ -120,7 +121,7 @@ describe('Author Search', () => {

// Top 20 in author search should all be by author
// see #28
it('Top 20 should all be by author', () => {
it('Top 20 should all be by author', {tags: ['@next']}, () => {
cy.get('.resultlist-data')
.find('[href*=Author]')
.each(($el, index, $lis) => {
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 f510852

Please sign in to comment.