INNER CODE UNIT · TypeScript
visitPage
odigos-io/odigos · frontend/webapp/cypress/functions/index.ts:37
export const visitPage = (path: string, callback?: () => void) => {
cy.visit(path);
// Wait for the page to load.
// On rare occasions, the page might still be blank, and cypress would attempt to interact with it, triggering false errors...
cy.wait(1000).then(() => {
if (!!callback) callback();
});
};
// Click without an intervening `.should('exist')`, which settles the subject and
// disables Cypress query re-resolution — a common flake when overview rows re-render
// (SSE / GraphQL refetch) mid-click ("the page updated while this command was executing").
export const clickRetryable = (selector: string, contains?: string) => {
if (contains != null) {
cy.contains(selector, contains).click();
} else {
cy.get(selector).click();