|
| 1 | +describe('Concept page, full vs. partial page loads', () => { |
| 2 | + const pageLoadTypes = ["full", "partial"] |
| 3 | + |
| 4 | + // tests that should be executed both with and without partial page load |
| 5 | + pageLoadTypes.forEach((pageLoadType) => { |
| 6 | + it('contains concept preflabel / ' + pageLoadType, () => { |
| 7 | + if (pageLoadType == "full") { |
| 8 | + cy.visit('/yso/en/page/p39473') // go to "burial mounds" concept page |
| 9 | + } else { |
| 10 | + cy.visit('/yso/en/page/p5714') // go to "prehistoric graves" concept page |
| 11 | + // click on the link to "burial mounds" to trigger partial page load |
| 12 | + cy.get('#tab-hierarchy').contains('a', 'burial mounds').click() |
| 13 | + } |
| 14 | + |
| 15 | + // check that the vocabulary title is correct |
| 16 | + cy.get('#vocab-title > a').invoke('text').should('equal', 'YSO - General Finnish ontology (archaeology)') |
| 17 | + |
| 18 | + // check the concept prefLabel |
| 19 | + cy.get('#concept-heading h1').invoke('text').should('equal', 'burial mounds') |
| 20 | + }) |
| 21 | + it('concept preflabel can be copied to clipboard / ' + pageLoadType, () => { |
| 22 | + if (pageLoadType == "full") { |
| 23 | + cy.visit('/yso/en/page/p39473') // go to "burial mounds" concept page |
| 24 | + } else { |
| 25 | + cy.visit('/yso/en/page/p5714') // go to "prehistoric graves" concept page |
| 26 | + // click on the link to "burial mounds" to trigger partial page load |
| 27 | + cy.get('#tab-hierarchy').contains('a', 'burial mounds').click() |
| 28 | + } |
| 29 | + |
| 30 | + // click the copy to clipboard button next to the prefLabel |
| 31 | + cy.get('#copy-preflabel').click() |
| 32 | + |
| 33 | + // check that the clipboard now contains "music pyramids" |
| 34 | + // NOTE: This test may fail when running Cypress interactively in a browser. |
| 35 | + // The reason is browser security policies for accessing the clipboard. |
| 36 | + // If that happens, make sure the browser window has focus and re-run the test. |
| 37 | + cy.window().its('navigator.clipboard').invoke('readText').then((result) => {}).should('equal', 'burial mounds'); |
| 38 | + }) |
| 39 | + it('contains concept URI / ' + pageLoadType, () => { |
| 40 | + if (pageLoadType == "full") { |
| 41 | + cy.visit('/yso/en/page/p39473') // go to "burial mounds" concept page |
| 42 | + } else { |
| 43 | + cy.visit('/yso/en/page/p5714') // go to "prehistoric graves" concept page |
| 44 | + // click on the link to "burial mounds" to trigger partial page load |
| 45 | + cy.get('#tab-hierarchy').contains('a', 'burial mounds').click() |
| 46 | + } |
| 47 | + |
| 48 | + // check the property name |
| 49 | + cy.get('.prop-uri .property-label').invoke('text').should('equal', 'URI') |
| 50 | + |
| 51 | + // check the concept URI |
| 52 | + cy.get('#concept-uri').invoke('text').should('equal', 'http://www.yso.fi/onto/yso/p39473') |
| 53 | + }) |
| 54 | + it('concept URI can be copied to clipboard / ' + pageLoadType, () => { |
| 55 | + if (pageLoadType == "full") { |
| 56 | + cy.visit('/yso/en/page/p39473') // go to "burial mounds" concept page |
| 57 | + } else { |
| 58 | + cy.visit('/yso/en/page/p5714') // go to "prehistoric graves" concept page |
| 59 | + // click on the link to "burial mounds" to trigger partial page load |
| 60 | + cy.get('#tab-hierarchy').contains('a', 'burial mounds').click() |
| 61 | + } |
| 62 | + |
| 63 | + // click the copy to clipboard button next to the URI |
| 64 | + cy.get('#copy-uri').click() |
| 65 | + |
| 66 | + // check that the clipboard now contains "http://www.yso.fi/onto/yso/p39473" |
| 67 | + // NOTE: This test may fail when running Cypress interactively in a browser. |
| 68 | + // The reason is browser security policies for accessing the clipboard. |
| 69 | + // If that happens, make sure the browser window has focus and re-run the test. |
| 70 | + cy.window().its('navigator.clipboard').invoke('readText').then((result) => {}).should('equal', 'http://www.yso.fi/onto/yso/p39473'); |
| 71 | + }) |
| 72 | + it('concept notation can be copied to clipboard / ' + pageLoadType, () => { |
| 73 | + if (pageLoadType == "full") { |
| 74 | + cy.visit('/test-notation-sort/en/page/?uri=http%3A%2F%2Fwww.skosmos.skos%2Ftest%2Fta0115') // go to "Eel" concept page |
| 75 | + } else { |
| 76 | + cy.visit('/test-notation-sort/en/page/?uri=http%3A%2F%2Fwww.skosmos.skos%2Ftest%2Fta0114') // go to "Buri" concept page |
| 77 | + // click on the link to "Eel" to trigger partial page load |
| 78 | + cy.get('#tab-hierarchy').contains('a', 'Eel').click() |
| 79 | + } |
| 80 | + |
| 81 | + // click the copy to clipboard button next to the URI |
| 82 | + cy.get('#copy-notation').click() |
| 83 | + |
| 84 | + // check that the clipboard now contains "33.2" |
| 85 | + // NOTE: This test may fail when running Cypress interactively in a browser. |
| 86 | + // The reason is browser security policies for accessing the clipboard. |
| 87 | + // If that happens, make sure the browser window has focus and re-run the test. |
| 88 | + cy.window().its('navigator.clipboard').invoke('readText').then((result) => {}).should('equal', '33.2'); |
| 89 | + }) |
| 90 | + it('contains mappings / ' + pageLoadType, () => { |
| 91 | + if (pageLoadType == "full") { |
| 92 | + cy.visit('/yso/en/page/p14174') // go to "labyrinths" concept page |
| 93 | + } else { |
| 94 | + cy.visit('/yso/en/page/p5714') // go to "prehistoric graves" concept page |
| 95 | + // click on the link to "labyrinths" to trigger partial page load |
| 96 | + cy.get('#tab-hierarchy').contains('a', 'labyrinths').click() |
| 97 | + } |
| 98 | + |
| 99 | + // check that we have some mappings |
| 100 | + cy.get('#concept-mappings').should('not.be.empty') |
| 101 | + // check that spinner does not exist after load |
| 102 | + cy.get('#concept-mappings i.fa-spinner', {'timeout': 15000}).should('not.exist') |
| 103 | + |
| 104 | + // check the first mapping property name |
| 105 | + // NOTE: we need to increase the timeout as the mappings can take a long time to load |
| 106 | + cy.get('.prop-mapping h2', {'timeout': 20000}).eq(0).contains('Closely matching concepts') |
| 107 | + // check the first mapping property values |
| 108 | + cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(0).contains('Labyrinths') |
| 109 | + cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(0).find('a').should('have.attr', 'href', 'http://id.loc.gov/authorities/subjects/sh85073793') |
| 110 | + cy.get('.prop-mapping').eq(0).find('.prop-mapping-vocab').eq(0).contains('Library of Congress Subject Headings') |
| 111 | + // check that the first mapping property has the right number of entries |
| 112 | + cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').should('have.length', 1) |
| 113 | + |
| 114 | + // check the second mapping property name |
| 115 | + cy.get('.prop-mapping h2').eq(1).contains('Exactly matching concepts') |
| 116 | + // check the second mapping property values |
| 117 | + cy.get('.prop-mapping').eq(1).find('.prop-mapping-label').eq(0).contains('labyrinter (sv)') |
| 118 | + cy.get('.prop-mapping').eq(1).find('.prop-mapping-label').eq(0).find('a').invoke('text').should('equal', 'labyrinter') |
| 119 | + cy.get('.prop-mapping').eq(1).find('.prop-mapping-label').eq(0).find('a').should('have.attr', 'href', 'http://www.yso.fi/onto/allars/Y21700') |
| 120 | + cy.get('.prop-mapping').eq(1).find('.prop-mapping-vocab').eq(0).contains('Allärs - General thesaurus in Swedish') |
| 121 | + // skipping the middle one (mapping to KOKO concept) as it's similar to the others |
| 122 | + cy.get('.prop-mapping').eq(1).find('.prop-mapping-label').eq(2).contains('labyrintit (fi)') |
| 123 | + cy.get('.prop-mapping').eq(1).find('.prop-mapping-label').eq(2).find('a').invoke('text').should('equal', 'labyrintit') |
| 124 | + cy.get('.prop-mapping').eq(1).find('.prop-mapping-label').eq(2).find('a').should('have.attr', 'href', 'http://www.yso.fi/onto/ysa/Y108389') |
| 125 | + cy.get('.prop-mapping').eq(1).find('.prop-mapping-vocab').eq(2).contains('YSA - Yleinen suomalainen asiasanasto') |
| 126 | + // check that the second mapping property has the right number of entries |
| 127 | + cy.get('.prop-mapping').eq(1).find('.prop-mapping-label').should('have.length', 3) |
| 128 | + }) |
| 129 | + |
| 130 | + }); |
| 131 | +}) |
0 commit comments