Compare commits
13 Commits
6b8470d6e1
...
6f324b44b8
Author | SHA1 | Date |
---|---|---|
Javier Segarra | 6f324b44b8 | |
Javier Segarra | 5a90434425 | |
Javier Segarra | d6aedad38e | |
Javier Segarra | deb6467af8 | |
Javier Segarra | 9da0488184 | |
Javier Segarra | 226f604f9d | |
Javier Segarra | e10ee5e6c7 | |
Javier Segarra | 1fb927488a | |
Javier Segarra | 68c9baa7f6 | |
Javier Segarra | b4ee19bcde | |
Javier Segarra | e6f8b87890 | |
Javier Segarra | 65100fcf25 | |
Javier Segarra | 5515f55bf6 |
|
@ -6,7 +6,11 @@ describe('Client list', () => {
|
|||
cy.visit('/#/customer/list', {
|
||||
timeout: 5000,
|
||||
onBeforeLoad(win) {
|
||||
cy.stub(win, 'open');
|
||||
cy.stub(win, 'open')
|
||||
.callsFake((url) => {
|
||||
return win.open.wrappedMethod.call(win, url, '_self');
|
||||
})
|
||||
.as('Open');
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -20,9 +24,9 @@ describe('Client list', () => {
|
|||
'Web user': { val: 'user_test_1' },
|
||||
Street: { val: 'C/ STREET 1' },
|
||||
Email: { val: 'user.test@1.com' },
|
||||
'Business type': { val: 'Otros', type: 'select' },
|
||||
'Sales person': { val: 'salesboss', type: 'select' },
|
||||
'Sales person': { val: 'employee', type: 'select' },
|
||||
Location: { val: '46000, Valencia(Province one), España', type: 'select' },
|
||||
'Business type': { val: 'Otros', type: 'select' },
|
||||
};
|
||||
cy.fillInForm(data);
|
||||
|
||||
|
@ -47,17 +51,19 @@ describe('Client list', () => {
|
|||
it('Client founded create ticket', () => {
|
||||
const search = 'Jessica Jones';
|
||||
cy.searchByLabel('Name', search);
|
||||
cy.clickButtonsDescriptor(2);
|
||||
cy.openActionDescriptor('Create ticket');
|
||||
cy.waitForElement('#formModel');
|
||||
cy.waitForElement('.q-form');
|
||||
cy.checkValueForm(1, search);
|
||||
cy.checkValueSelectForm(1, search);
|
||||
cy.checkValueSelectForm(2, search);
|
||||
});
|
||||
it('Client founded create order', () => {
|
||||
const search = 'Jessica Jones';
|
||||
cy.searchByLabel('Name', search);
|
||||
cy.clickButtonsDescriptor(4);
|
||||
cy.openActionDescriptor('New order');
|
||||
cy.waitForElement('#formModel');
|
||||
cy.waitForElement('.q-form');
|
||||
cy.checkValueForm(1, search);
|
||||
cy.checkValueForm(2, search);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,6 +7,9 @@ describe('VnLocation', () => {
|
|||
prefix: '.q-dialog__inner > .column > #formModel > .q-card',
|
||||
sufix: ' .q-field__inner > .q-field__control',
|
||||
};
|
||||
const countrySelector = `${createForm.prefix} > :nth-child(5) > :nth-child(3) > ${createForm.sufix}`;
|
||||
const provinceSelector = `${createForm.prefix} > :nth-child(5) > :nth-child(2) > ${createForm.sufix}`;
|
||||
const citySelector = `${createForm.prefix} > :nth-child(4) > :nth-child(2) > ${createForm.sufix}`;
|
||||
describe('CreateFormDialog ', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1280, 720);
|
||||
|
@ -16,46 +19,23 @@ describe('VnLocation', () => {
|
|||
cy.get(createLocationButton).click();
|
||||
});
|
||||
it('should filter provinces based on selected country', () => {
|
||||
// Select a country
|
||||
cy.selectOption(
|
||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
|
||||
'Ecuador'
|
||||
);
|
||||
// Verify that provinces are filtered
|
||||
cy.get(
|
||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`
|
||||
).should('have.length', 1);
|
||||
|
||||
// Verify that towns are filtered
|
||||
cy.get(
|
||||
`${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
|
||||
).should('have.length', 1);
|
||||
const country = 'Ecuador';
|
||||
cy.selectOption(countrySelector, country);
|
||||
cy.get(countrySelector).should('have.length', 1);
|
||||
cy.get(citySelector).should('have.length', 1);
|
||||
});
|
||||
|
||||
it('should filter towns based on selected province', () => {
|
||||
// Select a country
|
||||
cy.selectOption(
|
||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`,
|
||||
'Ecuador'
|
||||
);
|
||||
// Verify that provinces are filtered
|
||||
cy.get(
|
||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(3)> ${createForm.sufix}`
|
||||
).should('have.length', 1);
|
||||
|
||||
// Verify that towns are filtered
|
||||
cy.get(
|
||||
`${createForm.prefix} > :nth-child(4) > .q-field:nth-child(3)> ${createForm.sufix}`
|
||||
).should('have.length', 1);
|
||||
const country = 'Ecuador';
|
||||
cy.selectOption(countrySelector, country);
|
||||
cy.get(provinceSelector).should('have.length', 1);
|
||||
cy.get(citySelector).should('have.length', 1);
|
||||
});
|
||||
it('should pass selected country', () => {
|
||||
// Select a country
|
||||
const country = 'Ecuador';
|
||||
const province = 'Province five';
|
||||
cy.selectOption(
|
||||
`${createForm.prefix} > :nth-child(5) > .q-field:nth-child(5)> ${createForm.sufix}`,
|
||||
country
|
||||
);
|
||||
|
||||
cy.selectOption(countrySelector, country);
|
||||
cy.selectOption(
|
||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix}`,
|
||||
province
|
||||
|
@ -80,13 +60,11 @@ describe('VnLocation', () => {
|
|||
cy.get(locationOptions).should('have.length.at.least', 5);
|
||||
});
|
||||
it('input filter location as "al"', function () {
|
||||
// cy.get(inputLocation).click();
|
||||
cy.get(inputLocation).clear();
|
||||
cy.get(inputLocation).type('al');
|
||||
cy.get(locationOptions).should('have.length.at.least', 4);
|
||||
});
|
||||
it('input filter location as "ecuador"', function () {
|
||||
// cy.get(inputLocation).click();
|
||||
cy.get(inputLocation).clear();
|
||||
cy.get(inputLocation).type('ecuador');
|
||||
cy.get(locationOptions).should('have.length.at.least', 1);
|
||||
|
@ -142,7 +120,6 @@ describe('VnLocation', () => {
|
|||
const province = 'Saskatchew';
|
||||
cy.get(createLocationButton).click();
|
||||
cy.get(dialogInputs).eq(0).type(postCode);
|
||||
// city create button
|
||||
cy.get(
|
||||
`${createForm.prefix} > :nth-child(4) > .q-select > ${createForm.sufix} > :nth-child(2) > .q-icon`
|
||||
).click();
|
||||
|
@ -151,7 +128,6 @@ describe('VnLocation', () => {
|
|||
cy.get('#q-portal--dialog--3 .q-btn--standard').click();
|
||||
cy.get('#q-portal--dialog--1 .q-btn--standard').click();
|
||||
cy.waitForElement('.q-form');
|
||||
|
||||
checkVnLocation(postCode, province);
|
||||
});
|
||||
|
||||
|
|
|
@ -297,13 +297,13 @@ Cypress.Commands.add('checkNotification', (text) => {
|
|||
|
||||
Cypress.Commands.add('checkValueForm', (id, search) => {
|
||||
cy.get(
|
||||
`.grid-create > :nth-child(${id}) > .q-field__inner>.q-field__control> .q-field__control-container>.q-field__native >.q-field__input`
|
||||
`.grid-create > :nth-child(${id}) > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > .q-field__input`
|
||||
).should('have.value', search);
|
||||
});
|
||||
|
||||
Cypress.Commands.add('checkValueSelectForm', (id, search) => {
|
||||
cy.get(
|
||||
`.grid-create > :nth-child(${id}) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container>.q-field__native>.q-field__input`
|
||||
`.grid-create > :nth-child(${id}) > .q-field > .q-field__inner > .q-field__control > .q-field__control-container > .q-field__native > .q-field__input`
|
||||
).should('have.value', search);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue