test: refs #8484 await main content loaded #1318

Merged
alexm merged 54 commits from 8484-waitToDomContentLoadedInTests into dev 2025-02-27 06:19:45 +00:00
Member
No description provided.
jtubau added 1 commit 2025-01-31 11:41:56 +00:00
jtubau added 1 commit 2025-02-03 08:32:33 +00:00
jtubau added 1 commit 2025-02-03 09:20:28 +00:00
jtubau added 1 commit 2025-02-03 12:41:28 +00:00
jtubau changed title from refactor: refs #8484 improve search input behavior and enhance visit command with DOM content load to WIP: refactor: refs #8484 improve search input behavior and enhance visit command with DOM content load 2025-02-03 12:53:17 +00:00
jtubau added 1 commit 2025-02-03 13:44:53 +00:00
jtubau added 2 commits 2025-02-04 13:00:55 +00:00
jtubau added 1 commit 2025-02-04 13:07:34 +00:00
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
e31361fc9b
Merge branch 'dev' of into 8484-waitToDomContentLoadedInTests
jtubau added 1 commit 2025-02-04 13:46:06 +00:00
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
b63be407d4
test: refs #8484 enhance claimNotes test to ensure note visibility after saving
jtubau added 1 commit 2025-02-04 14:05:22 +00:00
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
8f8556a8c3
fix: refs #8484 update selector for buyLabel button in myEntry test
jtubau added 1 commit 2025-02-05 06:09:11 +00:00
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
3d15455a50
fix: refs #8484 remove unused addressId from createForm in CustomerDescriptor.vue
jtubau added 7 commits 2025-02-05 11:36:03 +00:00
jtubau added 1 commit 2025-02-05 11:37:04 +00:00
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
e2f641681e
refactor: refs #8484 remove comment in wagonCreate.spec.js
jtubau added 1 commit 2025-02-05 11:54:10 +00:00
gitea/salix-front/pipeline/pr-dev This commit looks good Details
310159d300
Merge branch 'dev' into 8484-waitToDomContentLoadedInTests
jtubau requested review from alexm 2025-02-05 12:49:33 +00:00
jtubau requested review from jsegarra 2025-02-05 12:49:33 +00:00
Member

@jtubau Cuantos tests fallan?

