Skip to content

Commit 5668a7e

Browse files
authored
Merge pull request #97 from RedisInsight/feature/e2e-shortcuts
E2E test with Shortcuts is added
2 parents f8f1f43 + f3be9f3 commit 5668a7e

File tree

5 files changed

+112
-2
lines changed

5 files changed

+112
-2
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Selector } from 'testcafe';
2+
3+
export class HelpCenterPage {
4+
5+
//------------------------------------------------------------------------------------------
6+
//DECLARATION OF TYPES: DOM ELEMENTS and UI COMPONENTS
7+
//*Assign the 'Selector' type to any element/component nested within the constructor.
8+
//------------------------------------------------------------------------------------------
9+
helpCenterPanel: Selector
10+
helpCenterSubmitBugButton: Selector
11+
helpCenterShortcutButton: Selector
12+
helpCenterReleaseNotesButton: Selector
13+
14+
constructor() {
15+
//-------------------------------------------------------------------------------------------
16+
//DECLARATION OF SELECTORS
17+
//*Declare all elements/components of the relevant page.
18+
//*Target any element/component via data-id, if possible!
19+
//*The following categories are ordered alphabetically (Alerts, Buttons, Checkboxes, etc.).
20+
//-------------------------------------------------------------------------------------------
21+
// BUTTONS
22+
this.helpCenterSubmitBugButton = Selector('[data-testid=submit-bug-btn]');
23+
this.helpCenterShortcutButton = Selector('[data-testid=shortcuts-btn]');
24+
this.helpCenterReleaseNotesButton = Selector('[data-testid=release-notes-btn]');
25+
// Panel
26+
this.helpCenterPanel = Selector('[data-testid=help-center]')
27+
}
28+
}

tests/e2e/pageObjects/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { SettingsPage } from './settings-page';
77
import { UserAgreementPage } from './user-agreement-page';
88
import { WorkbenchPage } from './workbench-page';
99
import { DatabaseOverviewPage } from './database-overview-page';
10+
import { HelpCenterPage } from './help-center-page';
11+
import { ShortcutsPage } from './shortcuts-page';
1012

