Skip to content

Commit

Permalink
fix(chronolgy): add sample queries
Browse files Browse the repository at this point in the history
some caveats about dates displayed in resultlist-data

see #11 #35 #36
  • Loading branch information
duncdrum committed Jan 19, 2024
1 parent b50331c commit 08f90fc
Showing 1 changed file with 89 additions and 25 deletions.
114 changes: 89 additions & 25 deletions cypress/e2e/chronology.cy.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,139 @@
describe('Chronology', () => {
// see #11
describe.only('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 ... ', () => {
cy.get('.resultlist')
// 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('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 ...', () => {
cy.get('.resultlist')
// 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('Klaus Hurrelmann, Gudrun Quenzel: Lebensphase Jugend', () => {
describe('Lehrbuch Organisationspsychologie', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Klaus Hurrelmann, Gudrun Quenzel: Lebensphase Jugend',
type: 'allFields'
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)

it('should ...', () => {
cy.get('.resultlist')
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)
})
})
})
})

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

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

describe('emanzipation juden', () => {
// 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 ?
//
describe.only('Kulturgeschichte deutsches Kaiserreich', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'emanzipation juden',
lookfor: 'Kulturgeschichte deutsches Kaiserreich',
type: 'allFields'
}
})
Expand All @@ -80,12 +144,12 @@ describe('Chronology', () => {
})
})

describe('Kulturgeschichte deutsches Kaiserreich', () => {
describe('Caral America', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Kulturgeschichte deutsches Kaiserreich',
lookfor: 'Caral America',
type: 'allFields'
}
})
Expand All @@ -96,12 +160,12 @@ describe('Chronology', () => {
})
})

describe('Caral America', () => {
describe('jugendliteratur mittelalter roman', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Caral America',
lookfor: 'jugendliteratur mittelalter roman',
type: 'allFields'
}
})
Expand All @@ -112,12 +176,12 @@ describe('Chronology', () => {
})
})

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

0 comments on commit 08f90fc

Please sign in to comment.