mirror of
https://github.com/Unleash/unleash.git
synced 2025-04-24 01:18:01 +02:00
fix: frontend tests after Cypress upgrade (#9505)
The fix involved: 1. [Find the first button to click to create a feature flag](9b4500cded
) (there are 2) 2. [Find the button that's not disabled to remove access](fad627c6b3
) 3. [Don't wait for animations](5ce6ca59f5
) except in [this case](f4a7819ad1
)
This commit is contained in:
parent
ec5cc71ca1
commit
f718e00b39
@ -150,7 +150,10 @@ describe('project-access', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('can remove access', () => {
|
it('can remove access', () => {
|
||||||
cy.get(`[data-testid='${PA_REMOVE_BUTTON_ID}']`).first().click();
|
cy.get(`[data-testid='${PA_REMOVE_BUTTON_ID}']`)
|
||||||
|
.filter(':not(:disabled)')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
cy.intercept(
|
cy.intercept(
|
||||||
'DELETE',
|
'DELETE',
|
||||||
|
@ -60,7 +60,7 @@ export const createFeature_UI = (
|
|||||||
|
|
||||||
cy.wait(5_000);
|
cy.wait(5_000);
|
||||||
|
|
||||||
cy.get('[data-testid=NAVIGATE_TO_CREATE_FEATURE').click(uiOpts);
|
cy.get('[data-testid=NAVIGATE_TO_CREATE_FEATURE').first().click(uiOpts);
|
||||||
|
|
||||||
cy.intercept('POST', `/api/admin/projects/${projectName}/features`).as(
|
cy.intercept('POST', `/api/admin/projects/${projectName}/features`).as(
|
||||||
'createFeature',
|
'createFeature',
|
||||||
@ -72,10 +72,14 @@ export const createFeature_UI = (
|
|||||||
cy.get("[data-testid='FORM_DESCRIPTION_INPUT'] textarea")
|
cy.get("[data-testid='FORM_DESCRIPTION_INPUT'] textarea")
|
||||||
.first()
|
.first()
|
||||||
.type('hello-world', uiOpts);
|
.type('hello-world', uiOpts);
|
||||||
if (!shouldWait)
|
const clicked = cy
|
||||||
return cy.get("[data-testid='FORM_CREATE_BUTTON']").click(uiOpts);
|
.get("[data-testid='FORM_CREATE_BUTTON']")
|
||||||
else cy.get("[data-testid='FORM_CREATE_BUTTON']").click(uiOpts);
|
.first()
|
||||||
return cy.wait('@createFeature');
|
.click(uiOpts);
|
||||||
|
if (shouldWait) {
|
||||||
|
return cy.wait('@createFeature');
|
||||||
|
}
|
||||||
|
return clicked;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createProject_UI = (
|
export const createProject_UI = (
|
||||||
@ -161,7 +165,10 @@ export const addFlexibleRolloutStrategyToFeature_UI = (
|
|||||||
cy.get('[data-testid=ADD_CONSTRAINT_ID]').click();
|
cy.get('[data-testid=ADD_CONSTRAINT_ID]').click();
|
||||||
cy.get('[data-testid=DIALOGUE_CONFIRM_ID]').click();
|
cy.get('[data-testid=DIALOGUE_CONFIRM_ID]').click();
|
||||||
}
|
}
|
||||||
cy.get(`[data-testid=STRATEGY_FORM_SUBMIT_ID]`).first().click();
|
// this one needs to wait until the dropdown selector of stickiness is set, that's why waitForAnimations: true
|
||||||
|
cy.get(`[data-testid=STRATEGY_FORM_SUBMIT_ID]`)
|
||||||
|
.first()
|
||||||
|
.click({ waitForAnimations: true });
|
||||||
return cy.wait('@addStrategyToFeature');
|
return cy.wait('@addStrategyToFeature');
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -209,7 +216,10 @@ export const updateFlexibleRolloutStrategy_UI = (
|
|||||||
},
|
},
|
||||||
).as('updateStrategy');
|
).as('updateStrategy');
|
||||||
|
|
||||||
cy.get(`[data-testid=STRATEGY_FORM_SUBMIT_ID]`).first().click();
|
// this one needs to wait until the dropdown selector of stickiness is set, that's why waitForAnimations: true
|
||||||
|
cy.get(`[data-testid=STRATEGY_FORM_SUBMIT_ID]`)
|
||||||
|
.first()
|
||||||
|
.click({ waitForAnimations: true });
|
||||||
return cy.wait('@updateStrategy');
|
return cy.wait('@updateStrategy');
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -284,7 +294,10 @@ export const addUserIdStrategyToFeature_UI = (
|
|||||||
},
|
},
|
||||||
).as('addStrategyToFeature');
|
).as('addStrategyToFeature');
|
||||||
|
|
||||||
cy.get(`[data-testid=STRATEGY_FORM_SUBMIT_ID]`).first().click();
|
// this one needs to wait until the dropdown selector of stickiness is set, that's why waitForAnimations: true
|
||||||
|
cy.get(`[data-testid=STRATEGY_FORM_SUBMIT_ID]`)
|
||||||
|
.first()
|
||||||
|
.click({ waitForAnimations: true });
|
||||||
return cy.wait('@addStrategyToFeature');
|
return cy.wait('@addStrategyToFeature');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,3 +68,8 @@ Cypress.Commands.overwrite('visit', (originalFn, url, options = {}) => {
|
|||||||
|
|
||||||
return originalFn(url, options);
|
return originalFn(url, options);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Cypress.Commands.overwrite('click', (originalFn, x, y, options = {}) => {
|
||||||
|
options.waitForAnimations = false;
|
||||||
|
return originalFn(x, y, options);
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user