Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const InstanceHeader = () => {
<div className={cx(styles.container)}>
<EuiFlexGroup gutterSize="none" responsive={false}>
<EuiFlexItem style={{ overflow: 'hidden' }}>
<div className={styles.breadcrumbsContainer}>
<div className={styles.breadcrumbsContainer} data-testid="breadcrumbs-container">
<div>
<EuiToolTip
position="bottom"
Expand All @@ -57,6 +57,7 @@ const InstanceHeader = () => {
iconSize="l"
iconType="sortLeft"
aria-label="My Redis databases"
data-testid="my-redis-db-icon"
onClick={goHome}
/>
</EuiToolTip>
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/pageObjects/browser-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export class BrowserPage {
treeViewMessage: Selector
totalKeysNumber: Selector
keysScanned: Selector
breadcrumbsContainer: Selector
databaseInfoIcon: Selector
databaseInfoToolTip: Selector
removeHashFieldButton: Selector
Expand Down Expand Up @@ -244,6 +245,7 @@ export class BrowserPage {
this.overviewCommandsSec = Selector('[data-test-subj=overview-commands-sec]');
this.overviewCpu = Selector('[data-test-subj=overview-cpu]');
this.selectedFilterTypeString = Selector('[data-testid=filter-option-type-selected-string]');
this.breadcrumbsContainer = Selector('[data-testid=breadcrumbs-container]');
this.treeViewArea = Selector('');
this.treeViewScannedValue = Selector('');
this.treeViewKeysNumber = Selector('');
Expand Down
30 changes: 30 additions & 0 deletions tests/e2e/pageObjects/my-redis-databases-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export class MyRedisDatabasePage {
deleteButtonInPopover: Selector
confirmDeleteAllDbButton: Selector
browserButton: Selector
editDatabaseButton: Selector
editAliasButton: Selector
aliasInput: Selector
applyButton: Selector
submitChangesButton: Selector
databaseInfoMessage: Selector;

constructor() {
Expand All @@ -42,13 +47,22 @@ export class MyRedisDatabasePage {
this.selectAllCheckbox = Selector('[data-test-subj=checkboxSelectAll]');
this.deleteButtonInPopover = Selector('#deletePopover button');
this.confirmDeleteAllDbButton = Selector('[data-testid=delete-selected-dbs]');
this.editDatabaseButton = Selector('[data-testid^=edit-instance]');
this.editAliasButton = Selector('[data-testid=edit-alias-btn]');
this.applyButton = Selector('[data-testid=apply-btn]');
this.submitChangesButton = Selector('[data-testid=btn-submit]');
// TEXT INPUTS (also referred to as 'Text fields')
this.dbNameList = Selector('[data-testid^=instance-name]');
this.tableRowContent = Selector('[data-test-subj=database-alias-column]');
this.databaseInfoMessage = Selector('[data-test-subj=euiToastHeader]');
this.hostPort = Selector('[data-testid=host-port]');
this.aliasInput = Selector('[data-testid=alias-input]');
}

/**
* Click on the database by name
* @param dbName The name of the database to be opened
*/
async clickOnDBByName(dbName: string): Promise<void>{
if (await this.toastCloseButton.exists) {
await t.click(this.toastCloseButton);
Expand Down Expand Up @@ -90,4 +104,20 @@ export class MyRedisDatabasePage {
}
}
}

/**
* Click on the edit database button by name
* @param databaseName The name of the database to be edited
*/
async clickOnEditDBByName(databaseName: string): Promise<void>{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a description on top (I see it didn't happen also on functions above)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

const dbNames = this.tableRowContent;
const count = await dbNames.count;

for(let i = 0; i < count; i++) {
if((await dbNames.nth(i).innerText || '').includes(databaseName)) {
await t.click(this.editDatabaseButton.nth(i));
break;
}
}
}
}
16 changes: 9 additions & 7 deletions tests/e2e/tests/critical-path/monitor/monitor.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,26 @@ import {
commonUrl,
ossStandaloneConfig
} from '../../../helpers/conf';
import { getRandomKeyName } from '../../../helpers/keys';
import { rte, env } from '../../../helpers/constants';
import { rte } from '../../../helpers/constants';
import { Chance } from 'chance';

const myRedisDatabasePage = new MyRedisDatabasePage();
const cliPage = new CliPage();
const monitorPage = new MonitorPage();
const workbenchPage = new WorkbenchPage();
const browserPage = new BrowserPage();
const keyName = `${getRandomKeyName(10)}-key`;
const keyValue = `${getRandomKeyName(10)}-value`;
const chance = new Chance();

const keyName = `${chance.word({ length: 20 })}-key`;
const keyValue = `${chance.word({ length: 10 })}-value`;

fixture `Monitor`
.meta({ type: 'critical_path' })
.page(commonUrl)
.beforeEach(async t => {
.beforeEach(async() => {
await acceptLicenseTermsAndAddDatabase(ossStandaloneConfig, ossStandaloneConfig.databaseName);
})
.afterEach(async t => {
.afterEach(async() => {
await deleteDatabase(ossStandaloneConfig.databaseName);
})
test
Expand All @@ -45,7 +47,7 @@ test
await t.expect(monitorPage.startMonitorButton.exists).ok('Start profiler button');
//Verify that user can see message inside Monitor "Running Monitor will decrease throughput, avoid running it in production databases." when opens it for the first time
await t.expect(monitorPage.monitorWarningMessage.exists).ok('Profiler warning message');
await monitorPage.monitorWarningMessage.withText('Running Profiler will decrease throughput, avoid running it in production databases');
await t.expect(monitorPage.monitorWarningMessage.withText('Running Profiler will decrease throughput, avoid running it in production databases').exists).ok('Profiler warning message is correct');
//Verify that user can run Monitor by clicking "Run" command in the message inside Monitor
await t.click(monitorPage.startMonitorButton);
await t.expect(monitorPage.monitorIsStartedText.innerText).eql('Profiler is started.');
Expand Down
16 changes: 15 additions & 1 deletion tests/e2e/tests/regression/browser/database-overview.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { acceptLicenseTermsAndAddDatabase, deleteDatabase } from '../../../helpe
import {
MyRedisDatabasePage,
CliPage,
WorkbenchPage
WorkbenchPage,
BrowserPage
} from '../../../pageObjects';
import { rte } from '../../../helpers/constants';
import { commonUrl, ossStandaloneConfig } from '../../../helpers/conf';
Expand All @@ -12,6 +13,7 @@ const myRedisDatabasePage = new MyRedisDatabasePage();
const workbenchPage = new WorkbenchPage();
const cliPage = new CliPage();
const common = new Common();
const browserPage = new BrowserPage();

let keys: string[];

Expand All @@ -38,3 +40,15 @@ test
await t.expect(workbenchPage.overviewTotalKeys.exists).ok('User can see total keys');
await t.expect(workbenchPage.overviewTotalMemory.exists).ok('User can see total memory');
});
test
.meta({ rte: rte.standalone })
.after(async () => {
//Delete database
await deleteDatabase(ossStandaloneConfig.databaseName);
})
('Verify that user can connect to DB and see breadcrumbs at the top of the application', async t => {
//Verify that user can see breadcrumbs in Browser and Workbench views
await t.expect(browserPage.breadcrumbsContainer.visible).ok('User can see breadcrumbs in Browser page', { timeout: 20000 });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 line test? couldn't it be covered over lower levels (such as components)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another verification is added in this test

await t.click(myRedisDatabasePage.workbenchButton);
await t.expect(browserPage.breadcrumbsContainer.visible).ok('User can see breadcrumbs in Workbench page', { timeout: 20000 });
});
34 changes: 34 additions & 0 deletions tests/e2e/tests/regression/browser/scan-keys.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { rte } from '../../../helpers/constants';
import { acceptLicenseTerms } from '../../../helpers/database';
import { MyRedisDatabasePage, SettingsPage } from '../../../pageObjects';
import { commonUrl } from '../../../helpers/conf';

const myRedisDatabasePage = new MyRedisDatabasePage();
const settingsPage = new SettingsPage();

const explicitErrorHandler = (): void => {
window.addEventListener('error', e => {
if(e.message === 'ResizeObserver loop limit exceeded') {
e.stopImmediatePropagation();
}
})
}

fixture `Browser - Specify Keys to Scan`
.meta({type: 'regression'})
.page(commonUrl)
.clientScripts({ content: `(${explicitErrorHandler.toString()})()` })
.beforeEach(async () => {
await acceptLicenseTerms();
})
test
.meta({ rte: rte.none })
('Verify that the user not enter the value less than 500 - the system automatically applies min value if user enters less than min', async t => {
//Go to Settings page
await t.click(myRedisDatabasePage.settingsButton);
//Specify keys to scan less than 500
await t.click(settingsPage.accordionAdvancedSettings);
await settingsPage.changeKeysToScanValue('100');
//Verify the applyed scan value
await t.expect(await settingsPage.keysToScanValue.textContent).eql('500', 'The system automatically applies min value 500');
});
85 changes: 62 additions & 23 deletions tests/e2e/tests/regression/cli/cli.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const chance = new Chance();
const browserPage = new BrowserPage();

let keyName = chance.word({ length: 20 });
const keyTTL = '2147476121';
const jsonValue = '{"name":"xyz"}';

fixture `CLI`
.meta({ type: 'regression' })
Expand All @@ -25,28 +27,32 @@ fixture `CLI`
//Delete database
await deleteDatabase(ossStandaloneConfig.databaseName);
})
test('Verify that user can see CLI is minimized when he clicks the "minimize" button', async t => {
const cliColourBefore = await common.getBackgroundColour(cliPage.cliBadge);
//Open CLI and minimize
await t.click(cliPage.cliExpandButton);
await t.click(cliPage.minimizeCliButton);
//Verify cli is minimized
const cliColourAfter = await common.getBackgroundColour(cliPage.cliBadge);
await t.expect(cliColourAfter).notEql(cliColourBefore, 'CLI badge colour is changed');
await t.expect(cliPage.minimizeCliButton.visible).eql(false, 'CLI is mimized');
});
test('Verify that user can see results history when he re-opens CLI after minimizing', async t => {
const command = 'SET key';
//Open CLI and run commands
await t.click(cliPage.cliExpandButton);
await t.typeText(cliPage.cliCommandInput, command);
await t.pressKey('enter');
//Minimize and re-open cli
await t.click(cliPage.minimizeCliButton);
await t.click(cliPage.cliExpandButton);
//Verify cli results history
await t.expect(cliPage.cliCommandExecuted.textContent).eql(command, 'CLI results history persists after reopening');
});
test
.meta({ rte: rte.standalone })
('Verify that user can see CLI is minimized when he clicks the "minimize" button', async t => {
const cliColourBefore = await common.getBackgroundColour(cliPage.cliBadge);
//Open CLI and minimize
await t.click(cliPage.cliExpandButton);
await t.click(cliPage.minimizeCliButton);
//Verify cli is minimized
const cliColourAfter = await common.getBackgroundColour(cliPage.cliBadge);
await t.expect(cliColourAfter).notEql(cliColourBefore, 'CLI badge colour is changed');
await t.expect(cliPage.minimizeCliButton.visible).eql(false, 'CLI is mimized');
});
test
.meta({ rte: rte.standalone })
('Verify that user can see results history when he re-opens CLI after minimizing', async t => {
const command = 'SET key';
//Open CLI and run commands
await t.click(cliPage.cliExpandButton);
await t.typeText(cliPage.cliCommandInput, command);
await t.pressKey('enter');
//Minimize and re-open cli
await t.click(cliPage.minimizeCliButton);
await t.click(cliPage.cliExpandButton);
//Verify cli results history
await t.expect(cliPage.cliCommandExecuted.textContent).eql(command, 'CLI results history persists after reopening');
});
test
.meta({ rte: rte.standalone })
('Verify that user can see CLI is minimized when he clicks the "minimize" button', async t => {
Expand Down Expand Up @@ -81,7 +87,7 @@ test
await deleteDatabase(ossStandaloneConfig.databaseName);
})
('Verify that user can repeat commands by entering a number of repeats before the Redis command in CLI', async t => {
chance.word({ length: 20 });
keyName = chance.word({ length: 20 });
const command = `SET ${keyName} a`;
const repeats = 10;
//Open CLI and run command with repeats
Expand All @@ -91,3 +97,36 @@ test
//Verify result
await t.expect(cliPage.cliOutputResponseSuccess.count).eql(repeats, `CLI contains ${repeats} results`);
});
test
.meta({ rte: rte.standalone })
.after(async () => {
//Clear database and delete
await browserPage.deleteKeyByName(keyName);
await deleteDatabase(ossStandaloneConfig.databaseName);
})
('Verify that user can run command json.get and see JSON object with escaped quotes (\" instead of ")', async t => {
keyName = chance.word({ length: 20 });
const jsonValueCli = '"{\\"name\\":\\"xyz\\"}"';
//Add Json key with json object
await browserPage.addJsonKey(keyName, keyTTL, jsonValue);
const command = `JSON.GET ${keyName}`;
//Open CLI and run command
await t.click(cliPage.cliExpandButton);
await t.typeText(cliPage.cliCommandInput, command);
await t.pressKey('enter');
//Verify result
//const commandResult = jsonValue.replace(/"/g, '\\"');
await t.expect(cliPage.cliOutputResponseSuccess.innerText).eql(jsonValueCli, 'The user can see JSON object with escaped quotes');
});
test
.meta({ rte: rte.standalone })
.after(async () => {
//Delete database
await deleteDatabase(ossStandaloneConfig.databaseName);
})
('Verify that user can see DB endpoint in the header of CLI', async t => {
const databaseEndpoint = `${ossStandaloneConfig.host}:${ossStandaloneConfig.port}`;
//Open CLI and check endpoint
await t.click(cliPage.cliExpandButton);
await t.expect(cliPage.cliEndpoint.textContent).eql(databaseEndpoint, 'The user can see DB endpoint in the header of CLI');
});
38 changes: 38 additions & 0 deletions tests/e2e/tests/regression/database/edit-db.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { acceptLicenseTermsAndAddDatabase, deleteDatabase } from '../../../helpers/database';
import { MyRedisDatabasePage } from '../../../pageObjects';
import {
commonUrl,
ossStandaloneConfig
} from '../../../helpers/conf';
import { rte } from '../../../helpers/constants';
import { Chance } from 'chance';

const chance = new Chance();
const myRedisDatabasePage = new MyRedisDatabasePage();

const newDatabaseName = chance.word({ length: 10 });

fixture `List of Databases`
.meta({ type: 'regression' })
.page(commonUrl)
.beforeEach(async () => {
await acceptLicenseTermsAndAddDatabase(ossStandaloneConfig, ossStandaloneConfig.databaseName);
})
test
.meta({ rte: rte.standalone })
.after(async () => {
//Delete database
await deleteDatabase(newDatabaseName);
})
('Verify that user can edit DB alias of Standalone DB', async t => {
await t.click(myRedisDatabasePage.myRedisDBButton);
//Edit alias of added database
await myRedisDatabasePage.clickOnEditDBByName(ossStandaloneConfig.databaseName);
await t.click(myRedisDatabasePage.editAliasButton);
await t.typeText(myRedisDatabasePage.aliasInput, newDatabaseName, { replace: true });
await t.click(myRedisDatabasePage.applyButton);
await t.click(myRedisDatabasePage.submitChangesButton);
//Verify that database has new alias
await t.expect(myRedisDatabasePage.dbNameList.withExactText(newDatabaseName).exists).ok('The database with new alias is in the list', { timeout: 60000 });
await t.expect(myRedisDatabasePage.dbNameList.withExactText(ossStandaloneConfig.databaseName).exists).notOk('The database with previous alias is not in the list', { timeout: 60000 });
});
14 changes: 14 additions & 0 deletions tests/e2e/tests/regression/workbench/scripting-area.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,17 @@ test
//Check the command result
await workbenchPage.checkWorkbenchCommandResult(command, result);
});
test
.meta({ rte: rte.standalone })
.after(async() => {
//Delete database
await deleteDatabase(ossStandaloneConfig.databaseName);
})
('Verify that user can use Ctrl + Enter to run the query in Workbench', async t => {
const command = 'FT._LIST';
//Type command and use Ctrl + Enter
await t.typeText(workbenchPage.queryInput, command, { replace: true });
await t.pressKey('ctrl+enter');
//Check that command is in results
await t.expect(await workbenchPage.queryCardCommand.withExactText(command).exists).ok('The user can use Ctrl + Enter to run the query');
});