|
| 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