mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 03:55:57 +00:00
test(pw): default skip onboarding flow in pw user signup
This commit is contained in:
@@ -122,6 +122,11 @@ export class OnboardingFlowPage extends BasePage {
|
||||
await expect(option).toHaveClass(/nc-selected/);
|
||||
}
|
||||
|
||||
// If it is last question then no need to navigate to next question as we need to perform finish action
|
||||
if (await this.isLastQuestion()) {
|
||||
return;
|
||||
}
|
||||
|
||||
await this.navigateToNextQuestion();
|
||||
|
||||
// Wait for auto-navigation (500ms delay as per useOnboardingFlow)
|
||||
@@ -152,10 +157,10 @@ export class OnboardingFlowPage extends BasePage {
|
||||
* Complete the onboarding flow by navigating through all questions
|
||||
*/
|
||||
async completeOnboardingFlow() {
|
||||
await this.get().waitFor({ state: 'visible' });
|
||||
|
||||
// Navigate through all questions
|
||||
let questionIndex = 0;
|
||||
let flag = true;
|
||||
while (flag) {
|
||||
for (let questionIndex = 0; questionIndex < 25; questionIndex++) {
|
||||
await this.verifyQuestionIndex(questionIndex);
|
||||
|
||||
const questionType = await this.getCurrentQuestionType();
|
||||
@@ -165,12 +170,7 @@ export class OnboardingFlowPage extends BasePage {
|
||||
await this.handleMultiSelectQuestion({ optionIndexes: [0, 1] });
|
||||
}
|
||||
|
||||
/**
|
||||
* `questionIndex > 25` condition will not be reached in the actual flow,
|
||||
* but it's a safety net to prevent infinite loops in case of unexpected behavior.
|
||||
*/
|
||||
if ((await this.isLastQuestion()) || questionIndex > 25) {
|
||||
flag = false;
|
||||
if (await this.isLastQuestion()) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -196,6 +196,8 @@ export class OnboardingFlowPage extends BasePage {
|
||||
* Skip the onboarding flow
|
||||
*/
|
||||
async skipOnboardingFlow({ verify = false }: { verify?: boolean } = {}) {
|
||||
await this.get().waitFor({ state: 'visible' });
|
||||
|
||||
await this.waitForResponse({
|
||||
uiAction: () => this.skipButton.click(),
|
||||
httpMethodsToMatch: ['PATCH'],
|
||||
@@ -2,13 +2,16 @@ import { Page } from '@playwright/test';
|
||||
import BasePage from '../Base';
|
||||
import { ProjectsPage } from '../ProjectsPage';
|
||||
import { expect } from '@playwright/test';
|
||||
import { OnboardingFlowPage } from '../OnboardingFlowPage';
|
||||
|
||||
export class SignupPage extends BasePage {
|
||||
readonly projectsPage: ProjectsPage;
|
||||
readonly onboardingFlowPage: OnboardingFlowPage;
|
||||
|
||||
constructor(rootPage: Page) {
|
||||
super(rootPage);
|
||||
this.projectsPage = new ProjectsPage(rootPage);
|
||||
this.onboardingFlowPage = new OnboardingFlowPage(rootPage);
|
||||
}
|
||||
|
||||
prefixEmail(email: string) {
|
||||
@@ -51,7 +54,9 @@ export class SignupPage extends BasePage {
|
||||
await this.rootPage.waitForLoadState('networkidle');
|
||||
|
||||
if (skipOnboardingFlow) {
|
||||
// await this.rootPage.locator('button:has-text("Skip")').click();
|
||||
await this.onboardingFlowPage.skipOnboardingFlow();
|
||||
} else {
|
||||
await this.onboardingFlowPage.completeOnboardingFlow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { test } from '@playwright/test';
|
||||
import { OnboardingFlowPage } from '../pages/OnboardingFlow';
|
||||
import { OnboardingFlowPage } from '../pages/OnboardingFlowPage';
|
||||
|
||||
test.describe('Onboarding Flow', () => {
|
||||
let onboardingFlowPage: OnboardingFlowPage;
|
||||
@@ -22,7 +22,7 @@ test.describe('Onboarding Flow', () => {
|
||||
|
||||
test('should skip onboarding flow', async () => {
|
||||
// Skip the flow
|
||||
await onboardingFlowPage.skipOnboardingFlow();
|
||||
await onboardingFlowPage.skipOnboardingFlow({ verify: true });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user