mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-11-30 03:18:02 +08:00
63 lines
1.8 KiB
TypeScript
63 lines
1.8 KiB
TypeScript
// ***********************************************************
|
|
// This example support/e2e.ts is processed and
|
|
// loaded automatically before your test files.
|
|
//
|
|
// This is a great place to put global configuration and
|
|
// behavior that modifies Cypress.
|
|
//
|
|
// You can change the location of this file or turn off
|
|
// automatically serving support files with the
|
|
// 'supportFile' configuration option.
|
|
//
|
|
// You can read more here:
|
|
// https://on.cypress.io/configuration
|
|
// ***********************************************************
|
|
|
|
// Import commands.js using ES2015 syntax:
|
|
import 'cypress-file-upload';
|
|
import 'cypress-plugin-api';
|
|
import 'cypress-real-events';
|
|
import './commands';
|
|
|
|
// Global hooks for console logging
|
|
beforeEach(() => {
|
|
// Start capturing console logs for each test
|
|
cy.startConsoleCapture();
|
|
|
|
// Mock billing endpoints to prevent 502 errors in console
|
|
cy.intercept('GET', '**/billing/api/v1/active-subscription/**', {
|
|
statusCode: 200,
|
|
body: {
|
|
subscription: null,
|
|
status: 'free'
|
|
}
|
|
}).as('billingSubscription');
|
|
|
|
// Mock other billing endpoints
|
|
cy.intercept('GET', '**/billing/api/**', {
|
|
statusCode: 200,
|
|
body: {}
|
|
}).as('billingAPI');
|
|
});
|
|
|
|
afterEach(() => {
|
|
// Print console logs summary after each test
|
|
// This ensures logs are visible in CI output even if the test fails
|
|
cy.printConsoleLogsSummary();
|
|
|
|
// Stop capturing to clean up
|
|
cy.stopConsoleCapture();
|
|
});
|
|
|
|
// Globally ignore transient app bootstrap errors during tests
|
|
Cypress.on('uncaught:exception', (err) => {
|
|
if (
|
|
err.message.includes('No workspace or service found') ||
|
|
err.message.includes('Failed to fetch dynamically imported module') ||
|
|
/Record not found|unknown error/i.test(err.message) ||
|
|
err.message.includes('Reduce of empty array with no initial value')
|
|
) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}); |