-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement end-to-end testing with Cypress
- Loading branch information
1 parent
2d95f2a
commit 9fa2f44
Showing
10 changed files
with
793 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: End-to-end tests | ||
on: push | ||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Cypress run | ||
uses: cypress-io/github-action@v6 | ||
with: | ||
browser: chrome | ||
config: baseURL=https://${{ github.event.pull_request.number }}.development.scrumlr.fra.ics.inovex.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from "cypress"; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: 'http://localhost:3000' | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/// <reference types="cypress" /> | ||
/// <reference path="../support/index.d.ts" /> | ||
|
||
import { columnTemplates } from "../../src/routes/NewBoard/columnTemplates" | ||
import translationEn from "../../src/i18n/en/translation.json" | ||
|
||
describe("When clicking the CTA on the homepage", () => { | ||
it("it should navigate to the next page", () => { | ||
// go to homepage | ||
cy.visit("/") | ||
// switch to english | ||
cy.changeLanguageToEnglish() | ||
cy.acceptCookies() | ||
|
||
// click CTA | ||
cy.get("a").contains(translationEn.Homepage.startButton).click() | ||
|
||
// navigates to /login | ||
cy.url().should("include", "/login") | ||
cy.get("h1").contains(translationEn.LoginBoard.title) | ||
|
||
// terms and conditions checkbox | ||
cy.get("[type='checkbox']").should("not.be.checked") | ||
cy.get("[type='checkbox']").check() | ||
|
||
// click CTA | ||
cy.get("button").contains(translationEn.LoginBoard.login).click() | ||
|
||
// check templates | ||
cy.get("h1").contains(translationEn.NewBoard.basicConfigurationTitle) | ||
Object.values(columnTemplates).forEach(templateName => { | ||
cy.contains(templateName.name) | ||
}) | ||
|
||
cy.get("button") | ||
.contains(translationEn.NewBoard.createNewBoard) | ||
.parent() | ||
.should("be.disabled") | ||
|
||
// select template | ||
cy.get("input[type='radio']").siblings().contains("Lean Coffee").click() | ||
|
||
cy.get("button") | ||
.contains(translationEn.NewBoard.createNewBoard) | ||
.parent() | ||
.should("not.be.disabled") | ||
|
||
// click CTA | ||
cy.get("button") | ||
.contains(translationEn.NewBoard.createNewBoard) | ||
.click() | ||
|
||
// navigates to the board | ||
cy.url().should("include", "/board/") | ||
cy.get("h2").contains("Lean Coffee") | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// <reference types="cypress" /> | ||
/// <reference path="../support/index.d.ts" /> | ||
|
||
import translationEn from "../../src/i18n/en/translation.json" | ||
|
||
Cypress.Commands.add("acceptCookies", () => { | ||
cy.contains(translationEn.CookieNotice.accept).click() | ||
}); | ||
|
||
Cypress.Commands.add("changeLanguageToEnglish", () => { | ||
cy.get(`button[aria-label=${translationEn.Language.english}]`).click({ force: true }) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// *********************************************************** | ||
// This example support/e2e.ts is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/// <reference types="cypress" /> | ||
|
||
declare namespace Cypress { | ||
interface Chainable { | ||
/** | ||
* Custom command to accept the cookies so the cookie banner is dismissed. | ||
*/ | ||
acceptCookies(): Chainable<void> | ||
|
||
/** | ||
* Custom command to change the language to english. | ||
*/ | ||
changeLanguageToEnglish(): Chainable<void> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.