fix(minor): added UI test
This commit is contained in:
parent
65f5910dc3
commit
e790b5e8b1
2 changed files with 24 additions and 7 deletions
|
|
@ -34,6 +34,12 @@ context('Data Control', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('check custom formatters', () => {
|
||||||
|
cy.visit(`/app/doctype/User`);
|
||||||
|
cy.get('[data-fieldname="fields"] .grid-row[data-idx="2"] [data-fieldname="fieldtype"] .static-area').should('have.text', '🔵 Section Break');
|
||||||
|
});
|
||||||
|
|
||||||
it('Verifying data control by inputting different patterns for "Name" field', () => {
|
it('Verifying data control by inputting different patterns for "Name" field', () => {
|
||||||
cy.new_form('Test Data Control');
|
cy.new_form('Test Data Control');
|
||||||
|
|
||||||
|
|
@ -54,7 +60,7 @@ context('Data Control', () => {
|
||||||
|
|
||||||
//Checking if the border color of the field changes to red
|
//Checking if the border color of the field changes to red
|
||||||
cy.get('.frappe-control[data-fieldname="name1"]').should('have.class', 'has-error');
|
cy.get('.frappe-control[data-fieldname="name1"]').should('have.class', 'has-error');
|
||||||
cy.findByRole('button', {name: 'Save'}).click();
|
cy.save();
|
||||||
|
|
||||||
//Checking for the error message
|
//Checking for the error message
|
||||||
cy.get('.modal-title').should('have.text', 'Message');
|
cy.get('.modal-title').should('have.text', 'Message');
|
||||||
|
|
@ -64,7 +70,7 @@ context('Data Control', () => {
|
||||||
cy.get_field('name1', 'Data').clear({force: true});
|
cy.get_field('name1', 'Data').clear({force: true});
|
||||||
cy.fill_field('name1', 'Komal{}/!', 'Data');
|
cy.fill_field('name1', 'Komal{}/!', 'Data');
|
||||||
cy.get('.frappe-control[data-fieldname="name1"]').should('have.class', 'has-error');
|
cy.get('.frappe-control[data-fieldname="name1"]').should('have.class', 'has-error');
|
||||||
cy.findByRole('button', {name: 'Save'}).click();
|
cy.save();
|
||||||
cy.get('.modal-title').should('have.text', 'Message');
|
cy.get('.modal-title').should('have.text', 'Message');
|
||||||
cy.get('.msgprint').should('have.text', 'Komal{}/! is not a valid Name');
|
cy.get('.msgprint').should('have.text', 'Komal{}/! is not a valid Name');
|
||||||
cy.hide_dialog();
|
cy.hide_dialog();
|
||||||
|
|
@ -76,14 +82,14 @@ context('Data Control', () => {
|
||||||
cy.get_field('email', 'Data').clear({force: true});
|
cy.get_field('email', 'Data').clear({force: true});
|
||||||
cy.fill_field('email', 'komal', 'Data');
|
cy.fill_field('email', 'komal', 'Data');
|
||||||
cy.get('.frappe-control[data-fieldname="email"]').should('have.class', 'has-error');
|
cy.get('.frappe-control[data-fieldname="email"]').should('have.class', 'has-error');
|
||||||
cy.findByRole('button', {name: 'Save'}).click();
|
cy.save();
|
||||||
cy.get('.modal-title').should('have.text', 'Message');
|
cy.get('.modal-title').should('have.text', 'Message');
|
||||||
cy.get('.msgprint').should('have.text', 'komal is not a valid Email Address');
|
cy.get('.msgprint').should('have.text', 'komal is not a valid Email Address');
|
||||||
cy.hide_dialog();
|
cy.hide_dialog();
|
||||||
cy.get_field('email', 'Data').clear({force: true});
|
cy.get_field('email', 'Data').clear({force: true});
|
||||||
cy.fill_field('email', 'komal@test', 'Data');
|
cy.fill_field('email', 'komal@test', 'Data');
|
||||||
cy.get('.frappe-control[data-fieldname="email"]').should('have.class', 'has-error');
|
cy.get('.frappe-control[data-fieldname="email"]').should('have.class', 'has-error');
|
||||||
cy.findByRole('button', {name: 'Save'}).click();
|
cy.save();
|
||||||
cy.get('.modal-title').should('have.text', 'Message');
|
cy.get('.modal-title').should('have.text', 'Message');
|
||||||
cy.get('.msgprint').should('have.text', 'komal@test is not a valid Email Address');
|
cy.get('.msgprint').should('have.text', 'komal@test is not a valid Email Address');
|
||||||
cy.hide_dialog();
|
cy.hide_dialog();
|
||||||
|
|
@ -125,4 +131,4 @@ context('Data Control', () => {
|
||||||
cy.get('.actions-btn-group > .dropdown-menu [data-label="Delete"]').click();
|
cy.get('.actions-btn-group > .dropdown-menu [data-label="Delete"]').click();
|
||||||
cy.click_modal_primary_button('Yes');
|
cy.click_modal_primary_button('Yes');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ import "cypress-real-events/support";
|
||||||
//
|
//
|
||||||
// -- This is will overwrite an existing command --
|
// -- This is will overwrite an existing command --
|
||||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... });
|
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... });
|
||||||
|
|
||||||
Cypress.Commands.add('login', (email, password) => {
|
Cypress.Commands.add('login', (email, password) => {
|
||||||
if (!email) {
|
if (!email) {
|
||||||
email = 'Administrator';
|
email = 'Administrator';
|
||||||
|
|
@ -139,6 +140,10 @@ Cypress.Commands.add('create_records', doc => {
|
||||||
.then(r => r.message);
|
.then(r => r.message);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('open_doc', (doctype, name) => {
|
||||||
|
cy.visit(`/app/${doctype}/${name}`)
|
||||||
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('set_value', (doctype, name, obj) => {
|
Cypress.Commands.add('set_value', (doctype, name, obj) => {
|
||||||
return cy.call('frappe.client.set_value', {
|
return cy.call('frappe.client.set_value', {
|
||||||
doctype,
|
doctype,
|
||||||
|
|
@ -265,9 +270,15 @@ Cypress.Commands.add('get_open_dialog', () => {
|
||||||
return cy.get('.modal:visible').last();
|
return cy.get('.modal:visible').last();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('save', () => {
|
||||||
|
cy.intercept('/api').as('api');
|
||||||
|
cy.get(`button[data-label="Save"]:visible`).click({scrollBehavior: false, force:true});
|
||||||
|
cy.wait('@api');
|
||||||
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('hide_dialog', () => {
|
Cypress.Commands.add('hide_dialog', () => {
|
||||||
cy.wait(300);
|
cy.wait(400);
|
||||||
cy.get_open_dialog().find('.btn-modal-close').click();
|
cy.get_open_dialog().find('.btn-modal-close').click({force:true});
|
||||||
cy.get('.modal:visible').should('not.exist');
|
cy.get('.modal:visible').should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue