Skip to content

Commit

Permalink
Merge pull request #41 from duncdrum/feat-import-chrono
Browse files Browse the repository at this point in the history
fix(chronolgy): finish chrono import
  • Loading branch information
annekauf authored Jan 20, 2024
2 parents 4e36064 + afb0eac commit 7c00ef2
Show file tree
Hide file tree
Showing 8 changed files with 558 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
cypress/e2e/nested.cy.js
cypress/e2e/multi-lang-phrase.cy.js
cypress/e2e/place.cy.js
cypress/e2e/chronology.cy.js
cypress/e2e/topical.cy.js
# browser: firefox
# Lint Yaml
- name: Yaml Lint
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ For more information, see https://on.cypress.io/bad-browser-policy

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

### NPM Installations Probleme
### NPM Installationsprobleme

Da der Proxy über `http` aufgerufen wird, muss uneter Umständen der strikte ssl modus deaktiviert werden.
Da der Proxy über `http` aufgerufen wird, muss unter Umständen der strikte ssl modus deaktiviert werden.

```powershell
npm set strict-ssl false
Expand Down
234 changes: 215 additions & 19 deletions cypress/e2e/chronology.cy.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,240 @@
describe('Chronology', () => {
// see #11
describe.skip('Andreas Gryphius', () => {
describe('Andreas Gryphius', () => {
// DP: add sort: 'year' to qs for sorted results
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Andreas Gryphius',
type: 'Author'
type: 'allFields'
}
})
})

it('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 ')
// Items without a year in resultlist-data exist but quite rare
// DP: sometimes the date in resultlist-data conflicts with the exact date in details view
// which can impact the percieved sorting
// see #35
it.skip('Top 1 should be published after 2020', () => {
cy.get('.resultlist-data')
.first()
.contains(/202\d/)
})
})

describe.skip('oliver heaviside', () => {
describe('Klaus Hurrelmann, Gudrun Quenzel: Lebensphase Jugend', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'oliver heaviside',
type: 'Author'
lookfor: 'Klaus Hurrelmann, Gudrun Quenzel: Lebensphase Jugend',
type: 'allFields'
}
})
})

it('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 ')
// 2022 ed. PPN 1739067762
// 2012 ed. PPN 682815853
it('Latest edition should be before earlier edition', () => {
// pick 2022 edition
cy.get('[href*="1739067762"]')
// select ranking number from hit list
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num1) => {
// turn into integer
const num1 = parseInt($num1)

// repeat for 2012 edition
cy.get('[href*="682815853"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num2) => {
const num2 = parseInt($num2)
// make sure 1 < 2
expect(num1).to.be.lessThan(num2)
})
})
})
})

describe('Lehrbuch Organisationspsychologie', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Lehrbuch Organisationspsychologie',
type: 'Title'
}
})
})
// 2007 ed PPN 537598197
// 1995 ed PPN 182859061
// 2004 ed PPN 366403265
// see #35
it.skip('Later editions should be ranked higher', () => {
cy.get('[href*="537598197"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num1) => {
const num1 = parseInt($num1)

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

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

expect(num2).to.be.lessThan(num3)
})

expect(num1).to.be.lessThan(num2)
})
})
})
})

// see #36
describe('emanzipation juden', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'emanzipation juden',
type: 'allFields'
}
})
})

it.skip('should ...', () => {
cy.get('.resultlist')
})
})

// Sorting by date decreases relevance
// 608 hits total but many do not contain the search terms in the title
// or are about later periods all together
// why is 130141674 shown ?
// see #39
describe.skip('Kulturgeschichte deutsches Kaiserreich', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Kulturgeschichte deutsches Kaiserreich',
type: 'allFields'
}
})
})

it('should ...', () => {
cy.get('.resultlist')
})
})

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

// PPN 1612978711
// PPN JST069657696
// see #35
it.skip('should not match irrelevant titles', () => {
cy.get('[href*="1612978711"]')
.should('not.exist')
cy.get('[href*="JST069657696"]')
.should('not.exist')
})

it('should not contain Caralli in Title', () => {
cy.get('.resultlist')
.should(`not.contain`, `Caralli`)
})
})

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

// see #40
it('should contain both primary and secondary literature', () => {
cy.get('[href*="272952737"]')
.should('exist')
cy.get('[href*="1507865600"]')
.should('exist')
cy.get('[href*="1016493053"]')
.should('exist')

})
})

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

// 1756833699
// not sure if this should or should not exist
// see #35
// see #22
it.skip('should show relevant titles in translation', () => {
cy.get('[href*="1756833699"]')
.should('exist')
})

// PPN 389602841 2005
// PPN 430480865 1969
// see #35
it.skip('should show relevant titles in translation', () => {
cy.get('[href*="389602841"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num1) => {
const num1 = parseInt($num1)

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

expect(num1).to.be.lessThan(num2)
})
})
})
})
})
89 changes: 89 additions & 0 deletions cypress/e2e/multi-lang-phrase.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ describe('Foreign language phrase search', () => {
})
})

// see #33
describe('popular science soviet', () => {
beforeEach(() => {
cy.visit({
Expand All @@ -128,4 +129,92 @@ describe('Foreign language phrase search', () => {
.contains(/(?=.*Soviet.*)(?=.*Science)(?=.*Popular.*)/i)
})
})

describe('Boundary and the Making of Home', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Boundary and the Making of Home',
type: 'allFields',
limit: '5'
}
})
})

// 16.01.24 Title no longer in TOP 20
// PPN CAJ435467670
// see #27 #20
// Parallel Title: 门禁社区边界和家的构建关系研究 see below
it.skip('TOP 5 should contain matching article', () => {
cy.get('[href*="CAJ435467670"]')
.should('exist')
})

// see #27 #20
// the assertion might be too strong
it.skip('TOP 5 titles should contain all search phrases', () => {
cy.get('.resultlist')
.each(($el, index, $lis) => {
cy.wrap($el)
.contains(/(?=.*boundar.*)(?=.*mak.*)(?=.*home)/i)
})
.then(($lis) => {
cy.wrap($lis)
.should('have.length', '5')
})
})
})

describe('门禁社区边界和家的构建关系研究', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: '门禁社区边界和家的构建关系研究',
type: 'allFields',
limit: '1'
}
})
})

// 16.01.24 Title no longer in TOP 20
// PPN CAJ435467670
// see #27
// see Boundary and the Making of Home above
it('should find matching article as first hit', () => {
cy.get('[href*="CAJ435467670"]')
.should('exist')
})
})

describe('Zivopisnaja Rossija', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Zivopisnaja Rossija',
type: 'allFields',
limit: '5'
}
})
})

it('should contain non Latin search phrase', () => {
cy.get('.resultlist')
.contains('Живописная Россия')
})

it('TOP 5 titles should contain search phrases', () => {
cy.get('.resultlist')
.each(($el, index, $lis) => {
cy.wrap($el)
.contains('Živopisnaja Rossija')
})
.then(($lis) => {
cy.wrap($lis)
.should('have.length', '5')
})
})
})
})
Loading

0 comments on commit 7c00ef2

Please sign in to comment.