Skip to content

Commit ed3a0bc

Browse files
[refactoring] - move nav panel and profiler to components, fix part of eslint errors
1 parent 31a1c8e commit ed3a0bc

File tree

87 files changed

+392
-370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+392
-370
lines changed

tests/e2e/.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
// ******************** NOT README STANDARDS ********************
5353
//Limits the length of a row to 400
5454
"max-len": ["error", 400],
55-
55+
5656
//Forcing that all of the comments are with spaces.
5757
"spaced-comment": "off",
5858
//Forcing not to have random spaces.
@@ -128,6 +128,7 @@
128128
],
129129
//Enforce a convention in module import order
130130
"import/order": "error",
131+
"object-curly-spacing": ["error", "always"],
131132
//Disallow duplicate imports
132133
"import/no-duplicates": "error",
133134
/* Below are extended rules regarding the recommended typescript rule package...*/

tests/e2e/helpers/database.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export async function acceptLicenseAndConnectToRedisStack(): Promise<void> {
228228
await acceptLicenseTerms();
229229
//Connect to DB
230230
await t
231-
.click(myRedisDatabasePage.myRedisDBButton)
231+
.click(myRedisDatabasePage.NavigationPanel.myRedisDBButton)
232232
.click(addRedisDatabasePage.connectToRedisStackButton);
233233
}
234234

