Skip to content

Commit 1dcba56

Browse files
authored
Merge pull request #1723 from RedisInsight/e2e/feature/RI-4067_onboard-new-users
Add onbarding steps tests
2 parents 03f3ba5 + 44df2b9 commit 1dcba56

File tree

4 files changed

+164
-1
lines changed

4 files changed

+164
-1
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import {t} from 'testcafe';
2+
import {OnboardingPage, BrowserPage} from '../pageObjects';
3+
4+
const onboardingPage = new OnboardingPage();
5+
const browserPage = new BrowserPage();
6+
export class OnboardActions {
7+
/**
8+
@param stepName title of the step
9+
verify onboarding step visible based on title
10+
*/
11+
async verifyStepVisible(stepName: string): Promise<void> {
12+
await t.expect(onboardingPage.stepTitle.withText(stepName).exists).ok(`${stepName} step is not visible`);
13+
}
14+
/**
15+
click next step
16+
*/
17+
async clickNextStep(): Promise<void> {
18+
await t.click(onboardingPage.nextButton);
19+
}
20+
/**
21+
start onboarding process
22+
*/
23+
async startOnboarding(): Promise<void> {
24+
await t.click(onboardingPage.showMeAroundButton);
25+
}
26+
/**
27+
complete onboarding process
28+
*/
29+
async verifyOnboardingCompleted(): Promise<void> {
30+
await t.expect(onboardingPage.showMeAroundButton.visible).notOk('show me around button still visible');
31+
await t.expect(browserPage.patternModeBtn.visible).ok('browser page is not opened');
32+
}
33+
/**
34+
click back step
35+
*/
36+
async clickBackStep(): Promise<void> {
37+
await t.click(onboardingPage.backButton);
38+
}
39+
/**
40+
click skip tour step
41+
*/
42+
async clickSkipTour(): Promise<void> {
43+
await t.click(onboardingPage.skipTourButton);
44+
}
45+
}

tests/e2e/pageObjects/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { OverviewPage } from './overview-page';
1616
import { PubSubPage } from './pub-sub-page';
1717
import { SlowLogPage } from './slow-log-page';
1818
import { NotificationPage } from './notification-page';
19+
import { OnboardingPage} from './onboarding-page';
1920

