fix: refs #8484 update wagon type deletion selector and clean up unused code in commands.js
This commit is contained in:
parent
3d15455a50
commit
22dc45b91f
|
@ -12,8 +12,6 @@ describe('WagonTypeCreate', () => {
|
||||||
cy.get('button[type="submit"]').click();
|
cy.get('button[type="submit"]').click();
|
||||||
});
|
});
|
||||||
it('delete a wagon type', () => {
|
it('delete a wagon type', () => {
|
||||||
cy.get(
|
cy.get('.q-card').first().find('[title="Remove"] .q-icon').click();
|
||||||
'[to="/null/2"] > .q-card > .column > [title="Remove"] > .q-btn__content > .q-icon'
|
|
||||||
).click();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -100,34 +100,6 @@ Cypress.Commands.add('getValue', (selector) => {
|
||||||
|
|
||||||
// Fill Inputs
|
// Fill Inputs
|
||||||
Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
|
Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
|
||||||
// cy.waitForElement(selector, timeout);
|
|
||||||
// cy.get(selector).click();
|
|
||||||
// cy.get(selector).invoke('data', 'url').as('dataUrl');
|
|
||||||
// cy.get(selector)
|
|
||||||
// .clear()
|
|
||||||
// .type(option)
|
|
||||||
// .then(() => {
|
|
||||||
// cy.get('.q-menu', { timeout })
|
|
||||||
// .should('be.visible') // Asegurarse de que el menú está visible
|
|
||||||
// .and('exist') // Verificar que el menú existe
|
|
||||||
// .then(() => {
|
|
||||||
// cy.get('@dataUrl').then((url) => {
|
|
||||||
// if (url) {
|
|
||||||
// // Esperar a que el menú no esté visible (desaparezca)
|
|
||||||
// cy.get('.q-menu').should('not.be.visible');
|
|
||||||
// // Ahora esperar a que el menú vuelva a aparecer
|
|
||||||
// cy.get('.q-menu').should('be.visible').and('exist');
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // Finalmente, seleccionar la opción deseada
|
|
||||||
// cy.get('.q-menu:visible') // Asegurarse de que estamos dentro del menú visible
|
|
||||||
// .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
|
|
||||||
|
|
||||||
const retryAssertion = (selector, option, retries = 5) => {
|
const retryAssertion = (selector, option, retries = 5) => {
|
||||||
if (retries === 0) throw new Error('Assertion failed after retries');
|
if (retries === 0) throw new Error('Assertion failed after retries');
|
||||||
cy.waitForElement(selector).click().clear().type(option);
|
cy.waitForElement(selector).click().clear().type(option);
|
||||||
|
@ -136,7 +108,7 @@ Cypress.Commands.add('selectOption', (selector, option, timeout = 5000) => {
|
||||||
if ($el.css('visibility') !== 'visible') {
|
if ($el.css('visibility') !== 'visible') {
|
||||||
retryAssertion(selector, option, retries - 1);
|
retryAssertion(selector, option, retries - 1);
|
||||||
} else {
|
} else {
|
||||||
cy.get($el).should('be.visible').find('.q-item').contains(option).click();
|
cy.get($el).find('.q-item').contains(option).click();
|
||||||
cy.wait(200);
|
cy.wait(200);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -160,7 +132,6 @@ Cypress.Commands.add('fillInForm', (obj, form = '.q-form > .q-card') => {
|
||||||
if (!field) return;
|
if (!field) return;
|
||||||
|
|
||||||
const { type, val } = field;
|
const { type, val } = field;
|
||||||
cy.log("TIPO: ", field);
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'select':
|
case 'select':
|
||||||
cy.selectOption(el, val);
|
cy.selectOption(el, val);
|
||||||
|
|
Loading…
Reference in New Issue