Skip to content

Commit

Permalink
Merge pull request #89 from StaatsbibliothekBerlin/post-release-check
Browse files Browse the repository at this point in the history
fix: remove passing tags
  • Loading branch information
annekauf authored Jul 16, 2024
2 parents 8b5fc6d + 422bdf2 commit e721deb
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 120 deletions.
47 changes: 28 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,31 @@ Mit GUI:
npx cypress open
```

Per Default laufen die Tests gegen den [Ranking1](http://stabikat-ranking1/). Die `searchspecs.yml` befindet sich im Verzeichnis: `/var/www/vufind/local/config/vufind`
Per Default laufen die Tests gegen den [Ranking1](http://stabikat-ranking1/) testserver. Die `searchspecs.yml` befindet sich im Verzeichnis: `/var/www/vufind/local/config/vufind`

### Tagging
Für die Reproduktion der CI Testläufe gegen den produktiven Stabikat z.Bsp 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`

Zur besseren Organisation der Tests via tags:
```bash
CYPRESS_BASE_URL=https://stabikat.de/search/ npx cypress run --spec cypress/e2e/simple.cy.js --env grepUntagged=true
```

- `@next` für Tests die in der Testinstanz laufen, aber noch nicht im produktivem Stabikat
```powershell
npx cypress open --config baseUrl=https://stabikat.de/search/ --env grepUntagged=true
```

Für weitere Optionen siehe [Cypress command-line](https://docs.cypress.io/guides/guides/command-line)

### Tagging

Für offene issues, mit Test die in beiden Instanzen (noch) nicht laufen nutze: `.skip`.
Tests die auf dem Testserver grün sind, aber im produktiven Stabikat rot werden durch den `@next` tag gekennzeichnet:

- `@next`

```js
// This works on test environment but not on stabi
it('CJK author search should return translations', {tags: ['@next']}, () => {
Expand All @@ -102,25 +119,15 @@ Zur besseren Organisation der Tests via tags:
})
```

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`

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

```bash
CYPRESS_BASE_URL=https://stabikat.de/search/ npx cypress run --spec cypress/e2e/simple.cy.js --env grepUntagged=true
```
Wenn die nötigen Änderungen der `searchpsec.yaml` im Stabikat live gegangen sind, müssen die entsprechenden `@next` Tags entfernt werden. Folgender Befehl führ nur die tests mit tag aus:

```powershell
npx cypress open --config baseUrl=https://stabikat.de/search/ --env grepUntagged=true
```shell
npx cypress run --config baseUrl=https://stabikat.de/search/ --env grepTags=@next
```

Für weitere Optionen siehe [Cypress command-line](https://docs.cypress.io/guides/guides/command-line)
Anschliessend bei allen grünen Tests den Tag entfernen.

## Yaml Prüfung

Expand All @@ -134,6 +141,8 @@ Dieser Test wird auf GitHub automatisch ausgeführt.

## Troubleshooting

Die Datei `cypress/e2e/simple.cy.js` beinhaltet einen Selbsttest. Zur Prolembehebung können diese *unskipped* werden.

### Cypress Browser Warning

Sollte ein eine Browser spezifische Warnung erscheinen, verhindern Windows Systemeinstellungen die automatisierte Nutzung des gewählten Browsers.
Expand Down
1 change: 1 addition & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { defineConfig } = require("cypress");
module.exports = defineConfig({
e2e: {
baseUrl: 'http://stabikat-ranking1/Search',
waitForAnimations: false,
setupNodeEvents(on, config) {
// implement node event listeners here
},
Expand Down
16 changes: 6 additions & 10 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', {tags: ['@next']}, () => {
it('first hit should be by the author', () => {
cy.get('#result0')
.find('.resultlist-data')
.contains(/(?=.*Karin)(?=.*Glaser)/)
Expand All @@ -32,7 +32,7 @@ describe('Author Search', () => {
})

// see #22
it('CJK author search should return translations', {tags: ['@next']}, () => {
it('CJK author search should return translations', () => {
cy.get('.record-list')
.contains('Yan, Lianke')
})
Expand Down Expand Up @@ -158,18 +158,14 @@ describe('Author Search', () => {
} else {
cy.get($el)
.click()
cy.get('.long-view')
.find('a[id^=description_]')
.click()
cy.get('.additional')
cy.get('.detail-data')
.contains('Heaviside', {matchCase: false})
}

})

}
})
})
})


describe('Elfriede Jelinek', () => {
beforeEach(() => {
cy.visit({
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/chronology.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ describe('Chronology', () => {
})
})

describe('future publication', {tags: ['@next']}, () => {
describe('future publication', () => {
// see #58
// run a query for publications 5 years from noww
beforeEach(() => {
Expand Down
145 changes: 92 additions & 53 deletions cypress/e2e/duplicates.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,78 +125,117 @@ describe('duplicate entries', () => {
})
})

it('should show 2 items "Todessymbolik in Komoposi…"', () => {
cy.get('[href*="742413772"]')
.should('exist')
cy.get('[href*="097133701"]')
.should('exist')
})

it('should show both items in sequence', () => {

cy.get('[href*="742413772"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num1) => {
const num1 = parseInt($num1)

cy.get('[href*="097133701"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num2) => {
const num2 = parseInt($num2)
// see #95 no longer duplicate items
// it('should show 2 items "Todessymbolik in Komoposi…"', () => {
// cy.get('[href*="742413772"]')
// .should('exist')
// cy.get('[href*="097133701"]')
// .should('exist')
// })

// it('should show both items in sequence', () => {

// cy.get('[href*="742413772"]')
// .parents('[id^="result"]')
// .find('.record-number')
// .invoke('text')
// .then(($num1) => {
// const num1 = parseInt($num1)

// cy.get('[href*="097133701"]')
// .parents('[id^="result"]')
// .find('.record-number')
// .invoke('text')
// .then(($num2) => {
// const num2 = parseInt($num2)

// expect(num1 - num2).to.be.at.most(1)
// expect(num2 - num1).to.be.at.most(1)
// })
// })
// })

// it('should show 2 items "…in der Musik"', () => {
// cy.get('[href*="144358150X"]')
// .should('exist')
// cy.get('[href*="544614259"]')
// .should('exist')
// })

// it('should show both items in sequence', () => {

// cy.get('[href*="144358150X"]')
// .parents('[id^="result"]')
// .find('.record-number')
// .invoke('text')
// .then(($num1) => {
// const num1 = parseInt($num1)

// cy.get('[href*="544614259"]')
// .parents('[id^="result"]')
// .find('.record-number')
// .invoke('text')
// .then(($num2) => {
// const num2 = parseInt($num2)

// expect(num1).to.eq(num2 - 1)
// })
// })
// })
})

expect(num1 - num2).to.be.at.most(1)
expect(num2 - num1).to.be.at.most(1)
})
})
describe('The Law of nature in the thought of Hugo grotius', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'The Law of nature in the thought of Hugo grotius',
type: 'Title'
}
})
})

it('should show 2 items "…in der Musik"', () => {
cy.get('[href*="144358150X"]')
.should('exist')
cy.get('[href*="544614259"]')
.should('exist')
it('should find at least three matches', () => {
cy.get('[id*="result"]')
.should('have.length.gte', 3)
})
})

it('should show both items in sequence', () => {

cy.get('[href*="144358150X"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num1) => {
const num1 = parseInt($num1)

cy.get('[href*="544614259"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num2) => {
const num2 = parseInt($num2)
// see #95
// see above
describe('Todessymbolik in Komposi…', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Todessymbolik in Kompositionen auf den Tod römisch-deutscher Könige und Kaiser',
type: 'Title'
}
})
})

expect(num1).to.eq(num2 - 1)
})
})
it('should find one match', () => {
cy.get('[id*="result"]')
.should('have.length', 1)
})
})