@@ -247,7 +247,7 @@ export async function clearDatabaseInCli(): Promise<void> {
247247
* @param databaseName The database name
248248
*/
249249
export async function deleteDatabase(databaseName: string): Promise<void> {
250-
await t.click(myRedisDatabasePage.myRedisDBButton);
250+
await t.click(myRedisDatabasePage.NavigationPanel.myRedisDBButton);
251251
if (await addRedisDatabasePage.addDatabaseButton.exists) {
252252
await deleteDatabaseByNameApi(databaseName);
253253
}
@@ -258,7 +258,7 @@ export async function deleteDatabase(databaseName: string): Promise<void> {
258258
* @param databaseName The database name
259259
*/
260260
export async function deleteCustomDatabase(databaseName: string): Promise<void> {
261-
await t.click(myRedisDatabasePage.myRedisDBButton);
261+
await t.click(myRedisDatabasePage.NavigationPanel.myRedisDBButton);
262262
if (await addRedisDatabasePage.addDatabaseButton.exists) {
263263
await myRedisDatabasePage.deleteDatabaseByName(databaseName);
264264
}
@@ -301,4 +301,4 @@ export async function deleteDatabaseByNameApi(databaseName: string): Promise<voi
301301
await t.expect(databaseDeleteBtn.exists).ok(`"${databaseName}" database not displayed`);
302302
await t.click(databaseDeleteBtn);
303303
await t.click(myRedisDatabasePage.confirmDeleteButton);
304-
}
304+
}

tests/e2e/pageObjects/add-redis-database-page.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {t, Selector} from 'testcafe';
1+
import { t, Selector } from 'testcafe';
22

33
export class AddRedisDatabasePage {
44
//-------------------------------------------------------------------------------------------
@@ -58,13 +58,13 @@ export class AddRedisDatabasePage {
5858
buildFromDocker = Selector('a').withExactText('Docker');
5959
buildFromHomebrew = Selector('a').withExactText('Homebrew');
6060
// DROPDOWNS
61-
caCertField = Selector('[data-testid=select-ca-cert]', {timeout: 500});
62-
clientCertField = Selector('[data-testid=select-cert]', {timeout: 500});
61+
caCertField = Selector('[data-testid=select-ca-cert]', { timeout: 500 });
62+
clientCertField = Selector('[data-testid=select-cert]', { timeout: 500 });
6363
// CHECKBOXES
64-
useSSHCheckbox = Selector('[data-testid=use-ssh]~div', {timeout: 500});
64+
useSSHCheckbox = Selector('[data-testid=use-ssh]~div', { timeout: 500 });
6565
// RADIO BUTTONS
66-
sshPasswordRadioBtn = Selector('#password~div', {timeout: 500});
67-
sshPrivateKeyRadioBtn = Selector('#privateKey~div', {timeout: 500});
66+
sshPasswordRadioBtn = Selector('#password~div', { timeout: 500 });
67+
sshPrivateKeyRadioBtn = Selector('#privateKey~div', { timeout: 500 });
6868

6969
/**
7070
* Adding a new redis database
@@ -108,11 +108,11 @@ export class AddRedisDatabasePage {
108108
}
109109
// Enter logical index
110110
await t.click(this.databaseIndexCheckbox);
111-
await t.typeText(this.databaseIndexInput, index, { replace: true, paste: true});
111+
await t.typeText(this.databaseIndexInput, index, { replace: true, paste: true });
112112
// Click for saving
113113
await t.click(this.addRedisDatabaseButton);
114114
}
115-
115+
116116
/**
117117
* Adding a new standalone database with SSH
118118
* @param databaseParameters the parameters of the database
@@ -140,18 +140,18 @@ export class AddRedisDatabasePage {
140140
.typeText(this.sshPortInput, sshParameters.sshPort, { replace: true, paste: true })
141141
.typeText(this.sshUsernameInput, sshParameters.sshUsername, { replace: true, paste: true });
142142
if (!!sshParameters.sshPassword) {
143-
await t.typeText(this.sshPasswordInput, sshParameters.sshPassword, { replace: true, paste: true });
143+
await t.typeText(this.sshPasswordInput, sshParameters.sshPassword, { replace: true, paste: true });
144144
}
145145
if (!!sshParameters.sshPrivateKey) {
146146
await t
147-
.click(this.sshPrivateKeyRadioBtn)
148-
.typeText(this.sshPrivateKeyInput, sshParameters.sshPrivateKey, { replace: true, paste: true });
147+
.click(this.sshPrivateKeyRadioBtn)
148+
.typeText(this.sshPrivateKeyInput, sshParameters.sshPrivateKey, { replace: true, paste: true });
149149
}
150150
if (!!sshParameters.sshPassphrase) {
151151
await t
152-
.click(this.sshPrivateKeyRadioBtn)
153-
.typeText(this.sshPrivateKeyInput, sshParameters.sshPrivateKey!, { replace: true, paste: true })
154-
.typeText(this.sshPassphraseInput, sshParameters.sshPassphrase, { replace: true, paste: true });
152+
.click(this.sshPrivateKeyRadioBtn)
153+
.typeText(this.sshPrivateKeyInput, sshParameters.sshPrivateKey!, { replace: true, paste: true })
154+
.typeText(this.sshPassphraseInput, sshParameters.sshPassphrase, { replace: true, paste: true });
155155
}
156156
// Click for saving
157157
await t.click(this.addRedisDatabaseButton);
@@ -249,7 +249,7 @@ export type AddNewDatabaseParameters = {
249249
name?: string,
250250
certificate?: string,
251251
key?: string
252-
},
252+
}
253253
};
254254

255255
/**
@@ -265,7 +265,7 @@ export type SentinelParameters = {
265265
alias?: string,
266266
db?: string,
267267
name?: string,
268-
password?: string,
268+
password?: string
269269
}[],
270270
sentinelPassword?: string,
271271
name?: string[]

tests/e2e/pageObjects/base-page.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { NavigationPanel } from './components/navigation-panel';
2+
3+
export class BasePage {
4+
NavigationPanel = new NavigationPanel();
5+
6+
}

tests/e2e/pageObjects/browser-page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { t, Selector } from 'testcafe';
22
import { Common } from '../helpers/common';
3+
import { InstancePage } from './instance-page';
34

45
const common = new Common();
56

6-
export class BrowserPage {
7+
export class BrowserPage extends InstancePage {
78
//CSS Selectors
89
cssSelectorGrid = '[aria-label="grid"]';
910
cssSelectorRows = '[aria-label="row"]';
@@ -100,7 +101,6 @@ export class BrowserPage {
100101
editHashButton = Selector('[data-testid^=edit-hash-button-]');
101102
editZsetButton = Selector('[data-testid^=zset-edit-button-]');
102103
editListButton = Selector('[data-testid^=edit-list-button-]');
103-
workbenchLinkButton = Selector('[data-test-subj=workbench-page-btn]');
104104
cancelStreamGroupBtn = Selector('[data-testid=cancel-stream-groups-btn]');
105105
submitTooltipBtn = Selector('[data-testid=submit-tooltip-btn]');
106106
patternModeBtn = Selector('[data-testid=search-mode-pattern-btn]');
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Profiler } from './profiler';
2+
3+
export {
4+
Profiler
5+
};

tests/e2e/pageObjects/monitor-page.ts renamed to tests/e2e/pageObjects/components/instance/profiler.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
import {Selector, t} from 'testcafe';
1+
import { Selector, t } from 'testcafe';
22

3-
export class MonitorPage {
4-
//-------------------------------------------------------------------------------------------
5-
//DECLARATION OF SELECTORS
6-
//*Declare all elements/components of the relevant page.
7-
//*Target any element/component via data-id, if possible!
8-
//*The following categories are ordered alphabetically (Alerts, Buttons, Checkboxes, etc.).
9-
//-------------------------------------------------------------------------------------------
3+
export class Profiler {
104
//BUTTONS
115
expandMonitor = Selector('[data-testid=expand-monitor]');
126
runMonitorToggle = Selector('[data-testid=toggle-run-monitor]');
@@ -39,11 +33,11 @@ export class MonitorPage {
3933
async checkCommandInMonitorResults(command: string, parameters?: string[]): Promise<void> {
4034
const commandArray = command.split(' ');
4135
for (const value of commandArray) {
42-
await t.expect(this.monitorCommandLinePart.withText(value).exists).ok({timeout: 6000});
36+
await t.expect(this.monitorCommandLinePart.withText(value).exists).ok({ timeout: 6000 });
4337
}
4438
if (!!parameters) {
4539
for (const argument of parameters) {
46-
await t.expect(this.monitorCommandLinePart.withText(argument).exists).ok({timeout: 6000});
40+
await t.expect(this.monitorCommandLinePart.withText(argument).exists).ok({ timeout: 6000 });
4741
}
4842
}
4943
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Selector } from 'testcafe';
2+
3+
export class NavigationPanel {
4+
workbenchButton = Selector('[data-testid=workbench-page-btn]');
5+
analysisPageButton = Selector('[data-testid=analytics-page-btn]');
6+
browserButton = Selector('[data-testid=browser-page-btn]');
7+
pubSubButton = Selector('[data-testid=pub-sub-page-btn]');
8+
myRedisDBButton = Selector('[data-test-subj=home-page-btn]', { timeout: 1000 });
9+
10+
notificationCenterButton = Selector('[data-testid=notification-menu-button]');
11+
settingsButton = Selector('[data-testid=settings-page-btn]');
12+
helpCenterButton = Selector('[data-testid=help-menu-button]');
13+
githubButton = Selector('[data-testid=github-repo-icon]');
14+
}

tests/e2e/pageObjects/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ import { DatabaseOverviewPage } from './database-overview-page';
1111
import { HelpCenterPage } from './help-center-page';
1212
import { ShortcutsPage } from './shortcuts-page';
1313
import { MemoryEfficiencyPage } from './memory-efficiency-page';
14-
import { MonitorPage } from './monitor-page';
1514
import { OverviewPage } from './overview-page';
1615
import { PubSubPage } from './pub-sub-page';
1716
import { SlowLogPage } from './slow-log-page';
1817
import { NotificationPage } from './notification-page';
1918
import { OnboardingPage} from './onboarding-page';
19+
import { BasePage} from './base-page';
20+
import { InstancePage} from './instance-page';
2021

2122
export {
2223
AddRedisDatabasePage,
@@ -32,10 +33,11 @@ export {
3233
HelpCenterPage,
3334
ShortcutsPage,
3435
MemoryEfficiencyPage,
35-
MonitorPage,
3636
OverviewPage,
3737
PubSubPage,
3838
SlowLogPage,
3939
NotificationPage,
40-
OnboardingPage
40+
OnboardingPage,
41+
BasePage,
42+
InstancePage
4143
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { BasePage } from './base-page';
2+
import { Profiler } from './components/instance';
3+
4+
export class InstancePage extends BasePage {
5+
Profiler = new Profiler();
6+
7+
}

0 commit comments

Comments
 (0)