Skip to content

Commit

Permalink
Merge pull request #46 from duncdrum/topical-1
Browse files Browse the repository at this point in the history
Topical 1
  • Loading branch information
annekauf authored Jan 25, 2024
2 parents 7c00ef2 + c5dfbd3 commit 6aee293
Show file tree
Hide file tree
Showing 6 changed files with 421 additions and 117 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
cypress/e2e/place.cy.js
cypress/e2e/chronology.cy.js
cypress/e2e/topical.cy.js
cypress/e2e/duplicates.cy.js
# browser: firefox
# Lint Yaml
- name: Yaml Lint
Expand Down
97 changes: 97 additions & 0 deletions cypress/e2e/chronology.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,101 @@ describe('Chronology', () => {
})
})
})

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

// TOP 4 hits identical Title but not duplicate
// unclear why chronology not the effective sorting criteria
// but not necessarily a problem
// PPN 447104306 (1966)
// PPN 1117375048 (1967)
// PPN 1083642081 (1986)
// PPN 403203899 (1959)
it.skip('should rank identical titles according to chronology', () => {
cy.get('[href*="1083642081"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num1) => {
const num1 = parseInt($num1)

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

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

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

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

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

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

describe('Sadeleer, Environmental principles. From political slogans to legal rules', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Sadeleer, Environmental principles. From political slogans to legal rules',
type: 'allFields'
}
})
})

// mix of reviews and different media types
// see #23
// old behaviour no longer reproducible,
// TOP1 is book (newest) followed by ebook 9same date) and earlier article with identical title
// 2020 book PPN 1740404548
// 2004 article PPN OLC1736991698
it('newer book shuold be before older article', () => {
cy.get('[href*="1740404548"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num1) => {
const num1 = parseInt($num1)

cy.get('[href*="OLC1736991698"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num2) => {
const num2 = parseInt($num2)
expect(num1).to.be.lessThan(num2)
})
})
})
})

})
201 changes: 201 additions & 0 deletions cypress/e2e/duplicates.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
describe('duplicate entries', () => {
// wait for grouping?
// see #45
describe('Osmanisches Reich im Ersten Weltkrieg', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Osmanisches Reich im Ersten Weltkrieg',
type: 'allFields'
}
})
})

// once identical items are grouped this test might fail
it('should show three items "T. E. Lawrence…"', () => {
cy.get('[href*="OLC2136322486"]')
.should('exist')
cy.get('[href*="OLC1618743244"]')
.should('exist')
cy.get('[href*="info:doi:10.7788%252Fsaeculum.2001.52.1.55"]')
.should('exist')
})

// info:doi:10.7788%252Fsaeculum.2001.52.1.55 Crossref too high
// OLC2136322486
// OLC1618743244
// see #43
it.skip('should show all three items in sequence', () => {

cy.get('[href*="info:doi:10.7788%252Fsaeculum.2001.52.1.55"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num1) => {
const num1 = parseInt($num1)

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

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

expect(num2).to.eq(num3 - 1)
})

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

})

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

// once identical items are grouped this test might fail
it('should show 4 items "Kollektive und indivi…"', () => {
cy.get('[href*="1629437654"]')
.should('exist')
cy.get('[href*="1562222260"]')
.should('exist')
cy.get('[href*="JST104055405"]')
.should('exist')
cy.get('[href*="info:doi:10.1163%252F157361290X00024"]')
.should('exist')
})

it.skip('should show all 4 in sequence', () => {

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

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

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

cy.get('[href*="info:doi:10.1163%252F157361290X00024"]')
.parents('[id^="result"]')
.find('.record-number')
.invoke('text')
.then(($num4) => {
const num4 = parseInt($num4)

expect(num3).to.eq(num4 - 1)
})

expect(num2).to.eq(num3 - 1)
})

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

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).to.eq(num2 - 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)
})
})
})
})

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 find at three matches', () => {
cy.get('[id*="result"]')
.should('have.length.gte', 3)
})
})

})
14 changes: 7 additions & 7 deletions cypress/e2e/place.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ describe('Publishing Place', () => {
//
// see https://docs.cypress.io/guides/core-concepts/conditional-testing
// see #30

it.skip('Top 5 should match the queried topic', () => {
cy.get('.resultlist')
.each(($el, index, $lis) => {
// this selects the expanded title, because it is invisible we use force
cy.get('.detailview', {force: true})
// Force display the full title line for testing
.invoke('attr','style', 'display: inline')
.each(($el) => {
cy.wrap($el)
.contains(/(K\.F\.D|Salomon|Be\.\.\.|Berlin|1908)/)
})
.then(($lis) => {
cy.wrap($lis)
.should('have.length', '5')
.contains(/(K\.F\.D|Salomon|Berlin|1908)/, {matchCase: false})
})
})

Expand Down
20 changes: 20 additions & 0 deletions cypress/e2e/reviews.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,24 @@ describe('Review after reviewed', () => {
})
})

describe('Selam Berlin Yade Kara', () => {
beforeEach(() => {
cy.visit({
url: '/Results',
qs: {
lookfor: 'Selam Berlin Yade Kara',
type: 'allFields'
}
})
})
// this beginns to conflict with chronology requirement
// see #26
it.skip('TOP1 should be the novel (primary work)', () => {
cy.get('#result0')
.find('.save-record')
.invoke('attr', 'data-id')
.should('equal','364739789')
})
})

})
Loading

0 comments on commit 6aee293

Please sign in to comment.