@jtubau Cuantos tests fallan?
alexm requested changes 2025-02-13 07:17:47 +00:00
Dismissed
@ -23,3 +23,3 @@
});
it('should active a notification that is yours', () => {
it.skip('should active a notification that is yours', () => {
Member

skip?

skip?
jorgep marked this conversation as resolved
@ -88,33 +100,25 @@ Cypress.Commands.add('getValue', (selector) => {
// Fill Inputs
Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
Member

Prueba con esto:

Cypress.Commands.add('selectOption', (selector, option, timeout = 2500) => {
    cy.waitForElement(selector, timeout);

    cy.get(selector, { timeout })
        .should('exist')
        .should('be.visible')
        .click()
        .then(($el) => {
            cy.wrap($el.is('input') ? $el : $el.find('input'))
                .invoke('attr', 'aria-controls')
                .then((ariaControl) => selectItem(selector, option, ariaControl));
        });
});

function selectItem(selector, option, ariaControl, hasWrite = true) {
    if (!hasWrite) cy.wait(100);

    getItems(ariaControl).then((items) => {
        const matchingItem = items
            .toArray()
            .find((item) => item.innerText.includes(option));
        if (matchingItem) return cy.wrap(matchingItem).click();

        if (hasWrite) cy.get(selector).clear().type(option, { delay: 0 });
        return selectItem(selector, option, ariaControl, false);
    });
}

function getItems(ariaControl, startTime = Cypress._.now(), timeout = 2500) {
    // Se intenta obtener la lista de opciones del desplegable de manera recursiva
    return cy
        .get('#' + ariaControl, { timeout })
        .should('exist')
        .find('.q-item')
        .should('exist')
        .then(($items) => {
            if (!$items?.length || $items.first().text().trim() === '') {
                if (Cypress._.now() - startTime > timeout) {
                    throw new Error(
                        `getItems: Tiempo de espera (${timeout}ms) excedido.`,
                    );
                }
                return getItems(ariaControl, startTime, timeout);
            }

            return cy.wrap($items);
        });
}

Prueba con esto: ``` Cypress.Commands.add('selectOption', (selector, option, timeout = 2500) => { cy.waitForElement(selector, timeout); cy.get(selector, { timeout }) .should('exist') .should('be.visible') .click() .then(($el) => { cy.wrap($el.is('input') ? $el : $el.find('input')) .invoke('attr', 'aria-controls') .then((ariaControl) => selectItem(selector, option, ariaControl)); }); }); function selectItem(selector, option, ariaControl, hasWrite = true) { if (!hasWrite) cy.wait(100); getItems(ariaControl).then((items) => { const matchingItem = items .toArray() .find((item) => item.innerText.includes(option)); if (matchingItem) return cy.wrap(matchingItem).click(); if (hasWrite) cy.get(selector).clear().type(option, { delay: 0 }); return selectItem(selector, option, ariaControl, false); }); } function getItems(ariaControl, startTime = Cypress._.now(), timeout = 2500) { // Se intenta obtener la lista de opciones del desplegable de manera recursiva return cy .get('#' + ariaControl, { timeout }) .should('exist') .find('.q-item') .should('exist') .then(($items) => { if (!$items?.length || $items.first().text().trim() === '') { if (Cypress._.now() - startTime > timeout) { throw new Error( `getItems: Tiempo de espera (${timeout}ms) excedido.`, ); } return getItems(ariaControl, startTime, timeout); } return cy.wrap($items); }); } ```
jorgep marked this conversation as resolved
@ -115,3 +119,1 @@
.find('.q-item') // Encontrar los elementos de las opciones
.contains(option) // Verificar que existe una opción que contenga el texto deseado
.click(); // Hacer clic en la opción
Cypress.Commands.add('selectWorkerOption', (selector, option) => {
Member

Para esto usar el selectOPtion

Para esto usar el selectOPtion
alexm requested changes 2025-02-13 07:24:50 +00:00
Dismissed
@ -57,2 +60,2 @@
Cypress.Commands.add('domContentLoad', (element, timeout = 5000) => {
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
Cypress.Commands.add('domContentLoad', (timeout = 5000) => {
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'), {
Member

No acabo de ver el codigo de waitUntil. Se espera x segundos, comprueba algo y sino vuelve a esperar x segundos.

Debe haber algo que te permita saber cuando ha cargado

No acabo de ver el codigo de waitUntil. Se espera x segundos, comprueba algo y sino vuelve a esperar x segundos. Debe haber algo que te permita saber cuando ha cargado
jorgep marked this conversation as resolved
jorgep added 1 commit 2025-02-14 16:52:54 +00:00
jorgep added 1 commit 2025-02-14 17:04:07 +00:00
jgallego dismissed alexm’s review 2025-02-14 17:30:07 +00:00
jgallego dismissed alexm’s review 2025-02-14 17:30:23 +00:00
jgallego dismissed alexm’s review 2025-02-14 17:30:24 +00:00
jgallego removed review request for jsegarra 2025-02-14 17:30:38 +00:00
jorgep added 1 commit 2025-02-17 09:51:21 +00:00
jorgep added 1 commit 2025-02-17 10:27:36 +00:00
jorgep added 1 commit 2025-02-17 14:00:52 +00:00
jorgep added 1 commit 2025-02-17 14:06:13 +00:00
gitea/salix-front/pipeline/pr-dev This commit looks good Details
29750bfd4f
feat: refs #8484 add addressId to createForm in CustomerDescriptor
jorgep added 1 commit 2025-02-17 14:09:54 +00:00
gitea/salix-front/pipeline/pr-dev This commit looks good Details
6be01d48fd
test: refs #8484 skip item creation test due to ongoing issue #8421
jorgep added 1 commit 2025-02-17 14:19:40 +00:00
gitea/salix-front/pipeline/pr-dev This commit looks good Details
cde262d640
test: refs #8484 rollback
jorgep added 1 commit 2025-02-17 14:21:29 +00:00
gitea/salix-front/pipeline/pr-dev This commit looks good Details
663e0c8e8e
test: refs #8484 rollback
jorgep added 1 commit 2025-02-17 14:22:16 +00:00
gitea/salix-front/pipeline/pr-dev This commit looks good Details
05df3e3f10
test: refs #8484 rollback
jorgep added 1 commit 2025-02-17 14:26:43 +00:00
gitea/salix-front/pipeline/pr-dev This commit looks good Details
02e94e6df5
test: refs #8484 rollback
jorgep added 1 commit 2025-02-17 14:42:44 +00:00
gitea/salix-front/pipeline/pr-dev This commit looks good Details
d2aad80536
refactor: refs #8484 remove redundant visit command overwrite
jorgep added 2 commits 2025-02-17 14:46:17 +00:00
jorgep added 2 commits 2025-02-17 16:50:32 +00:00
jorgep added 1 commit 2025-02-18 10:40:46 +00:00
jorgep added 1 commit 2025-02-18 11:33:39 +00:00
jorgep added 1 commit 2025-02-25 17:26:55 +00:00
jorgep added 1 commit 2025-02-25 17:38:59 +00:00
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
4e7f5b0fd7
refactor: refs #8484 streamline assertions in ClaimNotes test
jorgep added 1 commit 2025-02-26 09:08:55 +00:00
jorgep added 1 commit 2025-02-26 09:40:29 +00:00
jorgep added 1 commit 2025-02-26 11:38:02 +00:00
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
05fe2b5b21
refactor: refs #8484 streamline login command and remove commented code
jorgep added 1 commit 2025-02-26 12:08:52 +00:00
jorgep added 1 commit 2025-02-26 12:18:30 +00:00
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
bc2b5976d9
refactor: refs #8484 remove unnecessary intercepts and waits in ticket and zone tests
jorgep added 1 commit 2025-02-26 12:30:45 +00:00
jorgep added 1 commit 2025-02-26 12:38:08 +00:00
jorgep added 1 commit 2025-02-26 12:40:36 +00:00
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
8a8233b82f
fix: refs #8484 rollback
jorgep added 1 commit 2025-02-26 15:06:40 +00:00
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details
63ef21d78e
refactor: refs #8484 add data-cy attribute for claim photo image and update test to use it
jorgep added 1 commit 2025-02-26 15:07:43 +00:00
gitea/salix-front/pipeline/pr-dev Build queued... Details
f4b8d07e6a
test: refs #8484 replace path
jorgep added 1 commit 2025-02-26 15:11:30 +00:00
jorgep added 1 commit 2025-02-26 15:27:30 +00:00
jorgep added 1 commit 2025-02-26 15:29:27 +00:00
jorgep reviewed 2025-02-26 15:30:08 +00:00
@ -30,8 +30,6 @@ describe('Ticket descriptor', () => {
it('should set the weight of the ticket', () => {
cy.visit('/#/ticket/10/summary');
cy.intercept('GET', /\/api\/Tickets\/\d/).as('ticket');
Member

Ya no hace falta.

Ya no hace falta.
jorgep reviewed 2025-02-26 15:30:20 +00:00
@ -9,13 +9,7 @@ describe('ZoneBasicData', () => {
});
it('should throw an error if the name is empty', () => {
cy.intercept('GET', /\/api\/Zones\/4./).as('zone');
Member

Ya no hace falta.

Ya no hace falta.
jorgep added 1 commit 2025-02-26 15:36:26 +00:00
gitea/salix-front/pipeline/pr-dev This commit looks good Details
c56c415a5a
fix: refs #8484 rollback
jorgep changed title from WIP: refactor: refs #8484 improve search input behavior and enhance visit command with DOM content load to refactor: refs #8484 improve search input behavior and enhance visit command with DOM content load 2025-02-26 15:42:37 +00:00
jorgep reviewed 2025-02-26 15:49:59 +00:00
@ -60,1 +60,4 @@
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
originalFn(url, options);
cy.waitUntil(() => cy.document().then((doc) => doc.readyState === 'complete'));
cy.waitUntil(() => cy.get('main').should('exist'));
Member

Se asegura que el contenido este visible antes de hacer nada.

Se asegura que el contenido este visible antes de hacer nada.
jorgep changed title from refactor: refs #8484 improve search input behavior and enhance visit command with DOM content load to refactor: refs #8484 await main content loaded 2025-02-26 15:50:56 +00:00
jorgep changed title from refactor: refs #8484 await main content loaded to test: refs #8484 await main content loaded 2025-02-26 15:51:08 +00:00
alexm approved these changes 2025-02-27 06:19:18 +00:00
alexm merged commit bb5ae07fb0 into dev 2025-02-27 06:19:45 +00:00
alexm deleted branch 8484-waitToDomContentLoadedInTests 2025-02-27 06:19:45 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: verdnatura/salix-front#1318
No description provided.