Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IA-5074] Improve IA integration test stability #5122

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions integration-tests/tests/run-analysis-azure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {
getAnimatedDrawer,
input,
noSpinnersAfter,
waitForNoModal,
waitForNoModalDrawer,
waitForNoSpinners,
} = require('../utils/integration-utils');
const { registerTest } = require('../utils/jest-utils');
Expand Down Expand Up @@ -51,7 +51,7 @@ const testRunAnalysisAzure = _.flowRight(
timeout: Millis.ofMinute,
});
await click(page, clickable({ textContains: 'Close' }), { timeout: Millis.ofMinute });
await waitForNoModal(page);
await waitForNoModalDrawer(page);

// Navigate to analysis launcher
await click(page, clickable({ textContains: `${notebookName}.ipynb` }));
Expand All @@ -63,7 +63,7 @@ const testRunAnalysisAzure = _.flowRight(
await click(page, clickable({ textContains: 'Open' }));
await findText(page, 'Azure Cloud Environment');
await click(page, clickable({ textContains: 'Create' }));
await waitForNoModal(page);
await waitForNoModalDrawer(page);

// Wait for env to begin creating
await findElement(page, clickable({ textContains: 'JupyterLab Environment' }));
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/tests/run-analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const {
getAnimatedDrawer,
input,
noSpinnersAfter,
waitForNoModal,
waitForNoModalDrawer,
waitForNoSpinners,
} = require('../utils/integration-utils');
const { registerTest } = require('../utils/jest-utils');
Expand Down Expand Up @@ -47,7 +47,7 @@ const testRunAnalysisFn = _.flowRight(
timeout: Millis.ofMinute,
});
await click(page, clickable({ textContains: 'Close' }), { timeout: Millis.ofMinute });
await waitForNoModal(page);
await waitForNoModalDrawer(page);

// Navigate to analysis launcher
await click(page, clickable({ textContains: `${notebookName}.ipynb` }));
Expand All @@ -61,7 +61,7 @@ const testRunAnalysisFn = _.flowRight(
});
await findText(page, 'Jupyter Cloud Environment');
await click(page, clickable({ text: 'Create' }));
await waitForNoModal(page);
await waitForNoModalDrawer(page);

// Wait for env to begin creating
await findElement(page, clickable({ textContains: 'Jupyter Environment' }), { timeout: Millis.ofSeconds(40) });
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/tests/run-rstudio.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const {
getAnimatedDrawer,
input,
noSpinnersAfter,
waitForNoModal,
waitForNoModalDrawer,
waitForNoSpinners,
} = require('../utils/integration-utils');
const { registerTest } = require('../utils/jest-utils');
Expand Down Expand Up @@ -50,7 +50,7 @@ const testRunRStudioFn = _.flowRight(
timeout: Millis.ofMinute,
});
await click(page, clickable({ textContains: 'Close' }), { timeout: Millis.ofMinute });
await waitForNoModal(page);
await waitForNoModalDrawer(page);

// Navigate to analysis launcher
await click(page, clickable({ textContains: `${rFileName}.Rmd` }));
Expand All @@ -63,7 +63,7 @@ const testRunRStudioFn = _.flowRight(
action: () => click(page, clickable({ textContains: 'Open' })),
});
await click(page, clickable({ text: 'Create' }));
await waitForNoModal(page);
await waitForNoModalDrawer(page);

// Wait for env to begin creating
await findElement(page, clickable({ textContains: 'RStudio Environment' }), { timeout: Millis.ofMinutes(2) });
Expand Down
7 changes: 7 additions & 0 deletions integration-tests/utils/integration-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ const waitForModal = (page, { timeout = 30000 } = {}) => {
return page.waitForSelector('.ReactModal__Overlay', { hidden: false, timeout });
};

const waitForNoModalDrawer = async (page) => {
await waitForNoModal(page);
// Matches the animation transition time
await delay(200);
};

// Puppeteer works by internally using MutationObserver. We are setting up the listener before
// the action to ensure that the spinner rendering is captured by the observer, followed by
// waiting for the spinner to be removed
Expand Down Expand Up @@ -631,6 +637,7 @@ module.exports = {
waitForNoModal,
waitForMenu,
waitForModal,
waitForNoModalDrawer,
waitForNoSpinners,
withPageLogging,
withScreenshot,
Expand Down
Loading