mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-11-29 19:08:33 +08:00
chore: fix test
This commit is contained in:
@@ -40,12 +40,46 @@ describe('Single Select Column Type', () => {
|
||||
authUtils.signInWithTestUrl(testEmail).then(() => {
|
||||
cy.log('[STEP 3] Authentication successful');
|
||||
cy.url({ timeout: 30000 }).should('include', '/app');
|
||||
cy.wait(3000);
|
||||
cy.wait(5000); // Increased wait for CI environment
|
||||
|
||||
// Ensure we're on the right page before proceeding
|
||||
cy.log('[STEP 3.1] Verifying workspace loaded');
|
||||
cy.get('body').should('exist');
|
||||
cy.wait(2000);
|
||||
|
||||
// Create a new grid
|
||||
cy.log('[STEP 4] Creating new grid');
|
||||
cy.log('[STEP 4.1] Waiting for inline add button or new page button');
|
||||
|
||||
// Try to find either inline add button or new page button
|
||||
cy.get('body').then($body => {
|
||||
const inlineAddExists = $body.find('[data-testid="inline-add-page"]').length > 0;
|
||||
const newPageExists = $body.find('[data-testid="new-page-button"]').length > 0;
|
||||
|
||||
if (inlineAddExists) {
|
||||
cy.log('[STEP 4.2] Using inline add button');
|
||||
return cy.wrap(null).then(() => {
|
||||
AddPageSelectors.inlineAddButton().first().click({ force: true });
|
||||
});
|
||||
} else if (newPageExists) {
|
||||
cy.log('[STEP 4.2] Using new page button instead');
|
||||
return cy.wrap(null).then(() => {
|
||||
cy.get('[data-testid="new-page-button"]').first().click({ force: true });
|
||||
});
|
||||
} else {
|
||||
// Wait a bit more and try inline add button
|
||||
cy.log('[STEP 4.2] Waiting for UI to stabilize');
|
||||
return cy.wrap(null).then(() => {
|
||||
cy.wait(3000);
|
||||
AddPageSelectors.inlineAddButton().should('exist', { timeout: 15000 });
|
||||
AddPageSelectors.inlineAddButton().first().click({ force: true });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
waitForReactUpdate(1000);
|
||||
cy.log('[STEP 4.3] Clicking add grid button');
|
||||
AddPageSelectors.addGridButton().should('exist', { timeout: 10000 });
|
||||
AddPageSelectors.addGridButton().click({ force: true });
|
||||
cy.wait(8000);
|
||||
|
||||
@@ -97,12 +131,21 @@ describe('Single Select Column Type', () => {
|
||||
authUtils.signInWithTestUrl(testEmail).then(() => {
|
||||
cy.log('[STEP 3] Authentication successful');
|
||||
cy.url({ timeout: 30000 }).should('include', '/app');
|
||||
cy.wait(3000);
|
||||
cy.wait(5000); // Increased wait for CI environment
|
||||
|
||||
// Ensure we're on the right page before proceeding
|
||||
cy.log('[STEP 3.1] Verifying workspace loaded');
|
||||
cy.get('body').should('exist');
|
||||
cy.wait(2000);
|
||||
|
||||
// Create a new grid
|
||||
cy.log('[STEP 4] Creating new grid');
|
||||
cy.log('[STEP 4.1] Waiting for inline add button');
|
||||
AddPageSelectors.inlineAddButton().should('exist', { timeout: 15000 });
|
||||
AddPageSelectors.inlineAddButton().first().scrollIntoView().click({ force: true });
|
||||
waitForReactUpdate(1000);
|
||||
cy.log('[STEP 4.2] Clicking add grid button');
|
||||
AddPageSelectors.addGridButton().should('exist', { timeout: 10000 });
|
||||
AddPageSelectors.addGridButton().click({ force: true });
|
||||
cy.wait(8000);
|
||||
|
||||
|
||||
@@ -170,14 +170,28 @@ export class AuthTestUtils {
|
||||
// This endpoint creates the user in the AppFlowy backend
|
||||
cy.task('log', 'Calling verify endpoint to create user profile');
|
||||
|
||||
// Make the verify call - this creates the user profile in AppFlowy backend
|
||||
// Make the verify call with retry logic for CI environment
|
||||
const verifyWithRetry = (retries = 3): Cypress.Chainable<any> => {
|
||||
return cy.request({
|
||||
method: 'GET',
|
||||
url: `${this.config.baseUrl}/api/user/verify/${accessToken}`,
|
||||
failOnStatusCode: false,
|
||||
timeout: 30000,
|
||||
}).then((verifyResponse) => {
|
||||
cy.task('log', `Verify response status: ${verifyResponse.status}`);
|
||||
|
||||
// If we get a 502 or 503 error, retry
|
||||
if ((verifyResponse.status === 502 || verifyResponse.status === 503) && retries > 0) {
|
||||
cy.task('log', `Retrying verify endpoint, ${retries} attempts remaining`);
|
||||
return cy.wait(2000).then(() => verifyWithRetry(retries - 1));
|
||||
}
|
||||
|
||||
return cy.wrap(verifyResponse);
|
||||
});
|
||||
};
|
||||
|
||||
return verifyWithRetry().then((verifyResponse) => {
|
||||
|
||||
// Now refresh the token to get session data
|
||||
return cy.request({
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user