refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
25
tests/cypress/support/commands.js
vendored
Normal file
25
tests/cypress/support/commands.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// ***********************************************
|
||||
// This example commands.js shows you how to
|
||||
// create various custom commands and overwrite
|
||||
// existing commands.
|
||||
//
|
||||
// For more comprehensive examples of custom
|
||||
// commands please read more here:
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
//
|
||||
//
|
||||
// -- This is a parent command --
|
||||
// Cypress.Commands.add("login", (email, password) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a child command --
|
||||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a dual command --
|
||||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||
24
tests/cypress/support/helpers/app.js
vendored
Normal file
24
tests/cypress/support/helpers/app.js
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
Cypress.Commands.add('login', () => {
|
||||
cy.exec('php artisan setup:frontendtestuser').then((result) => {
|
||||
cy.visit('/_dusk/login/'+result.stdout+'/');
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add('setPremium', (accountId) => {
|
||||
cy.exec('php artisan account:setpremium ' + accountId);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('register', (firstName, lastName, password, email, policy) => {
|
||||
cy.visit('/register');
|
||||
|
||||
cy.get('.alert').should('not.exist');
|
||||
cy.get('input[name=email]').type(email);
|
||||
cy.get('input[name=first_name]').type(firstName);
|
||||
cy.get('input[name=last_name]').type(lastName);
|
||||
cy.get('input[name=password]').type(password);
|
||||
cy.get('input[name=password_confirmation]').type(password);
|
||||
if (policy) {
|
||||
cy.get('input[name=policy]').click();
|
||||
}
|
||||
cy.get('button[type=submit]').click();
|
||||
});
|
||||
34
tests/cypress/support/helpers/contacts.js
vendored
Normal file
34
tests/cypress/support/helpers/contacts.js
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
Cypress.Commands.add('createContact', (firstname, lastname, gender, action = 'save') => {
|
||||
cy.visit('/people');
|
||||
cy.get('#button-add-contact').click();
|
||||
|
||||
cy.get('input[name=first_name]').type(firstname);
|
||||
cy.get('input[name=last_name]').type(lastname);
|
||||
cy.get('select[name=gender]').select(gender);
|
||||
|
||||
cy.get('button[name=' + action + ']').click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('createActivity', () => {
|
||||
cy.visit('/people');
|
||||
|
||||
// this gets the first content of the list
|
||||
cy.get('tr.clickable.people-list-item.bg-white.pointer').click();
|
||||
|
||||
cy.get('[cy-name=add-activity-button]').should('be.visible');
|
||||
cy.get('[cy-name=add-activity-button]').click();
|
||||
//cy.url().should('include', '/activities/add/h:');
|
||||
|
||||
cy.get('[name=summary]').type('This is a summary');
|
||||
cy.get('[cy-name=save-activity-button]').click();
|
||||
|
||||
cy.url().should('include', '/people/h:');
|
||||
cy.get('[cy-name=activities-blank-state]').should('not.be.visible');
|
||||
|
||||
cy.get('[cy-name=activities-body]').should('be.visible').then((activities) => {
|
||||
let item = activities[0].getAttribute('cy-items');
|
||||
|
||||
cy.get('[cy-name=activity-body-'+item+']').should('exist');
|
||||
cy.get('[cy-name=activity-body-'+item+']').should('contain', 'This is a summary');
|
||||
});
|
||||
});
|
||||
22
tests/cypress/support/index.js
vendored
Normal file
22
tests/cypress/support/index.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
// ***********************************************************
|
||||
// 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';
|
||||
import './helpers/app';
|
||||
import './helpers/contacts';
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
Reference in New Issue
Block a user