From f4ee68775b36ff5af7b567de930cdc73f17ca7e5 Mon Sep 17 00:00:00 2001 From: Mika Vaara Date: Wed, 15 Nov 2023 17:36:52 +0200 Subject: [PATCH] E2E test that navigates to the Finnish homepage, changes the UI language to English, selects 'yso' from the vocabulary list, changes the content language to Finnish within 'yso', performs a search, lands on the search results page, selects a concept from the results and finally lands on the concept page --- .../e2e/fp-lang-yso-clang-result-vocab.cy.js | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/cypress/e2e/fp-lang-yso-clang-result-vocab.cy.js diff --git a/tests/cypress/e2e/fp-lang-yso-clang-result-vocab.cy.js b/tests/cypress/e2e/fp-lang-yso-clang-result-vocab.cy.js new file mode 100644 index 000000000..3f1e31ea3 --- /dev/null +++ b/tests/cypress/e2e/fp-lang-yso-clang-result-vocab.cy.js @@ -0,0 +1,44 @@ +describe('Front page -> lang -> vocab -> cLang -> search -> concept page', () => { + beforeEach(() => { + cy.visit('/fi'); + cy.wait(3000); + }); + + it('should change UI language to English and navigate to YSO concept page', () => { + // Change the UI language to English from the top bar + cy.visit('/en'); + + // Select "YSO - Yleinen suomalainen ontologia (arkeologia)" from the vocabulary list + // Go to the vocab page + cy.contains('.list-group-item a', 'YSO - Yleinen suomalainen ontologia (arkeologia)') + .click(); + + // Confirm that we are on the correct page (yso) + cy.url().should('include', '/yso/en/'); + }); + + it('should perform a search fuction and go to the search result page', () => { + // This following be replaced with actual implementation once available + cy.visit('/yso/fi/search?query=tiede'); + + // Potentially wait for a long time (10-20 seconds) + cy.wait(10000); + }); + + it('should select the text "tiede" from the search results and navigate to the concept page', () => { + cy.visit('/yso/fi/search?query=tiede'); + // Potentially wait for a long time again (10-20 seconds) + cy.wait(10000); + + // Select the text 'tiede' from the list and go to the page the link is directing + cy.get('.search-result-term a.prefLabel').contains('tiede') + .click(); + + // Confirm that we are on the correct page + cy.url().should('include', '/yso/fi/page/p2240'); + + // The page should contains the text "tiede" + cy.get('#pref-label').should('have.text', 'tiede'); + }); +}); +