Skip to content

Commit dbd4278

Browse files
committed
cypress config
1 parent 1928f68 commit dbd4278

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed

.github/workflows/ddev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ jobs:
3535
- run: ddev start
3636

3737
# run cypress
38-
- run: ddev cypress-run --config .cypress.config.js
38+
- run: ddev cypress-run

cypress/support/commands.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const credentials = {
2+
Admin: {
3+
login: 'admin',
4+
password: 'veryl0ngpassw0rd',
5+
},
6+
NoAdmin: {
7+
login: 'user',
8+
password: 'password'
9+
}
10+
};
11+
12+
Cypress.Commands.add('adminLogInUser', (credential) => {
13+
cy.get('#username').type(credential.login);
14+
cy.get('#login').type(credential.password);
15+
cy.get('.form-button').click();
16+
})
17+
18+
Cypress.Commands.add('adminLogInValidUser', () => {
19+
cy.get('#username').type(credentials.Admin.login);
20+
cy.get('#login').type(credentials.Admin.password);
21+
cy.get('.form-button').click();
22+
})
23+
24+
Cypress.Commands.add('adminLogInInvalidUser', () => {
25+
cy.get('#username').type(credentials.NoAdmin.login);
26+
cy.get('#login').type(credentials.NoAdmin.password);
27+
cy.get('.form-button').click();
28+
})
29+
30+
Cypress.Commands.add('adminTestRoute', (route) => {
31+
cy.get(route.id).click({force: true});
32+
cy.url().should('include', route.url);
33+
cy.get('h3.icon-head').should('include.text', route.h3);
34+
cy.get(route.parent).should('have.class', 'active');
35+
})
36+
Cypress.Commands.add('adminTestRouteH3', (nav, route) => {
37+
cy.get(route.id).click({force: true});
38+
cy.get('h3.icon-head').should('include.text', route.h3);
39+
})
40+
41+
Cypress.Commands.add('adminTestRouteMainMenuActive', (nav, route) => {
42+
cy.get(route.id).click({force: true});
43+
cy.get(nav.main.id).should('have.class', 'active');
44+
})

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'

0 commit comments

Comments
 (0)