describe('The Law of nature in the thought of Hugo grotius', () => {
// see #95
// see above
describe('Todessymbolik in der Musik', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'The Law of nature in the thought of Hugo grotius',
lookfor: 'Todessymbolik in der Musik',
type: 'Title'
}
})
})

it('should find at three matches', () => {
it('should find one match', () => {
cy.get('[id*="result"]')
.should('have.length.gte', 3)
.should('have.length', 1)
})
})

Expand Down
5 changes: 4 additions & 1 deletion cypress/e2e/multi-lang-phrase.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ describe('Foreign language phrase search', () => {
})
})

it('TOP 1 should be in english', () => {
// see #88
// see #92
// skip to remove blocker. This used to work.
it.skip('TOP 1 should be in english', () => {
cy.get('.resultlist')
.first()
.click()
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/place.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ describe('Publishing Place', () => {
})

// Results are good
// seee #96
// RegEx check for relevant titles is a bit on the flaky side
// see second test below
it('TOP 20 should have topical titles', () => {
cy.get('.resultlist')
.each(($el, index, $lis) => {
cy.wrap($el)
.contains(/^(?=.*Berlin)(?=.*Geschichte)|Kalend.*|Chron.*$/)
.contains(/^(?=.*Berlin)|(?=.*Hohenschönhausen)|(?=.*Geschichte)|Kalend.*|Chron.*$/)
})
.then(($lis) => {
cy.wrap($lis)
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/topical.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe('Topical Search', () => {
.click()
})
cy.get('table')
.should('have.length', 10)
.should('have.length.gte', 8)
.each(($el) => {
cy.wrap($el)
.contains(/K(ünstliche )?I(ntelligenz)?/, { matchCase: false })
Expand Down
Loading

0 comments on commit e721deb

Please sign in to comment.