Skip to content

Commit

Permalink
Merge pull request #21 from duncdrum/feat-curent-lit
Browse files Browse the repository at this point in the history
Feat-current-lit
  • Loading branch information
annekauf authored Jan 9, 2024
2 parents 9686dda + fea0ec7 commit b2c7f99
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_modules/
.env
cypress.env.json
cypress/screenshots/
cypress/videos
notes/DP.md
.DS_Store

Expand Down
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ npm i

### Konfiguration

Um direkt mit dem Findex zu kommunizieren müssen die [Proxy Einstellungen](https://docs.cypress.io/guides/references/proxy-configuration) der cypress Umgebung manuel angepasst werden.
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.

```powershell
$env:HTTP_PROXY = "http://proxy.spk-berlin.de:3128"
Expand All @@ -55,10 +55,40 @@ Zugangsdaten für den `vf6_user` müssen in der `cypress.env.json` eingetragen
}
```

### Benutzung
## Benutzung

Zum ausführen der Tests:

Entweder in der Kommandozeile:

```powershell
npx cypress run
```
```

Oder via Browser GUI modus:


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


```powershell
Cypress detected policy settings on your computer that may cause issues.
The following policies were detected that may prevent Cypress from automating Chrome:
- HKEY_CURRENT_USER\Software\Policies\Google\Chrome\ProxySettings
For more information, see https://on.cypress.io/bad-browser-policy
```

In diese Fällen müssen Tests in `Electron` ausgeführt werden.
14 changes: 7 additions & 7 deletions cypress/e2e/known-Item.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ describe.skip('known item searches', () => {
})
})

it('Parent before child', () => {
cy.visit('/', {
qs: {
q: 'African American Review'
},
})
})
// it('Parent before child', () => {
// cy.visit('/', {
// qs: {
// q: 'African American Review'
// },
// })
// })

it('child should be first when child is searched', () => {
cy.visit('/', {
Expand Down
89 changes: 69 additions & 20 deletions cypress/e2e/simple.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,94 @@


describe('simple GUI spec', () => {
before(() => {
before(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'dad',
type: 'AllFields'
}
})
})

it('should see matching search results', () => {
cy.get('.resultlist')
.contains('Dad')
})

// 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('Foreign language phrase search', () => {
// See #6
// Thematische Suche#L30
it('en all fields query matches en not ar', () => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'dad',
lookfor: 'Egyptian Language',
type: 'AllFields'
}
})
})
cy.get('.resultlist')
// PPN JST063665204
.contains('The Egyptian Language')
cy.get('.resultlist')
// PPN DOAJ008736839
.should('not.contain', 'المعانی الثانیة للأمر فی النص المصری القدیم دراسة بلاغیة مقارنة ')

it('passes via Browser', () => {
cy.get('.result-body')
.contains('Dad : Roman')
})

// This will be a 403 from world should connect from internal network
it('passes via http request', () => {
cy.request({
it('en subject query matches en and ar', () => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'dad'
lookfor: 'Egyptian Language',
type: 'Subject'
}
}).then((resp) => {
expect(resp.status).to.eq(200)
})
cy.get('.resultlist')
// PPN JST063665204
.contains('The Egyptian Language')
cy.get('.resultlist')
// PPN DOAJ008736839
.contains('المعانی الثانیة للأمر فی النص المصری القدیم دراسة بلاغیة مقارنة ')

})
})

// TODO(DP): get json repsonse from console
it('passes via http request', () => {
cy.request({
// see #8
// 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
//
describe('Parent Work', () => {
it('should appear before child work', () => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'dad'
lookfor: 'African American Review',
type: 'Title',
"filter[]": '~remote_bool:"false"'
}
}).then((resp) => {
expect(resp.status).to.eq(200)
cy.log(resp)
})
cy.get('#result0')
.find('.media-type')
.contains(' Zeitschrift (gedruckt) ')
cy.get('#result1')
.find('.media-type')
.contains(' Band einer Zeitschrift/Zeitung ')

})
})
})
})
1 change: 0 additions & 1 deletion notes/Notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ https://github.com/sul-dlss/sw_index_tests https://github.com/sul-dlss/searchwor
https://github.com/traject/traject https://github.com/sul-dlss/traject_plus

(https://github.com/sul-dlss/folio_qa_tests) :-)

8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"homepage": "https://github.com/duncdrum/sbb-relevance-test#readme",
"devDependencies": {
"cypress": "^13.5.1",
"cypress": "^13.6.2",
"yamljs": "^0.3.0"
}
}

0 comments on commit b2c7f99

Please sign in to comment.