From 14bca7e9e37ea59a24818fcc2bb25f8e1130a5b0 Mon Sep 17 00:00:00 2001 From: Yannick Date: Mon, 28 Apr 2025 09:36:16 +0200 Subject: [PATCH] add e2e testing --- testing/cypress/e2e/spec.cy.js | 14 +++++++++++++- testing/package-lock.json | 8 ++++---- testing/package.json | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/testing/cypress/e2e/spec.cy.js b/testing/cypress/e2e/spec.cy.js index 7ff3b8c..23f9b11 100644 --- a/testing/cypress/e2e/spec.cy.js +++ b/testing/cypress/e2e/spec.cy.js @@ -1,7 +1,19 @@ describe('template spec', () => { it('passes', () => { + cy.viewport(1920, 1080) cy.visit('https://www.berufsbildung-vs.ch/') - cy.get('.nav-link').contains('Berufslehre').click() + cy.get('#nav-21').find('a[href="https://www.berufsbildung-vs.ch/berufslehre"]').click() + cy.get('#listing_search_input_49').type('Informatik') + cy.get('input[type="submit"][name="submitter"]').click() + const informatikElement = cy.get('.listing-entry-inline').contains('Informatiker/in EFZ (EMVs)').parents('.listing-entry-inline') + informatikElement.invoke('css', 'background-color', 'yellow') + informatikElement.should('exist') + informatikElement.click() + // the element after

Übersicht 4-jährige Ausbildung

should contain an element with class="resource picture picture_content" + cy.get('h3:contains("Übersicht 4-jährige Ausbildung")').next().find('.resource.picture.picture_content').find('img').should('exist') + cy.contains('Voraussetzungen').should('exist') + cy.contains('Anmeldung').should('exist') + cy.contains('Schnuppertage').should('exist') }) }) \ No newline at end of file diff --git a/testing/package-lock.json b/testing/package-lock.json index e16f2e0..b454cbf 100644 --- a/testing/package-lock.json +++ b/testing/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "devDependencies": { - "cypress": "^14.3.0", + "cypress": "^14.3.2", "mocha": "^11.1.0" } }, @@ -901,9 +901,9 @@ } }, "node_modules/cypress": { - "version": "14.3.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-14.3.0.tgz", - "integrity": "sha512-rRfPl9Z0/CczuYybBEoLbDVuT1OGkhYaJ0+urRCshgiDRz6QnoA0KQIQnPx7MJ3zy+VCsbUU1pV74n+6cbJEdg==", + "version": "14.3.2", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-14.3.2.tgz", + "integrity": "sha512-n+yGD2ZFFKgy7I3YtVpZ7BcFYrrDMcKj713eOZdtxPttpBjCyw/R8dLlFSsJPouneGN7A/HOSRyPJ5+3/gKDoA==", "dev": true, "hasInstallScript": true, "license": "MIT", diff --git a/testing/package.json b/testing/package.json index 56fd0d3..a921839 100644 --- a/testing/package.json +++ b/testing/package.json @@ -10,7 +10,7 @@ "license": "ISC", "description": "", "devDependencies": { - "cypress": "^14.3.0", + "cypress": "^14.3.2", "mocha": "^11.1.0" } }