diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 910cad4..c3eb066 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/cypress/e2e/chronology.cy.js b/cypress/e2e/chronology.cy.js index 75c3e71..4816e41 100644 --- a/cypress/e2e/chronology.cy.js +++ b/cypress/e2e/chronology.cy.js @@ -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) + }) + }) + }) + }) + }) \ No newline at end of file diff --git a/cypress/e2e/duplicates.cy.js b/cypress/e2e/duplicates.cy.js new file mode 100644 index 0000000..68c54ab --- /dev/null +++ b/cypress/e2e/duplicates.cy.js @@ -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) + }) + }) + +}) \ No newline at end of file diff --git a/cypress/e2e/place.cy.js b/cypress/e2e/place.cy.js index 9c65d2c..7ffb57d 100644 --- a/cypress/e2e/place.cy.js +++ b/cypress/e2e/place.cy.js @@ -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}) }) }) diff --git a/cypress/e2e/reviews.cy.js b/cypress/e2e/reviews.cy.js index f772ee1..a94ee86 100644 --- a/cypress/e2e/reviews.cy.js +++ b/cypress/e2e/reviews.cy.js @@ -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') + }) + }) + }) \ No newline at end of file diff --git a/cypress/e2e/topical.cy.js b/cypress/e2e/topical.cy.js index 1a6b7f9..c800d84 100644 --- a/cypress/e2e/topical.cy.js +++ b/cypress/e2e/topical.cy.js @@ -12,8 +12,15 @@ describe('Topical Search', () => { }) // too many articles - it('should ...', () => { - cy.get('.resultlist') + // note both requested titles are translations + // see #22 + // see #43 + + it.skip('should contain relevant titles', () => { + cy.get('[href*="490244408"]') + .should('exist') + cy.get('[href*="595354122"]') + .should('exist') }) }) @@ -23,14 +30,36 @@ describe('Topical Search', () => { url: '/Results', qs: { lookfor: 'soziale arbeit theorie', - type: 'allFields' + type: 'Keyword', + limit: '10' } }) }) - // too many articles - it('should ...', () => { - cy.get('.resultlist') + // too many articles in allFields no testable conditions + // keyword search shows signs of poor relevance + // PPN: 276627377 pl 1987 und nicht das gesuchte thema + // see #43 + + it.skip('keyword search should not rank loosely related items in TOP 20', () => { + cy.get('[href*="276627377"]') + .should('not.exist') + }) + + // This is a judgement call based on the allFields results, + // 5 of 20 from 2020 or later seems too low + // This tests for publication dates from 2010-202X in TOP 10 + // see #43 + + it.skip('TOP10 should only contain items from 2010 or later', () => { + // cy.get('.resultlist-data') + // .first() + // .contains(/20(1|2)\d/) + cy.get('.resultlist-data') + .each(($data) => { + cy.wrap($data) + .contains(/20(1|2)\d/) + }) }) }) @@ -46,24 +75,32 @@ describe('Topical Search', () => { }) // too many articles - it('should ...', () => { + // nothing obviously wrong with list imv + // many eletronic ressources to be expected for topic + // needs clearer criteria + // see #43 + + it.skip('should ...', () => { cy.get('.resultlist') }) }) + // see above unclear success criteria describe('othering', () => { beforeEach(() => { cy.visit({ url: '/Results', qs: { lookfor: 'othering', - type: 'allFields' + type: 'allFields', + limit: 5 } }) }) - it('should ...', () => { + it('TOP5 should contain topic in title', () => { cy.get('.resultlist') + .contains('othering', { matchCase: false }) }) }) @@ -78,88 +115,79 @@ describe('Topical Search', () => { }) }) - it('should ...', () => { + // the tourism hits all contain MANGA or ANIME as subject + // see #42 + it.skip('should ...', () => { cy.get('.resultlist') }) }) - describe('Osmanisches Reich im Ersten Weltkrieg', () => { - beforeEach(() => { - cy.visit({ - url: '/Results', - qs: { - lookfor: 'Osmanisches Reich im Ersten Weltkrieg', - type: 'allFields' - } - }) - }) - it('should ...', () => { - cy.get('.resultlist') - }) - }) describe('esperanto ddr', () => { beforeEach(() => { cy.visit({ url: '/Results', qs: { lookfor: 'esperanto ddr', - type: 'allFields' + type: 'allFields', + limit: '10' } }) }) - it('should ...', () => { - cy.get('.resultlist') + // relevance looks good + it('should contain DDR and esperanto in title', () => { + // this selects the expanded title, because it is invisible we use force + cy.get('.detailview', { force: true }) + // Force display of the full title line for testing + .invoke('attr', 'style', 'display: inline') + .each(($el) => { + cy.wrap($el) + .contains('ddr', { matchCase: false }) + }) + cy.get('.detailview') + .each(($el) => { + cy.wrap($el) + .contains('esperanto', { matchCase: false }) + }) }) }) + describe('KI gesichtserkennung', () => { beforeEach(() => { cy.visit({ url: '/Results', qs: { lookfor: 'KI gesichtserkennung', - type: 'allFields' + type: 'Keyword', + limit: '10' } }) }) - it('should ...', () => { - cy.get('.resultlist') - }) - }) - describe('koptische Stoffe', () => { - beforeEach(() => { - cy.visit({ - url: '/Results', - qs: { - lookfor: 'koptische Stoffe', - type: 'allFields' - } - }) - }) + // why is there no date for DOAJ041084004 ?? + // list looks ok + // see #44 + it('TOP 10 in keyword search should contain both matching keywords', () => { - it('should ...', () => { cy.get('.resultlist') - }) - }) + // Display details + .each(($el) => { + cy.wrap($el) + .click() + }) + cy.get('table') + .should('have.length', 10) + .each(($el) => { + cy.wrap($el) + .contains(/K(ünstliche )?I(ntelligenz)?/, { matchCase: false }) + cy.get($el) + .contains('Gesichtserkennung', { matchCase: false }) + }) - describe('Todessymbolik', () => { - beforeEach(() => { - cy.visit({ - url: '/Results', - qs: { - lookfor: 'Todessymbolik', - type: 'allFields' - } - }) - }) - - it('should ...', () => { - cy.get('.resultlist') }) }) - + describe('affektive störung', () => { beforeEach(() => { cy.visit({ @@ -171,8 +199,9 @@ describe('Topical Search', () => { }) }) - it('should ...', () => { - cy.get('.resultlist') + it('should match "Aff. bipolare Psychose…"', () => { + cy.get('[href*="OLC2108288694"]') + .should('exist') }) }) @@ -187,56 +216,12 @@ describe('Topical Search', () => { }) }) - it('should ...', () => { - cy.get('.resultlist') - }) - }) - - 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: 'allFields' - } - }) - }) - - it('should ...', () => { - cy.get('.resultlist') - }) - }) - - 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' - } - }) - }) - - // too many articles? - it('should ...', () => { - cy.get('.resultlist') + // I don't understand the reasoning behind the requirement + it('should find at least one match', () => { + cy.get('[id*="result"]') + .should('have.length.gte', 1) }) }) - describe('Selam Berlin Yade Kara', () => { - beforeEach(() => { - cy.visit({ - url: '/Results', - qs: { - lookfor: 'Selam Berlin Yade Kara', - type: 'allFields' - } - }) - }) - it('should ...', () => { - cy.get('.resultlist') - }) - }) + }) \ No newline at end of file