refactor: refs #6695 improve notification check and extend waitForElement timeout
gitea/salix-front/pipeline/pr-dev Something is wrong with the build of this commit
Details
gitea/salix-front/pipeline/pr-dev Something is wrong with the build of this commit
Details
This commit is contained in:
parent
9ac6db2c5d
commit
cd410fa7cf
|
@ -27,6 +27,29 @@
|
||||||
// DO NOT REMOVE
|
// DO NOT REMOVE
|
||||||
// Imports Quasar Cypress AE predefined commands
|
// Imports Quasar Cypress AE predefined commands
|
||||||
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
|
// import { registerCommands } from '@quasar/quasar-app-extension-testing-e2e-cypress';
|
||||||
|
|
||||||
|
// function getStatus() {
|
||||||
|
// const MAX_ATTEMPTS = 10;
|
||||||
|
// const DELAY = 1000;
|
||||||
|
// let attempts = 0;
|
||||||
|
// let connected;
|
||||||
|
|
||||||
|
// while (!connected && attempts < MAX_ATTEMPTS) {
|
||||||
|
// cy.log('connected: ', connected);
|
||||||
|
// cy.request({
|
||||||
|
// url: 'http://localhost:9000/api/Applications/status',
|
||||||
|
// failOnStatusCode: false,
|
||||||
|
// }).then((response) => {
|
||||||
|
// cy.log('response: ', response.body);
|
||||||
|
// cy.log('response.bodyasd ', response.body);
|
||||||
|
// if (response.body) connected = response.body;
|
||||||
|
// });
|
||||||
|
// cy.wait(DELAY);
|
||||||
|
// attempts++;
|
||||||
|
// }
|
||||||
|
// cy.log('❌ Backend not found');
|
||||||
|
// }
|
||||||
|
|
||||||
import waitUntil from './waitUntil';
|
import waitUntil from './waitUntil';
|
||||||
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
|
Cypress.Commands.add('waitUntil', { prevSubject: 'optional' }, waitUntil);
|
||||||
|
|
||||||
|
@ -34,7 +57,8 @@ Cypress.Commands.add('resetDB', () => {
|
||||||
cy.exec('pnpm run resetDatabase');
|
cy.exec('pnpm run resetDatabase');
|
||||||
});
|
});
|
||||||
Cypress.Commands.add('login', (user) => {
|
Cypress.Commands.add('login', (user) => {
|
||||||
//cy.visit('/#/login');
|
// getStatus();
|
||||||
|
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/api/accounts/login',
|
url: '/api/accounts/login',
|
||||||
|
@ -59,7 +83,7 @@ Cypress.Commands.add('login', (user) => {
|
||||||
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
|
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
|
||||||
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
|
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
|
||||||
});
|
});
|
||||||
Cypress.Commands.add('waitForElement', (element, timeout = 10000) => {
|
Cypress.Commands.add('waitForElement', (element, timeout = 30000) => {
|
||||||
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
|
cy.get(element, { timeout }).should('be.visible').and('not.be.disabled');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -327,12 +351,16 @@ Cypress.Commands.add('openUserPanel', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('checkNotification', (text) => {
|
Cypress.Commands.add('checkNotification', (text) => {
|
||||||
cy.get('.q-notification', { timeout: 10000 })
|
cy.get('.q-notification')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.filter((_, el) => Cypress.$(el).text().includes(text))
|
.should('have.length.greaterThan', 0)
|
||||||
.should('have.length.greaterThan', 0);
|
.should(($elements) => {
|
||||||
|
const found = $elements
|
||||||
|
.toArray()
|
||||||
|
.some((el) => Cypress.$(el).text().includes(text));
|
||||||
|
expect(found).to.be.true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('openActions', (row) => {
|
Cypress.Commands.add('openActions', (row) => {
|
||||||
cy.get('tbody > tr').eq(row).find('.actions > .q-btn').click();
|
cy.get('tbody > tr').eq(row).find('.actions > .q-btn').click();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue