diff --git a/tests/cypress/template/sidebar-alpha.cy.js b/tests/cypress/template/sidebar-alpha.cy.js index 8a8ec80f6..f4f313743 100644 --- a/tests/cypress/template/sidebar-alpha.cy.js +++ b/tests/cypress/template/sidebar-alpha.cy.js @@ -8,6 +8,8 @@ describe('Alphabetical index', () => { cy.get('#tab-alphabetical').find('.pagination li').first().invoke('text').should('contain', 'A') // Check that alphabetical list exists and has the right concepts cy.get('#tab-alphabetical').find('.sidebar-list li').first().invoke('text').should('contain', 'abstract objects') + // Check that loading spinner does not exist + cy.get('#tab-alphabetical .sidebar-list i.fa-spinner').should('not.exist') }) it('Loads letters and concepts on tab open', () => { // Go to "properties" YSO concept page @@ -20,6 +22,8 @@ describe('Alphabetical index', () => { cy.get('#tab-alphabetical').find('.pagination li').first().invoke('text').should('contain', 'A') // Check that alphabetical list exists and has the right concepts cy.get('#tab-alphabetical').find('.sidebar-list li').first().invoke('text').should('contain', 'abstract objects') + // Check that loading spinner does not exist + cy.get('#tab-alphabetical .sidebar-list i.fa-spinner').should('not.exist') }) it('Loads concepts on letter change', () => { // Go to YSO vocab home page @@ -28,6 +32,20 @@ describe('Alphabetical index', () => { cy.get('#tab-alphabetical').find('.pagination li').eq(1).click() // Check that alphabetical list has the right concepts cy.get('#tab-alphabetical').find('.sidebar-list li').first().invoke('text').should('contain', 'birch bark manuscripts') + // Check that loading spinner does not exist + cy.get('#tab-alphabetical .sidebar-list i.fa-spinner').should('not.exist') + }) + it('Diacritic letters are clickable', () => { + // go to the YSO home page in Swedish language + cy.visit('/yso/sv/') + // click on the last letter (Ö) + cy.get('#tab-alphabetical .pagination :nth-last-child(1) > .page-link').click() + // check that we have the correct number of entries + cy.get('#tab-alphabetical .sidebar-list .list-group').children().should('have.length', 4) + // check that the first entry is "östliga handelsvägar" + cy.get('#tab-alphabetical .sidebar-list .list-group').children().first().children().first().invoke('text').should('equal', 'östliga handelsvägar') + // Check that loading spinner does not exist + cy.get('#tab-alphabetical .sidebar-list i.fa-spinner').should('not.exist') }) it('Concepts and letters in alphabetical index are displayed in the correct language', () => { // Go to YSO vocab page with UI language set to English and content language set to Finnish @@ -60,5 +78,45 @@ describe('Alphabetical index', () => { cy.get('#tab-alphabetical').find('.sidebar-list').scrollTo('bottom') // Check that new concepts have been loaded cy.get('#tab-alphabetical').find('.sidebar-list li').should('have.length.gt', 500, {'timeout': 20000}) + // Check that loading spinner does not exist + cy.get('#tab-alphabetical .sidebar-list i.fa-spinner').should('not.exist') + }) + it('clicking on alphabetical index entries performs partial page load', () => { + cy.visit('/yso/en/') // go to the YSO home page in English language + + // click on the the letter C + cy.get('#tab-alphabetical').contains('a', 'C').click() + + // click on the link "care institutions" (should trigger partial page load) + cy.get('#tab-alphabetical').contains('a', 'care institutions').click() + + // check the concept prefLabel + cy.get('#concept-heading h1', {'timeout': 15000}).invoke('text').should('equal', 'care institutions') + + // check that the SKOSMOS object matches the newly loaded concept + cy.window().then((win) => { + expect(win.SKOSMOS.uri).to.equal('http://www.yso.fi/onto/yso/p6034'); + expect(win.SKOSMOS.prefLabels[0]['label']).to.equal("care institutions"); + }) + + // check that we have some mappings + cy.get('#concept-mappings').should('not.be.empty') + // check that loading spinner does not exist + cy.get('#concept-mappings i.fa-spinner', {'timeout': 15000}).should('not.exist') + + // check the second mapping property name + cy.get('.prop-mapping h2', {'timeout': 20000}).eq(0).contains('Exactly matching concepts') + // check the second mapping property values + cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(0).contains('vårdinrättningar (sv)') + cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(0).find('a').invoke('text').should('equal', 'vårdinrättningar') + cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(0).find('a').should('have.attr', 'href', 'http://www.yso.fi/onto/allars/Y29009') + cy.get('.prop-mapping').eq(0).find('.prop-mapping-vocab').eq(0).contains('Allärs - General thesaurus in Swedish') + // skipping the middle one (mapping to KOKO concept) as it's similar to the others + cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(2).contains('hoitolaitokset (fi)') + cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(2).find('a').invoke('text').should('equal', 'hoitolaitokset') + cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(2).find('a').should('have.attr', 'href', 'http://www.yso.fi/onto/ysa/Y95404') + cy.get('.prop-mapping').eq(0).find('.prop-mapping-vocab').eq(2).contains('YSA - Yleinen suomalainen asiasanasto') + // check that the second mapping property has the right number of entries + cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').should('have.length', 3) }) }) diff --git a/tests/cypress/template/vocab-home.cy.js b/tests/cypress/template/vocab-home.cy.js index 2d9004ec1..ba58a4a6e 100644 --- a/tests/cypress/template/vocab-home.cy.js +++ b/tests/cypress/template/vocab-home.cy.js @@ -39,99 +39,6 @@ describe('Vocabulary home page', () => { // check that the vocabulary title is correct cy.get('#vocab-title > a').invoke('text').should('equal', 'Test ontology') }) - it('shows alphabetical index letters', () => { - cy.visit('/test/en') // go to the "Test ontology" home page - - const letters = cy.get('#tab-alphabetical .pagination').children() - - // check that we have the correct number of letters - letters.should('have.length', 8) - - // check that the first letter is B - letters.first().invoke('text').should('equal', 'B') - - // Check that loading spinner does not exist - cy.get('#tab-alphabetical .sidebar-list i.fa-spinner').should('not.exist') - }) - it('shows alphabetical index entries', () => { - cy.visit('/test/en') // go to the "Test ontology" home page - - const entries = cy.get('#tab-alphabetical .sidebar-list .list-group').children() - - // check that we have the correct number of entries - entries.should('have.length', 3) - - // check that the first entry is Bass - entries.first().invoke('text').should('equal', 'Bass') - - // Check that loading spinner does not exist - cy.get('#tab-alphabetical .sidebar-list i.fa-spinner').should('not.exist') - }) - it('alphabetical index letters are clickable', () => { - cy.visit('/test/en') // go to the "Test ontology" home page - - // click on the second letter (C) - cy.get('#tab-alphabetical .pagination :nth-child(2) > .page-link').click() - - // check that we have the correct number of entries - cy.get('#tab-alphabetical .sidebar-list .list-group').children().should('have.length', 2) - - // check that the first entry is Carp - cy.get('#tab-alphabetical .sidebar-list .list-group').children().first().invoke('text').should('equal', 'Carp') - - // Check that loading spinner does not exist - cy.get('#tab-alphabetical .sidebar-list i.fa-spinner').should('not.exist') - }) - it('alphabetical index diacritic letters are clickable', () => { - cy.visit('/yso/sv/') // go to the YSO home page in Swedish language - - // click on the last letter (Ö) - cy.get('#tab-alphabetical .pagination :nth-last-child(1) > .page-link').click() - - // check that we have the correct number of entries - cy.get('#tab-alphabetical .sidebar-list .list-group').children().should('have.length', 4) - - // check that the first entry is "östliga handelsvägar" - cy.get('#tab-alphabetical .sidebar-list .list-group').children().first().children().first().invoke('text').should('equal', 'östliga handelsvägar') - }) - it('clicking on alphabetical index entries performs partial page load', () => { - cy.visit('/yso/en/') // go to the YSO home page in English language - - // click on the the letter C - cy.get('#tab-alphabetical').contains('a', 'C').click() - - // click on the link "care institutions" (should trigger partial page load) - cy.get('#tab-alphabetical').contains('a', 'care institutions').click() - - // check the concept prefLabel - cy.get('#concept-heading h1', {'timeout': 15000}).invoke('text').should('equal', 'care institutions') - - // check that the SKOSMOS object matches the newly loaded concept - cy.window().then((win) => { - expect(win.SKOSMOS.uri).to.equal('http://www.yso.fi/onto/yso/p6034'); - expect(win.SKOSMOS.prefLabels[0]['label']).to.equal("care institutions"); - }) - - // check that we have some mappings - cy.get('#concept-mappings').should('not.be.empty') - // check that loading spinner does not exist - cy.get('#concept-mappings i.fa-spinner', {'timeout': 15000}).should('not.exist') - - // check the second mapping property name - cy.get('.prop-mapping h2', {'timeout': 20000}).eq(0).contains('Exactly matching concepts') - // check the second mapping property values - cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(0).contains('vårdinrättningar (sv)') - cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(0).find('a').invoke('text').should('equal', 'vårdinrättningar') - cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(0).find('a').should('have.attr', 'href', 'http://www.yso.fi/onto/allars/Y29009') - cy.get('.prop-mapping').eq(0).find('.prop-mapping-vocab').eq(0).contains('Allärs - General thesaurus in Swedish') - // skipping the middle one (mapping to KOKO concept) as it's similar to the others - cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(2).contains('hoitolaitokset (fi)') - cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(2).find('a').invoke('text').should('equal', 'hoitolaitokset') - cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').eq(2).find('a').should('have.attr', 'href', 'http://www.yso.fi/onto/ysa/Y95404') - cy.get('.prop-mapping').eq(0).find('.prop-mapping-vocab').eq(2).contains('YSA - Yleinen suomalainen asiasanasto') - // check that the second mapping property has the right number of entries - cy.get('.prop-mapping').eq(0).find('.prop-mapping-label').should('have.length', 3) - }) it('clicking on hierarchy entries performs partial page load', () => { cy.visit('/test/en') // go to the "Test ontology" home page