Skip to content

Commit 56f4073

Browse files
committed
t
1 parent 09e3455 commit 56f4073

File tree

8 files changed

+2089
-0
lines changed

8 files changed

+2089
-0
lines changed

testing/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/local.json
2+
cypress.env.json
3+
.env
4+
node_modules/

testing/cypress.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const { defineConfig } = require("cypress");
2+
3+
module.exports = defineConfig({
4+
chromeWebSecurity: false,
5+
defaultCommandTimeout: 10000,
6+
e2e: {
7+
baseUrl: 'https://dev.grad.gov.bc.ca',
8+
setupNodeEvents(on, config) {
9+
10+
},
11+
},
12+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
describe('Student Search', () => {
2+
context('with PEN', () => {
3+
it('login', () => {
4+
cy.login(['khyono', ''])
5+
6+
// cy.should('contain.text', 'PEN Search')
7+
})
8+
})
9+
})

testing/cypress/support/commands.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add('login', (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
26+
import { Routes } from "../../../frontend/src/utils/constants"
27+
import selectors from "./selectors"
28+
29+
function createLoginSession(username, password) {
30+
cy.session([username, password], () => {
31+
cy.visit(Routes.LOGIN)
32+
cy.get(selectors.login.idirLoginBtn).click()
33+
cy.get(selectors.login.user).type(Cypress.env('username'))
34+
cy.get(selectors.login.password).type(Cypress.env('password'))
35+
cy.get(selectors.login.idirSubmitBtn).click()
36+
cy.pause()
37+
cy.contains('PEN Search')
38+
})
39+
}
40+
41+
Cypress.Commands.add('login', createLoginSession)
42+
43+
Cypress.on('uncaught:exception', (err, runnable) => {
44+
return false
45+
})

testing/cypress/support/e2e.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// ***********************************************************
2+
// This example support/e2e.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'

testing/cypress/support/selectors.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
login : {
3+
username: '#username',
4+
user: '#user',
5+
password: '#password',
6+
loginBtn: '#kc-login',
7+
idirLoginBtn: '#social-idir',
8+
idirSubmitBtn: 'input[value=Continue]'
9+
}
10+
}

0 commit comments

Comments
 (0)