forked from verdnatura/salix-front
test: better command if is date
This commit is contained in:
parent
9cc11f0a28
commit
f01e6d74f8
|
@ -14,7 +14,7 @@ describe('WorkerCreate', () => {
|
|||
Phone: { val: '123456789' },
|
||||
'Worker code': { val: 'DWW' },
|
||||
Boss: { val: developerBossId, type: 'select' },
|
||||
Birth: { val: '2022-12-11T23:00:00.000Z', type: 'date', day: 11 },
|
||||
Birth: { val: '11-12-2022', type: 'date' },
|
||||
};
|
||||
const external = {
|
||||
Fi: { val: 'Z4531219V' },
|
||||
|
|
|
@ -87,7 +87,6 @@ Cypress.Commands.add('selectOption', (selector, option) => {
|
|||
});
|
||||
|
||||
Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
|
||||
const days = '.q-date__calendar-days .q-date__calendar-item--in';
|
||||
cy.waitForElement('.q-form > .q-card');
|
||||
cy.get(`${form} input`).each(([el]) => {
|
||||
cy.wrap(el)
|
||||
|
@ -96,19 +95,14 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
|
|||
const field = obj[ariaLabel];
|
||||
if (!field) return;
|
||||
|
||||
const { type, val, day } = field;
|
||||
const { type, val } = field;
|
||||
switch (type) {
|
||||
case 'select':
|
||||
cy.wrap(el).type(val);
|
||||
cy.get('.q-menu .q-item').contains(val).click();
|
||||
break;
|
||||
case 'date':
|
||||
cy.get(
|
||||
'[label="Birth"] > .q-field > .q-field__inner > .q-field__control > .q-field__append > .q-icon'
|
||||
).click();
|
||||
cy.get(days)
|
||||
.eq(day ? day - 1 : 0)
|
||||
.click();
|
||||
cy.wrap(el).type(val.split('-').join(''));
|
||||
break;
|
||||
default:
|
||||
cy.wrap(el).type(val);
|
||||
|
|
Loading…
Reference in New Issue