Skip to content

Commit 53e3daf

Browse files
rollups/transform: wait for page to render (#993)
Signed-off-by: Rohit Ashiwal <[email protected]> (cherry picked from commit 0dcfd43) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 343913c commit 53e3daf

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

cypress/integration/plugins/index-management-dashboards-plugin/rollups_spec.js

+17-8
Original file line numberDiff line numberDiff line change
@@ -242,28 +242,37 @@ describe("Rollups", () => {
242242
// Confirm we have our initial rollup
243243
cy.contains(ROLLUP_ID);
244244

245+
// Intercept different rollups requests endpoints to wait before clicking disable and enable buttons
246+
cy.intercept(`/api/ism/rollups/${ROLLUP_ID}`).as("getRollup");
247+
cy.intercept(`/api/ism/rollups/${ROLLUP_ID}/_stop`).as("stopRollup");
248+
245249
// Click into rollup job details page
246250
cy.get(`[data-test-subj="rollupLink_${ROLLUP_ID}"]`).click({
247251
force: true,
248252
});
249253

250254
cy.contains(`${ROLLUP_ID}`);
251255

252-
// Disable button is enabled
253-
cy.get(`[data-test-subj="disableButton"]`).should("not.be.disabled");
256+
cy.wait("@getRollup").wait(2000);
254257

255258
// Click Disable button
256-
cy.get(`[data-test-subj="disableButton"]`).trigger("click", {
257-
force: true,
258-
});
259+
cy.get(`[data-test-subj="disableButton"]`)
260+
.should("not.be.disabled")
261+
.click({ force: true });
262+
263+
cy.wait("@stopRollup");
264+
cy.wait("@getRollup");
259265

260266
// Confirm we get toaster saying rollup job is disabled
261267
cy.contains(`${ROLLUP_ID} is disabled`);
262268

269+
// Extra wait required for page data to load, otherwise "Enable" button will be disabled
270+
cy.wait(2000);
271+
263272
// Click Enable button
264-
cy.get(`[data-test-subj="enableButton"]`).trigger("click", {
265-
force: true,
266-
});
273+
cy.get(`[data-test-subj="enableButton"]`)
274+
.should("not.be.disabled")
275+
.click({ force: true });
267276

268277
// Confirm we get toaster saying rollup job is enabled
269278
cy.contains(`${ROLLUP_ID} is enabled`);

cypress/integration/plugins/index-management-dashboards-plugin/transforms_spec.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ describe("Transforms", () => {
224224
// Confirm we have our initial transform
225225
cy.contains(TRANSFORM_ID);
226226

227+
// Intercept different transform requests endpoints to wait before clicking disable and enable buttons
228+
cy.intercept(`/api/ism/transforms/${TRANSFORM_ID}`).as("getTransform");
229+
cy.intercept(`/api/ism/transforms/${TRANSFORM_ID}/_stop`).as(
230+
"stopTransform"
231+
);
232+
233+
227234
// Click into transform job details page
228235
cy.get(`[data-test-subj="transformLink_${TRANSFORM_ID}"]`).click({
229236
force: true,
@@ -235,24 +242,32 @@ describe("Transforms", () => {
235242
* appear greyed out and unavailable. Cypress automatically retries,
236243
* but only after menu is open, doesn't re-render.
237244
*/
238-
cy.wait(1000);
245+
cy.wait("@getTransform").wait(2000);
239246

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

243250
// Click Disable button
244-
cy.get(`[data-test-subj="disableButton"]`).click();
251+
cy.get(`[data-test-subj="disableButton"]`)
252+
.should("not.be.disabled")
253+
.click();
254+
255+
cy.wait("@stopTransform");
256+
cy.wait("@getTransform");
245257

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

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

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

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

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

0 commit comments

Comments
 (0)