-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MDS-5337] Setup Cypress for MineSpace (#2591)
* implement cypress e2e for minespace. * update test * update realm-export * update readme markdown files * update docker-compose.yaml file. * fix bug in workflow for minespace. * fix bug on build * add to documentation
- Loading branch information
1 parent
e622078
commit 7a39b24
Showing
17 changed files
with
256 additions
and
6 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
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
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
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
**/node_modules | ||
**/coverage | ||
**/cypress |
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 |
---|---|---|
|
@@ -17,3 +17,7 @@ | |
# Editor settings | ||
.vscode/* | ||
.vimrc | ||
|
||
# cypress | ||
/cypress/videos | ||
/cypress/screenshots |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineConfig } from "cypress"; | ||
|
||
export default defineConfig({ | ||
chromeWebSecurity: false, | ||
viewportWidth: 1960, | ||
viewportHeight: 1080, | ||
e2e: { | ||
// We've imported your old cypress plugins here. | ||
// You may want to clean this up later by importing these. | ||
setupNodeEvents(on, config) { | ||
return require("./cypress/plugins/index.js")(on, config); | ||
}, | ||
}, | ||
}); |
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 @@ | ||
describe("Mines Page", () => { | ||
const url = Cypress.env("CYPRESS_MINESPACE_WEB_TEST_URL"); | ||
beforeEach(() => { | ||
cy.login(); | ||
}); | ||
|
||
it("should navigate to the mines page successfully", () => { | ||
cy.visit(`${url}/mines`); | ||
// Assert that landing on the home page is successful | ||
cy.url({ timeout: 10000 }).should("include", "/mines"); | ||
}); | ||
}); |
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,25 @@ | ||
// / <reference types="cypress" /> | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
/** | ||
* @type {Cypress.PluginConfig} | ||
*/ | ||
// eslint-disable-next-line no-unused-vars | ||
const dotenv = require("dotenv"); | ||
dotenv.config(); | ||
|
||
module.exports = (on, config) => { | ||
config.env = process.env; | ||
return config; | ||
}; |
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,32 @@ | ||
Cypress.Commands.add("login", () => { | ||
const url = Cypress.env("CYPRESS_MINESPACE_WEB_TEST_URL"); | ||
const environmentUrl = `${url}/env`; | ||
const commonVariables = "bceid"; | ||
|
||
const response = { | ||
backend: Cypress.env("CYPRESS_BACKEND"), | ||
apiUrl: Cypress.env("CYPRESS_API_URL"), | ||
docManUrl: Cypress.env("CYPRESS_DOC_MAN_URL"), | ||
matomoUrl: Cypress.env("CYPRESS_MATOMO_URL"), | ||
filesystemProviderUrl: Cypress.env("CYPRESS_FILE_SYSTEM_PROVIDER_URL"), | ||
keycloak_clientId: Cypress.env("CYPRESS_KEYCLOAK_CLIENT_ID"), | ||
keycloak_resource: Cypress.env("CYPRESS_KEYCLOAK_RESOURCE"), | ||
keycloak_url: Cypress.env("CYPRESS_KEYCLOAK_URL"), | ||
keycloak_idir_idpHint: commonVariables, | ||
keycloak_bceid_idpHint: commonVariables, | ||
keycloak_vcauthn_idpHint: commonVariables, | ||
siteminder_url: Cypress.env("CYPRESS_KEYCLOAK_URL"), | ||
environment: Cypress.env("CYPRESS_ENVIRONMENT"), | ||
vcauthn_pres_req_conf_id: "minespace-access-0.1-dev", | ||
}; | ||
|
||
cy.intercept("GET", environmentUrl, (req) => { | ||
req.reply(response); | ||
}); | ||
|
||
cy.visit(url); | ||
cy.contains("Log in with BCeID").click(); | ||
cy.get("#username").type(Cypress.env("CYPRESS_TEST_USER")); | ||
cy.get("#password").type(Cypress.env("CYPRESS_TEST_PASSWORD")); | ||
cy.get("#kc-login").click(); | ||
}); |
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,29 @@ | ||
// *********************************************************** | ||
// This example support/index.js 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"; | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') | ||
|
||
// eslint-disable-next-line consistent-return | ||
Cypress.on("uncaught:exception", (err) => { | ||
if (err.message && /ResizeObserver loop limit exceeded/.test(err.message)) { | ||
// returning false here prevents Cypress from | ||
// failing the test | ||
return false; | ||
} | ||
}); |
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