2021
export {
2122
AddRedisDatabasePage,
@@ -35,5 +36,6 @@ export {
3536
OverviewPage,
3637
PubSubPage,
3738
SlowLogPage,
38-
NotificationPage
39+
NotificationPage,
40+
OnboardingPage
3941
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Selector } from 'testcafe';
2+
3+
export class OnboardingPage {
4+
backButton = Selector('[data-testid=back-btn]');
5+
nextButton = Selector('[data-testid=next-btn]');
6+
showMeAroundButton = Selector('span').withText('Show me around');
7+
skipTourButton = Selector('[data-testid=skip-tour-btn]');
8+
stepTitle = Selector('[data-testid=step-title]');
9+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
import {ClientFunction} from 'testcafe';
2+
import {
3+
acceptTermsAddDatabaseOrConnectToRedisStack, deleteDatabase
4+
} from '../../../helpers/database';
5+
import {
6+
commonUrl, ossStandaloneConfig
7+
} from '../../../helpers/conf';
8+
import { env, rte } from '../../../helpers/constants';
9+
import {Common} from '../../../helpers/common';
10+
import {OnboardActions} from '../../../common-actions/onboard-actions';
11+
import {CliPage, MemoryEfficiencyPage, SlowLogPage, WorkbenchPage, PubSubPage, MonitorPage} from '../../../pageObjects';
12+
13+
const common = new Common();
14+
const onBoardActions = new OnboardActions();
15+
const cliPage = new CliPage();
16+
const memoryEfficiencyPage = new MemoryEfficiencyPage();
17+
const workBenchPage = new WorkbenchPage();
18+
const slowLogPage = new SlowLogPage();
19+
const pubSubPage = new PubSubPage();
20+
const monitorPage = new MonitorPage();
21+
const setLocalStorageItem = ClientFunction((key: string, value: string) => window.localStorage.setItem(key, value));
22+
23+
fixture `Onboarding new user tests`
24+
.meta({type: 'regression', rte: rte.standalone, env: env.desktop })
25+
.page(commonUrl)
26+
.beforeEach(async() => {
27+
await acceptTermsAddDatabaseOrConnectToRedisStack(ossStandaloneConfig, ossStandaloneConfig.databaseName);
28+
await setLocalStorageItem('onboardingStep', '0');
29+
await common.reloadPage();
30+
})
31+
.afterEach(async() => {
32+
await deleteDatabase(ossStandaloneConfig.databaseName);
33+
});
34+
test('Verify onbarding new user steps', async t => {
35+
await onBoardActions.startOnboarding();
36+
// verify browser step is visible
37+
await onBoardActions.verifyStepVisible('Browser');
38+
// move to next step
39+
await onBoardActions.clickNextStep();
40+
// verify tree view step is visible
41+
await onBoardActions.verifyStepVisible('Tree view');
42+
await onBoardActions.clickNextStep();
43+
await onBoardActions.verifyStepVisible('Filter and search');
44+
await onBoardActions.clickNextStep();
45+
// verify cli is opened
46+
await t.expect(cliPage.cliPanel.visible).ok('cli is not expanded');
47+
await onBoardActions.verifyStepVisible('CLI');
48+
await onBoardActions.clickNextStep();
49+
// verify command helper area is opened
50+
await t.expect(cliPage.commandHelperArea.visible).ok('command helper is not expanded');
51+
await onBoardActions.verifyStepVisible('Command Helper');
52+
await onBoardActions.clickNextStep();
53+
// verify profiler is opened
54+
await t.expect(monitorPage.monitorArea.visible).ok('profiler is not expanded');
55+
await onBoardActions.verifyStepVisible('Profiler');
56+
await onBoardActions.clickNextStep();
57+
// verify workbench page is opened
58+
await t.expect(workBenchPage.mainEditorArea.visible).ok('workbench is not opened');
59+
await onBoardActions.verifyStepVisible('Try Workbench!');
60+
// click back step button
61+
await onBoardActions.clickBackStep();
62+
// verify one step before is opened
63+
await t.expect(monitorPage.monitorArea.visible).ok('profiler is not expanded');
64+
await onBoardActions.verifyStepVisible('Profiler');
65+
await onBoardActions.clickNextStep();
66+
// verify workbench page is opened
67+
await t.expect(workBenchPage.mainEditorArea.visible).ok('workbench is not opened');
68+
await onBoardActions.verifyStepVisible('Try Workbench!');
69+
await onBoardActions.clickNextStep();
70+
await onBoardActions.verifyStepVisible('Explore and learn more');
71+
await onBoardActions.clickNextStep();
72+
// verify analysis tools page is opened
73+
await t.expect(memoryEfficiencyPage.noReportsText.visible).ok('analysis tools is not opened');
74+
await onBoardActions.verifyStepVisible('Database Analysis');
75+
await onBoardActions.clickNextStep();
76+
// verify slow log is opened
77+
await t.expect(slowLogPage.slowLogTable.visible).ok('slow log is not opened');
78+
await onBoardActions.verifyStepVisible('Slow Log');
79+
await onBoardActions.clickNextStep();
80+
// verify pub/sub page is opened
81+
await t.expect(pubSubPage.subscribeButton.visible).ok('pub/sub page is not opened');
82+
await onBoardActions.verifyStepVisible('Pub/Sub');
83+
await onBoardActions.clickNextStep();
84+
// verify last step of onboarding process is visible
85+
await onBoardActions.verifyStepVisible('Great job!');
86+
await onBoardActions.clickNextStep();
87+
// verify onboarding step completed successfully
88+
await onBoardActions.verifyOnboardingCompleted();
89+
});
90+
test('verify onboard new user skip tour', async() => {
91+
// start onboarding process
92+
await onBoardActions.startOnboarding();
93+
// verify browser step is visible
94+
await onBoardActions.verifyStepVisible('Browser');
95+
// move to next step
96+
await onBoardActions.clickNextStep();
97+
// verify tree view step is visible
98+
await onBoardActions.verifyStepVisible('Tree view');
99+
// click skip tour
100+
await onBoardActions.clickSkipTour();
101+
// verify onboarding step completed successfully
102+
await onBoardActions.verifyOnboardingCompleted();
103+
await common.reloadPage();
104+
// verify onboarding step still not visible after refresh page
105+
await onBoardActions.verifyOnboardingCompleted();
106+
});
107+

0 commit comments

Comments
 (0)