feature: user, project, channel and job offer create test flows and project, channel and job offer edit test flows
This commit is contained in:
@ -23,3 +23,58 @@
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||
|
||||
/* globals Cypress, cy, expect */
|
||||
|
||||
Cypress.Commands.add('login', () => {
|
||||
cy.fixture('admin.json').then(admin => {
|
||||
cy.get('#id_username').type(admin.username);
|
||||
cy.get('#id_username').should('have.value', admin.username);
|
||||
cy.get('#id_password').type(admin.password);
|
||||
cy.get('#id_password').should('have.value', admin.password);
|
||||
cy.get('.connection-btn').click();
|
||||
cy.get('.accept-button').click();
|
||||
cy.location().should((loc) => {
|
||||
expect(loc.pathname).to.eq('/');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('naviagte', route => {
|
||||
cy.visit(route);
|
||||
cy.location().should((loc) => {
|
||||
expect(loc.pathname).to.eq(route);
|
||||
});
|
||||
// Workaround - seems to be a bug when accessing the route directly
|
||||
cy.get('.accept-button').click();
|
||||
cy.wait(2000);
|
||||
// End workaround
|
||||
});
|
||||
|
||||
Cypress.Commands.add('userLogin', () => {
|
||||
cy.visit('/');
|
||||
cy.location().should((loc) => {
|
||||
expect(loc.pathname).to.eq('/auth/login/');
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('encodeUrl', url => {
|
||||
const encodeIdReplacement = [
|
||||
['~', '~~'],
|
||||
['.', '~!'],
|
||||
[':', '~@'],
|
||||
['/', '~_'],
|
||||
];
|
||||
encodeIdReplacement.forEach(([char, repl]) => {
|
||||
url = url.split(char).join(repl);
|
||||
});
|
||||
return url;
|
||||
});
|
||||
|
||||
Cypress.Commands.add('randomNum', () => {
|
||||
return Math.floor(1000 + Math.random() * 9000);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('nextYear', increment => {
|
||||
return new Date().getFullYear() + ( increment || 1 );
|
||||
});
|
||||
|
@ -13,10 +13,12 @@
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
/* globals Cypress */
|
||||
|
||||
//require('cypress-terminal-report').installSupport();
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands';
|
||||
|
||||
require('cypress-terminal-report').installSupport();
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
@ -27,4 +29,9 @@ Cypress.on('uncaught:exception', (err, runnable) => {
|
||||
return false;
|
||||
});
|
||||
|
||||
Cypress.on('fail', () => Cypress.runner.abort())
|
||||
Cypress.on('fail', (error) => {
|
||||
console.log(error);
|
||||
if ( typeof Cypress.runner.abort == 'function' ) {
|
||||
Cypress.runner.abort();
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user