test: fix selectOption wait to ariaControl is visible
This commit is contained in:
parent
9306f88b99
commit
afb0e912d6
|
@ -6,9 +6,10 @@ describe('Client balance', () => {
|
||||||
cy.visit('#/customer/1101/balance');
|
cy.visit('#/customer/1101/balance');
|
||||||
});
|
});
|
||||||
it('Should create a mandate', () => {
|
it('Should create a mandate', () => {
|
||||||
|
cy.waitSpinner();
|
||||||
cy.get('.q-page-sticky > div > .q-btn').click();
|
cy.get('.q-page-sticky > div > .q-btn').click();
|
||||||
cy.selectOption('[data-cy="paymentBank"]', 2);
|
cy.selectOption('[data-cy="paymentBank"]', 2);
|
||||||
cy.dataCy('paymentAmount_input').type('100');
|
cy.dataCy('paymentAmount_input').clear().type('100');
|
||||||
cy.saveCard();
|
cy.saveCard();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -92,6 +92,14 @@ Cypress.Commands.add('getValue', (selector) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.add('waitSpinner', () => {
|
||||||
|
cy.get('body').then(($body) => {
|
||||||
|
if ($body.find('[data-cy="loading-spinner"]').length) {
|
||||||
|
cy.get('[data-cy="loading-spinner"]').should('not.be.visible');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// Fill Inputs
|
// Fill Inputs
|
||||||
Cypress.Commands.add('selectOption', (selector, option, timeout = 2500) => {
|
Cypress.Commands.add('selectOption', (selector, option, timeout = 2500) => {
|
||||||
cy.waitForElement(selector, timeout);
|
cy.waitForElement(selector, timeout);
|
||||||
|
@ -109,6 +117,7 @@ Cypress.Commands.add('selectOption', (selector, option, timeout = 2500) => {
|
||||||
|
|
||||||
function selectItem(selector, option, ariaControl, hasWrite = true) {
|
function selectItem(selector, option, ariaControl, hasWrite = true) {
|
||||||
if (!hasWrite) cy.wait(100);
|
if (!hasWrite) cy.wait(100);
|
||||||
|
cy.waitSpinner();
|
||||||
|
|
||||||
getItems(ariaControl).then((items) => {
|
getItems(ariaControl).then((items) => {
|
||||||
const matchingItem = items
|
const matchingItem = items
|
||||||
|
@ -128,6 +137,7 @@ function getItems(ariaControl, startTime = Cypress._.now(), timeout = 2500) {
|
||||||
.should('exist')
|
.should('exist')
|
||||||
.find('.q-item')
|
.find('.q-item')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
|
.should('be.visible')
|
||||||
.then(($items) => {
|
.then(($items) => {
|
||||||
if (!$items?.length || $items.first().text().trim() === '') {
|
if (!$items?.length || $items.first().text().trim() === '') {
|
||||||
if (Cypress._.now() - startTime > timeout) {
|
if (Cypress._.now() - startTime > timeout) {
|
||||||
|
|
Loading…
Reference in New Issue