diff --git a/apps/builder/cypress/plugins/utils.ts b/apps/builder/cypress/plugins/utils.ts index 162919a7d..12bf7003b 100644 --- a/apps/builder/cypress/plugins/utils.ts +++ b/apps/builder/cypress/plugins/utils.ts @@ -72,3 +72,8 @@ export const parseTestTypebot = ({ updatedAt: new Date(), } } + +export const preventUserFromRefreshing = (e: BeforeUnloadEvent) => { + e.preventDefault() + e.returnValue = '' +} diff --git a/apps/builder/cypress/support/index.ts b/apps/builder/cypress/support/index.ts index f5a6458e7..9511e98ab 100644 --- a/apps/builder/cypress/support/index.ts +++ b/apps/builder/cypress/support/index.ts @@ -38,6 +38,12 @@ declare global { } } +Cypress.on('uncaught:exception', (err) => { + if (err.message.includes('ResizeObserver loop limit exceeded')) { + return false + } +}) + // Import commands.js using ES2015 syntax: import '@testing-library/cypress/add-commands' import 'cypress-file-upload' diff --git a/apps/builder/cypress/tests/board.ts b/apps/builder/cypress/tests/board.ts deleted file mode 100644 index b7fe22bdf..000000000 --- a/apps/builder/cypress/tests/board.ts +++ /dev/null @@ -1,12 +0,0 @@ -describe('BoardPage', () => { - beforeEach(() => { - cy.task('seed') - cy.signOut() - }) - - it('steps should be droppable', () => { - cy.signIn('test2@gmail.com') - cy.visit('/typebots/typebot1/edit') - // Can't find an easy way to implement this - }) -}) diff --git a/apps/builder/cypress/tests/bubbles.ts b/apps/builder/cypress/tests/bubbles.ts index 490e9e34b..88f9dcbc4 100644 --- a/apps/builder/cypress/tests/bubbles.ts +++ b/apps/builder/cypress/tests/bubbles.ts @@ -1,4 +1,7 @@ -import { parseTestTypebot } from 'cypress/plugins/utils' +import { + parseTestTypebot, + preventUserFromRefreshing, +} from 'cypress/plugins/utils' import { BubbleStepType } from 'models' describe('Text bubbles', () => { @@ -37,6 +40,12 @@ describe('Text bubbles', () => { cy.signOut() }) + afterEach(() => { + cy.window().then((win) => { + win.removeEventListener('beforeunload', preventUserFromRefreshing) + }) + }) + it('rich text features should work', () => { cy.signIn('test2@gmail.com') cy.visit('/typebots/typebot3/edit') diff --git a/apps/builder/cypress/tests/inputs.ts b/apps/builder/cypress/tests/inputs.ts index e8de99452..6477dff60 100644 --- a/apps/builder/cypress/tests/inputs.ts +++ b/apps/builder/cypress/tests/inputs.ts @@ -1,4 +1,7 @@ -import { parseTestTypebot } from 'cypress/plugins/utils' +import { + parseTestTypebot, + preventUserFromRefreshing, +} from 'cypress/plugins/utils' import { InputStep, InputStepType } from 'models' describe('Text input', () => { @@ -8,6 +11,12 @@ describe('Text input', () => { cy.signOut() }) + afterEach(() => { + cy.window().then((win) => { + win.removeEventListener('beforeunload', preventUserFromRefreshing) + }) + }) + it('options should work', () => { cy.signIn('test2@gmail.com') cy.visit('/typebots/typebot3/edit') @@ -71,7 +80,7 @@ describe('Email input', () => { cy.signOut() }) - it.only('options should work', () => { + it('options should work', () => { cy.signIn('test2@gmail.com') cy.visit('/typebots/typebot3/edit') cy.findByRole('button', { name: 'Preview' }).click()