Skip to content

Commit

Permalink
ism-dp/transform: wait for page to render
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Ashiwal <[email protected]>
  • Loading branch information
r1walz committed Feb 16, 2024
1 parent 550c6e4 commit 0bc31f6
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ describe("Transforms", () => {
// Confirm we have our initial transform
cy.contains(TRANSFORM_ID);

// Intercept different transform requests endpoints to wait before clicking disable and enable buttons
cy.intercept(`/api/ism/transforms/${TRANSFORM_ID}`).as("getTransform");
cy.intercept(`/api/ism/transforms/${TRANSFORM_ID}/_stop`).as(
"stopTransform"
);


// Click into transform job details page
cy.get(`[data-test-subj="transformLink_${TRANSFORM_ID}"]`).click({
force: true,
Expand All @@ -235,24 +242,32 @@ describe("Transforms", () => {
* appear greyed out and unavailable. Cypress automatically retries,
* but only after menu is open, doesn't re-render.
*/
cy.wait(1000);
cy.wait("@getTransform").wait(2000);

// Click into Actions menu
cy.get(`[data-test-subj="actionButton"]`).click({ force: true });

// Click Disable button
cy.get(`[data-test-subj="disableButton"]`).click();
cy.get(`[data-test-subj="disableButton"]`)
.should("not.be.disabled")
.click();

cy.wait("@stopTransform");
cy.wait("@getTransform");

// Confirm we get toaster saying transform job is disabled
cy.contains(`"${TRANSFORM_ID}" is disabled`);

cy.wait(1000);
// Extra wait required for page data to load, otherwise "Enable" button will be disabled
cy.wait(2000);

// Click into Actions menu
cy.get(`[data-test-subj="actionButton"]`).click({ force: true });

// Click Enable button
cy.get(`[data-test-subj="enableButton"]`).click({ force: true });
cy.get(`[data-test-subj="enableButton"]`)
.should("not.be.disabled")
.click({ force: true });

// Confirm we get toaster saying transform job is enabled
cy.contains(`"${TRANSFORM_ID}" is enabled`);
Expand Down

0 comments on commit 0bc31f6

Please sign in to comment.