graphql-engine/console/cypress/helpers/common.ts
Daniele Cammareri 2120c601d3 console: remove new create remote schema add page feature flag
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5529
GitOrigin-RevId: cf487e53137cb884236bfa0a394a719506e11b1b
2022-08-23 07:36:56 +00:00

27 lines
809 B
TypeScript

import { getTestMode } from './core/testMode';
export const testMode = getTestMode();
export const baseUrl = Cypress.config('baseUrl');
export const migrateUrl = Cypress.env('MIGRATE_URL');
export const migrateModeUrl = `${migrateUrl}/settings`;
// sets value of window.prompt and reloads page
export const setPromptValue = (value: string | null) => {
cy.log(`Set window.prompt to "${value}"`).then(() => {
cy.removeAllListeners('window:before:load');
cy.on('window:before:load', win => {
cy.stub(win, 'prompt').returns(value);
});
});
cy.reload();
};
// This is works as setPromptValue with no unnecessary waiting
export const setPromptWithCb = (value: string | null, cb: () => void) => {
cy.window().then(win => {
cy.stub(win, 'prompt').returns(value);
cb();
});
};