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 @@ -448,7 +448,7 @@ const AddStandaloneForm = (props: Props) => {
label={(
<EuiText color="subdued" size="s">
Connection Type:
<EuiTextColor color="default" className={styles.dbInfoListValue}>
<EuiTextColor color="default" className={styles.dbInfoListValue} data-testid="connection-type">
{capitalize(connectionType)}
</EuiTextColor>
</EuiText>
Expand Down
50 changes: 50 additions & 0 deletions tests/e2e/common-actions/databases-actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { t } from 'testcafe';
import { MyRedisDatabasePage } from '../pageObjects';

const myRedisDatabasePage = new MyRedisDatabasePage();

export class DatabasesActions {
/**
* Verify that databases are displayed
* @param databases The list of databases to verify
*/
async verifyDatabasesDisplayed(databases: string[]): Promise<void> {
for (const db of databases) {
const databaseName = myRedisDatabasePage.dbNameList.withText(db);
await t.expect(databaseName.exists).ok(`"${db}" database doesn't exist`);
}
}

/**
* Import database using file
* @param fileParameters The arguments of imported file
*/
async importDatabase(fileParameters: ImportDatabaseParameters): Promise<void> {
await t
.click(myRedisDatabasePage.importDatabasesBtn)
.setFilesToUpload(myRedisDatabasePage.importDatabaseInput, [fileParameters.path])
.click(myRedisDatabasePage.submitImportBtn)
.expect(myRedisDatabasePage.successImportMessage.exists).ok(`Successfully added ${fileParameters.type} databases message not displayed`);
}

}

/**
* Import database parameters
* @param path The path to file
* @param type The type of application
* @param dbNames The names of databases
* @param userName The username of db
* @param password The password of db
* @param connectionType The connection type of db
* @param fileName The file name
*/
export type ImportDatabaseParameters = {
path: string,
type?: string,
dbNames?: string[],
userName?: string,
password?: string,
connectionType?: string,
fileName?: string
};
14 changes: 14 additions & 0 deletions tests/e2e/helpers/api/api-database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,20 @@ export async function deleteStandaloneDatabaseApi(databaseParameters: AddNewData
.expect(200);
}

/**
* Delete Standalone databases using their names through api
* @param databaseNames Databases names
*/
export async function deleteStandaloneDatabasesByNamesApi(databaseNames: string[]): Promise<void> {
databaseNames.forEach(async databaseName => {
const databaseId = await getDatabaseByName(databaseName);
await request(endpoint).delete('/databases')
.send({ 'ids': [`${databaseId}`] })
.set('Accept', 'application/json')
.expect(200);
});
}

/**
* Delete database from OSS Cluster through api
* @param databaseParameters The database parameters
Expand Down
2 changes: 2 additions & 0 deletions tests/e2e/pageObjects/add-redis-database-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class AddRedisDatabasePage {
sentinelDatabaseNavigation = Selector('[data-testid=database-nav-group]');
cloneSentinelDatabaseNavigation = Selector('[data-testid=database-nav-group-clone]');
cancelButton = Selector('[data-testid=btn-cancel]');
showPasswordBtn = Selector('[aria-label^="Show password"]');
//TEXT INPUTS (also referred to as 'Text fields')
hostInput = Selector('[data-testid=host]');
portInput = Selector('[data-testid=port]');
Expand All @@ -42,6 +43,7 @@ export class AddRedisDatabasePage {
databaseIndexMessage = Selector('[data-testid=db-index-message]');
primaryGroupNameInput = Selector('[data-testid=primary-group]');
masterGroupPassword = Selector('[data-testid=sentinel-master-password]');
connectionType = Selector('[data-testid=connection-type]');
//Links
buildFromSource = Selector('a').withExactText('Build from source');
buildFromDocker = Selector('a').withExactText('Docker');
Expand Down
12 changes: 11 additions & 1 deletion tests/e2e/pageObjects/my-redis-databases-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class MyRedisDatabasePage {
githubButton = Selector('[data-testid=github-repo-icon]');
browserButton = Selector('[data-testid=browser-page-btn]');
pubSubButton = Selector('[data-testid=pub-sub-page-btn]');
myRedisDBButton = Selector('[data-test-subj=home-page-btn]');
myRedisDBButton = Selector('[data-test-subj=home-page-btn]', { timeout: 1000 });
deleteDatabaseButton = Selector('[data-testid^=delete-instance-]');
confirmDeleteButton = Selector('[data-testid^=delete-instance-]').withExactText('Remove');
toastCloseButton = Selector('[data-test-subj=toastCloseButton]');
Expand All @@ -30,6 +30,11 @@ export class MyRedisDatabasePage {
sortByHostAndPort = Selector('span').withAttribute('title', 'Host:Port');
sortByConnectionType = Selector('span').withAttribute('title', 'Connection Type');
sortByLastConnection = Selector('span').withAttribute('title', 'Last connection');
importDatabasesBtn = Selector('[data-testid=import-dbs-btn]');
submitImportBtn = Selector('[data-testid=submit-btn]');
closeDialogBtn = Selector('[aria-label="Closes this modal window"]');
okDialogBtn = Selector('[data-testid=ok-btn]');
removeImportedFileBtn = Selector('[aria-label="Clear selected files"]');
//CHECKBOXES
selectAllCheckbox = Selector('[data-test-subj=checkboxSelectAll]');
//ICONS
Expand All @@ -46,6 +51,7 @@ export class MyRedisDatabasePage {
//TEXT INPUTS (also referred to as 'Text fields')
aliasInput = Selector('[data-testid=alias-input]');
searchInput = Selector('[data-testid=search-database-list]');
importDatabaseInput = Selector('[data-testid=import-databases-input-file]');
//TEXT ELEMENTS
moduleTooltip = Selector('.euiToolTipPopover');
moduleQuantifier = Selector('[data-testid=_module]');
Expand All @@ -55,6 +61,10 @@ export class MyRedisDatabasePage {
hostPort = Selector('[data-testid=host-port]');
noResultsFoundMessage = Selector('div').withExactText('No results found');
noResultsFoundText = Selector('div').withExactText('No databases matched your search. Try reducing the criteria.');
failedImportMessage = Selector('[data-testid=result-failed]');
successImportMessage = Selector('[data-testid=result-success]');
// DIALOG
importDbDialog = Selector('[data-testid=import-dbs-dialog]');

/**
* Click on the database by name
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/test-data/ardm-valid.ano
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
W3siaG9zdCI6ImxvY2FsaG9zdCIsInBvcnQiOiI2Mzc5IiwiYXV0aCI6InBhc3MiLCJ1c2VybmFtZSI6InVzZXJuYW1lVGVzdCIsIm5hbWUiOiJhcmRtV2l0aFBhc3NBbmRVc2VybmFtZSIsInNlcGFyYXRvciI6IjoiLCJjbHVzdGVyIjpmYWxzZSwia2V5IjoiMTY1MDM3MzUyNTY1MV9naHFwciIsIm9yZGVyIjowfSx7Imhvc3QiOiJhcmRtTm9OYW1lIiwicG9ydCI6IjEyMDAxIiwiYXV0aCI6IiIsInVzZXJuYW1lIjoiIiwic2VwYXJhdG9yIjoiOiIsImNsdXN0ZXIiOmZhbHNlLCJrZXkiOiIxNjUwODk3NjIxNzU0X2I1bjB2Iiwib3JkZXIiOjF9XQ==
171 changes: 171 additions & 0 deletions tests/e2e/test-data/racompass-invalid.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
[
{
"srvRecords": [
{
"priority": null,
"weight": null,
"port": null,
"name": null
}
],
"useSRVRecords": false,
"natMaps": [
{
"privateHost": null,
"privatePort": null,
"publicHost": null,
"publicPort": null
}
],
"enableNatMaps": false,
"clusterOptions": {
"slotsRefreshInterval": 5000,
"slotsRefreshTimeout": 1000,
"retryDelayOnTryAgain": 100,
"retryDelayOnClusterDown": 100,
"retryDelayOnFailover": 100,
"retryDelayOnMoved": 0,
"maxRedirections": 16,
"dnsLookup": false,
"scaleReads": "master",
"startupNodes": [
{
"host": null,
"port": null
}
]
},
"enableStartupNodes": false,
"sentinelOptions": {
"tls": {
"key": null,
"keyBookmark": null,
"ca": null,
"caBookmark": null,
"cert": null,
"certBookmark": null
},
"preferredSlaves": [
{
"host": null,
"port": null,
"priority": null
}
],
"role": null,
"sentinelPassword": null,
"name": null
},
"enablePreferredSlaves": false,
"sshKeyPassphrase": null,
"sshKeyFileBookmark": null,
"sshKeyFile": null,
"sshUser": null,
"sshPort": null,
"sshHost": null,
"ssh": false,
"caCertBookmark": null,
"caCert": null,
"certificateBookmark": null,
"certificate": null,
"keyFileBookmark": null,
"keyFile": null,
"ssl": false,
"default": false,
"star": false,
"totalDb": 16,
"db": 0,
"password": "",
"color": "#4B5563",
"host": "localhost",
"keyPrefix": null,
"type": "standalone",
"id": "f99a5d6d-daf4-489c-885b-6f8e411adbc9"
},
{
"srvRecords": [
{
"priority": null,
"weight": null,
"port": null,
"name": null
}
],
"useSRVRecords": false,
"natMaps": [
{
"privateHost": null,
"privatePort": null,
"publicHost": null,
"publicPort": null
}
],
"enableNatMaps": false,
"clusterOptions": {
"slotsRefreshInterval": 5000,
"slotsRefreshTimeout": 1000,
"retryDelayOnTryAgain": 100,
"retryDelayOnClusterDown": 100,
"retryDelayOnFailover": 100,
"retryDelayOnMoved": 0,
"maxRedirections": 16,
"dnsLookup": false,
"scaleReads": "master",
"startupNodes": [
{
"host": null,
"port": null
}
]
},
"enableStartupNodes": false,
"sentinelOptions": {
"tls": {
"key": null,
"keyBookmark": null,
"ca": null,
"caBookmark": null,
"cert": null,
"certBookmark": null
},
"preferredSlaves": [
{
"host": null,
"port": null,
"priority": null
}
],
"role": null,
"sentinelPassword": null,
"name": null
},
"enablePreferredSlaves": false,
"sshKeyPassphrase": null,
"sshKeyFileBookmark": null,
"sshKeyFile": null,
"sshUser": null,
"sshPort": null,
"sshHost": null,
"ssh": false,
"caCertBookmark": null,
"caCert": null,
"certificateBookmark": null,
"certificate": null,
"keyFileBookmark": null,
"keyFile": null,
"ssl": false,
"default": false,
"star": false,
"totalDb": 16,
"db": 1,
"password": "vfsd",
"color": "#4B5563",
"port": 1111,
"keyPrefix": null,
"type": "standalone",
"connectionName": "vd",
"id": "f99a5d6d-daf4-489c-885b-6f8e411adbc9",
"cluster": true,
"name": "vd long host"
}
]
Loading