Skip to content

Commit

Permalink
Update cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
willemverbuyst committed Feb 10, 2024
1 parent c0742bb commit 7e86167
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 10 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
dist
.cache
.eslintcache
.parcel-cache
.parcel-cache
cypress/downloads
29 changes: 29 additions & 0 deletions cypress/e2e/tests/TC001.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,33 @@ describe("page bsn tool", () => {
it("has an input field for bsn numbers", () => {
cy.get("#bsn-number");
});

it("should not display copy button when there is no input", () => {
cy.get("#bsn-number__copy-button").should("not.be.visible");
});

it("should display copy button when a valid bsn has been generated", () => {
cy.get("#bsn-generator-btn").click();
cy.get("#bsn-number__copy-button").should("be.visible");
});

it("should display copy icon when copy button is visible", () => {
cy.get("#bsn-generator-btn").click();
cy.get("#bsn-number__copy-icon").should("have.class", "fa fa-copy");
});

it("should display checkmark icon when copy button has been clicked", () => {
cy.get("#bsn-number").type("999999023");
cy.get("#bsn-validator-btn").click();
cy.get("#bsn-number__copy-button").realClick();
cy.get("#bsn-number__copy-icon").should("have.class", "fa fa-check");
});

it("should hide copy button when input has changed", () => {
cy.get("#bsn-number").type("999999023");
cy.get("#bsn-validator-btn").click();
cy.get("#bsn-number__copy-button").should("exist");
cy.get("#bsn-number").type("555");
cy.get("#bsn-number__copy-button").should("not.be.visible");
});
});
2 changes: 2 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
// eslint-disable-next-line import/no-extraneous-dependencies
import "cypress-real-events";
14 changes: 7 additions & 7 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"allowJs": true,
"baseUrl": "../node_modules",
"types": ["cypress"],
"outDir": "lib"
},
"include": ["**/*.*"]
"compilerOptions": {
"allowJs": true,
"baseUrl": "../node_modules",
"outDir": "lib",
"types": ["cypress", "node", "cypress-real-events"],
},
"include": ["**/*.*"],
}
11 changes: 10 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"license": "ISC",
"dependencies": {
"bsn-js": "^1.0.4",
"cypress": "^13.6.4"
"cypress": "^13.6.4",
"cypress-real-events": "^1.11.0"
},
"devDependencies": {
"eslint": "^8.55.0",
Expand Down

0 comments on commit 7e86167

Please sign in to comment.