1113
export {
1214
AddRedisDatabasePage,
@@ -17,5 +19,7 @@ export {
1719
SettingsPage,
1820
UserAgreementPage,
1921
WorkbenchPage,
20-
DatabaseOverviewPage
22+
DatabaseOverviewPage,
23+
HelpCenterPage,
24+
ShortcutsPage
2125
}

tests/e2e/pageObjects/my-redis-databases-page.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export class MyRedisDatabasePage {
1010
dbNameList: Selector
1111
settingsButton: Selector
1212
workbenchButton: Selector
13+
helpCenterButton: Selector
1314
myRedisDBButton: Selector
1415
toastCloseButton: Selector
1516
deleteDatabaseButton: Selector
@@ -32,6 +33,7 @@ export class MyRedisDatabasePage {
3233
//BUTTONS
3334
this.settingsButton = Selector('[data-testid=settings-page-btn]');
3435
this.workbenchButton = Selector('[data-testid=workbench-page-btn]');
36+
this.helpCenterButton = Selector('[data-testid=help-menu-button]');
3537
this.browserButton = Selector('[data-testid=browser-page-btn]');
3638
this.myRedisDBButton = Selector('[data-test-subj=home-page-btn]');
3739
this.deleteDatabaseButton = Selector('[data-testid^=delete-instance-]');
@@ -70,7 +72,7 @@ export class MyRedisDatabasePage {
7072
await t.click(this.confirmDeleteButton);
7173
}
7274
if (await this.toastCloseButton.exists) {
73-
await t.click(this.toastCloseButton);
75+
await t.click(this.toastCloseButton);
7476
}
7577
}
7678

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Selector } from 'testcafe';
2+
3+
export class ShortcutsPage {
4+
5+
//------------------------------------------------------------------------------------------
6+
//DECLARATION OF TYPES: DOM ELEMENTS and UI COMPONENTS
7+
//*Assign the 'Selector' type to any element/component nested within the constructor.
8+
//------------------------------------------------------------------------------------------
9+
10+
shortcutsPanel: Selector
11+
shortcutsTitle: Selector
12+
shortcutsDesktopApplicationSection: Selector
13+
shortcutsCLISection: Selector
14+
shortcutsWorkbenchSection: Selector
15+
shortcutsCloseButton: Selector
16+
17+
constructor() {
18+
//-------------------------------------------------------------------------------------------
19+
//DECLARATION OF SELECTORS
20+
//*Declare all elements/components of the relevant page.
21+
//*Target any element/component via data-id, if possible!
22+
//*The following categories are ordered alphabetically (Alerts, Buttons, Checkboxes, etc.).
23+
//-------------------------------------------------------------------------------------------
24+
// BUTTONS
25+
this.shortcutsTitle = Selector('[data-testid=shortcuts-title]');
26+
this.shortcutsDesktopApplicationSection = Selector('[data-test-subj="shortcuts-section-Desktop application"]');
27+
this.shortcutsCLISection = Selector('[data-test-subj=shortcuts-section-CLI]');
28+
this.shortcutsWorkbenchSection = Selector('[data-test-subj=shortcuts-section-Workbench]');
29+
this.shortcutsCloseButton = Selector('[data-test-subj=euiFlyoutCloseButton]')
30+
// Panel
31+
this.shortcutsPanel = Selector('[data-test-subj=shortcuts-flyout]');
32+
}
33+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import {
2+
UserAgreementPage,
3+
MyRedisDatabasePage,
4+
HelpCenterPage,
5+
ShortcutsPage
6+
} from '../../../pageObjects';
7+
import {
8+
commonUrl
9+
} from '../../../helpers/conf';
10+
11+
const userAgreementPage = new UserAgreementPage();
12+
const myRedisDatabasePage = new MyRedisDatabasePage();
13+
const helpCenterPage = new HelpCenterPage();
14+
const shortcutsPage = new ShortcutsPage();
15+
16+
fixture `Shortcuts`
17+
.meta({ type: 'regression' })
18+
.page(commonUrl)
19+
.beforeEach(async t => {
20+
await t.maximizeWindow();
21+
await userAgreementPage.acceptLicenseTerms();
22+
})
23+
24+
test('Verify that user can see a summary of Shortcuts by clicking "Keyboard Shortcuts" button in Help Center', async t => {
25+
// Click on help center icon
26+
await t.click(myRedisDatabasePage.helpCenterButton);
27+
// Verify that Help Center panel is opened
28+
await t.expect(helpCenterPage.helpCenterPanel.exists).ok('Help Center panel is opened');
29+
// Click on Shortcuts option
30+
await t.click(helpCenterPage.helpCenterShortcutButton);
31+
// Validate that Shortcuts panel is opened
32+
await t.expect(shortcutsPage.shortcutsPanel.exists).ok('Shortcuts panel is opened');
33+
// Validate Title and sections of Shortcuts
34+
await t.expect(shortcutsPage.shortcutsPanel.exists).ok('Shortcuts panel is opened');
35+
await t.expect(shortcutsPage.shortcutsTitle.exists).ok('shortcutsTitle is opened');
36+
await t.expect(shortcutsPage.shortcutsDesktopApplicationSection.exists).ok('shortcutsDesktopApplicationSection is opened');
37+
await t.expect(shortcutsPage.shortcutsCLISection.exists).ok('shortcutsCLISection is displayed');
38+
await t.expect(shortcutsPage.shortcutsWorkbenchSection.exists).ok('shortcutsWorkbenchSection is displayed');
39+
// Verify that user can close the Shortcuts
40+
await t.click(shortcutsPage.shortcutsCloseButton);
41+
// Verify that Shortcuts panel is not displayed
42+
await t.expect(shortcutsPage.shortcutsPanel.exists).notOk('Shortcuts panel is not displayed');
43+
})

0 commit comments

Comments
 (0)