Skip to content

Commit 66b650c

Browse files
e2e - Command results at Workbench
1 parent 8962585 commit 66b650c

File tree

7 files changed

+95
-6
lines changed

7 files changed

+95
-6
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export class MyRedisDatabasePage {
5858

5959
//Delete all the databases from the list
6060
async deleteAllDatabases(): Promise<void> {
61+
await t.click(this.myRedisDBButton);
6162
const dbNames = this.tableRowContent;
6263
const count = await dbNames.count;
6364
if(count > 1) {

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export class WorkbenchPage {
88
cssDeleteCommandButton: string
99
cssQueryCardOutputResponceSuccess: string
1010
cssTableViewTypeOption: string
11+
cssQueryTextResult: string
12+
cssQueryTableResult: string
1113
//------------------------------------------------------------------------------------------
1214
//DECLARATION OF TYPES: DOM ELEMENTS and UI COMPONENTS
1315
//*Assign the 'Selector' type to any element/component nested within the constructor.
@@ -45,6 +47,7 @@ export class WorkbenchPage {
4547
internalLinkWorkingWithHashes: Selector
4648
preselectExactSearch: Selector
4749
preselectGroupBy: Selector
50+
tableViewTypeOption: Selector
4851

4952
constructor() {
5053
//CSS selectors
@@ -54,6 +57,8 @@ export class WorkbenchPage {
5457
this.cssDeleteCommandButton = '[data-testid=delete-command]';
5558
this.cssQueryCardOutputResponceSuccess = '[data-testid=query-card-output-response-success]';
5659
this.cssTableViewTypeOption = '[data-testid=view-type-selected-Plugin-redisearch__redisearch]';
60+
this.cssQueryTextResult = '[data-testid=query-cli-result]';
61+
this.cssQueryTableResult = '[data-testid^=query-table-result-]';
5762
//-------------------------------------------------------------------------------------------
5863
//DECLARATION OF SELECTORS
5964
//*Declare all elements/components of the relevant page.
@@ -68,6 +73,7 @@ export class WorkbenchPage {
6873
this.paginationButtonNext = Selector(this.cssSelectorPaginationButtonNext);
6974
this.selectViewType = Selector('[data-testid=select-view-type]');
7075
this.textViewTypeOption = Selector('[data-test-subj^=view-type-option-Text]');
76+
this.tableViewTypeOption = Selector('[data-test-subj^=view-type-option-Plugin]');
7177
this.preselectList = Selector('[data-testid*=preselect-List]');
7278
this.preselectIndexInfo = Selector('[data-testid*=preselect-Index]');
7379
this.preselectSearch = Selector('[data-testid=preselect-Search]');
@@ -83,7 +89,7 @@ export class WorkbenchPage {
8389
this.queryCardContainer = Selector('[data-testid^=query-card-container]');
8490
this.queryCardCommand = Selector('[data-testid=query-card-command]');
8591
this.queryTableResult = Selector('[data-testid^=query-table-result-]');
86-
this.queryTextResult = Selector('[data-testid=query-cli-result]');
92+
this.queryTextResult = Selector(this.cssQueryTextResult);
8793
this.queryColumns = Selector('[data-testid*=query-column-]');
8894
this.queryInputScriptArea = Selector('[data-testid=query-input-container] .view-line');
8995
this.overviewTotalKeys = Selector('[data-test-subj=overview-total-keys]');
@@ -111,6 +117,12 @@ export class WorkbenchPage {
111117
await t.click(this.textViewTypeOption);
112118
}
113119

120+
//Select Tab;e view option in Workbench results
121+
async selectViewTypeTable(): Promise<void>{
122+
await t.click(this.selectViewType);
123+
await t.click(this.tableViewTypeOption);
124+
}
125+
114126
/**
115127
* Send a command in Workbench
116128
* @param command The command

tests/e2e/tests/critical-path/browser/database-overview.e2e.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ fixture `Database overview`
3838
await t.pressKey('enter');
3939
await t.click(cliPage.cliCollapseButton);
4040
//Delete all databases
41-
await t.click(myRedisDatabasePage.myRedisDBButton);
4241
await myRedisDatabasePage.deleteAllDatabases();
4342
})
4443
test('Verify that user can see the list of Modules updated each time when he connects to the database', async t => {

tests/e2e/tests/critical-path/workbench/default-scripts-area.e2e.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ fixture `Default scripts area at Workbench`
3030
//Drop index and documents
3131
await workbenchPage.sendCommandInWorkbench('FT.DROPINDEX products DD');
3232
})
33-
test('Verify that user can edit and run automatically added "FT._LIST" and "FT.INFO {index}" scripts in Workbench and see the results', async t => {
33+
//skipped due the inaccessibility of the iframe
34+
test.skip('Verify that user can edit and run automatically added "FT._LIST" and "FT.INFO {index}" scripts in Workbench and see the results', async t => {
3435
const commandsForSend = [
3536
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
3637
'HMSET product:1 name "Apple Juice" ',

tests/e2e/tests/critical-path/workbench/index-schema.e2e.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ fixture `Index Schema at Workbench`
3434
//Drop index and documents
3535
await workbenchPage.sendCommandInWorkbench(`FT.DROPINDEX ${indexName} DD`);
3636
})
37-
test('Verify that user can open results in Text and Table views for FT.INFO for Hash in Workbench', async t => {
37+
//skipped due the inaccessibility of the iframe
38+
test.skip('Verify that user can open results in Text and Table views for FT.INFO for Hash in Workbench', async t => {
3839
const commandsForSend = [
3940
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
4041
`HMSET product:1 name "Apple Juice"`
@@ -53,7 +54,8 @@ test('Verify that user can open results in Text and Table views for FT.INFO for
5354
//Check that result is displayed in Text view
5455
await t.expect(workbenchPage.queryTextResult.exists).ok('The result is displayed in Text view');
5556
});
56-
test('Verify that user can open results in Text and Table views for FT.INFO for JSON in Workbench', async t => {
57+
//skipped due the inaccessibility of the iframe
58+
test.skip('Verify that user can open results in Text and Table views for FT.INFO for JSON in Workbench', async t => {
5759
const commandsForSend = [
5860
`FT.CREATE ${indexName} ON JSON SCHEMA $.user.name AS name TEXT $.user.tag AS country TAG`,
5961
`JSON.SET myDoc1 $ '{"user":{"name":"John Smith","tag":"foo,bar","hp":1000, "dmg":150}}'`

tests/e2e/tests/critical-path/workbench/json-workbench.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fixture `JSON verifications at Workbench`
3535
await workbenchPage.sendCommandInWorkbench(`FT.DROPINDEX ${indexName} DD`);
3636
})
3737
//skipped due the inaccessibility of the iframe
38-
test('Verify that user can see result in Table and Text view for JSON data types for FT.AGGREGATE command in Workbench', async t => {
38+
test.skip('Verify that user can see result in Table and Text view for JSON data types for FT.AGGREGATE command in Workbench', async t => {
3939
const commandsForSend = [
4040
`FT.CREATE ${indexName} ON JSON SCHEMA $.user.name AS name TEXT $.user.tag AS country TAG`,
4141
`JSON.SET myDoc1 $ '{"user":{"name":"John Smith","tag":"foo,bar","hp":1000, "dmg":150}}'`,
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import { addNewStandaloneDatabase } from '../../../helpers/database';
2+
import { WorkbenchPage } from '../../../pageObjects/workbench-page';
3+
import { MyRedisDatabasePage, UserAgreementPage, AddRedisDatabasePage } from '../../../pageObjects';
4+
import {
5+
commonUrl,
6+
ossStandaloneConfig
7+
} from '../../../helpers/conf';
8+
9+
const myRedisDatabasePage = new MyRedisDatabasePage();
10+
const userAgreementPage = new UserAgreementPage();
11+
const addRedisDatabasePage = new AddRedisDatabasePage();
12+
const workbenchPage = new WorkbenchPage();
13+
14+
const indexName = 'idx';
15+
const commandsForIndex = [
16+
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA price NUMERIC SORTABLE`,
17+
'HMSET product:1 price 20',
18+
'HMSET product:2 price 100'
19+
];
20+
21+
fixture `Command results at Workbench`
22+
.meta({type: 'regression'})
23+
.page(commonUrl)
24+
.beforeEach(async t => {
25+
await t.maximizeWindow();
26+
await userAgreementPage.acceptLicenseTerms();
27+
await t.expect(addRedisDatabasePage.addDatabaseButton.exists).ok('The add redis database view', {timeout: 20000});
28+
await addNewStandaloneDatabase(ossStandaloneConfig);
29+
//Connect to DB
30+
await myRedisDatabasePage.clickOnDBByName(ossStandaloneConfig.databaseName);
31+
//Add index and data
32+
await t.click(myRedisDatabasePage.workbenchButton);
33+
for(let command of commandsForIndex) {
34+
await workbenchPage.sendCommandInWorkbench(command);
35+
}
36+
})
37+
.afterEach(async t => {
38+
//Drop index and dbs
39+
await workbenchPage.sendCommandInWorkbench('FT.DROPINDEX products DD');
40+
await myRedisDatabasePage.deleteAllDatabases();
41+
})
42+
//skipped due the inaccessibility of the iframe
43+
test.skip('Verify that user can switches between Table and Text for FT.INFO and see results corresponding to their views', async t => {
44+
const infoCommand = `FT.INFO ${indexName}`;
45+
//Send FT.INFO and switch to Text view
46+
await workbenchPage.sendCommandInWorkbench(infoCommand);
47+
await workbenchPage.selectViewTypeText();
48+
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTextResult).exists).ok(`The text view is switched for command FT.INFO`);
49+
//Switch to Table view and check result
50+
await workbenchPage.selectViewTypeTable();
51+
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTableResult).exists).ok(`The table view is switched for command FT.INFO`);
52+
});
53+
//skipped due the inaccessibility of the iframe
54+
test.skip('Verify that user can switches between Table and Text for FT.SEARCH and see results corresponding to their views', async t => {
55+
const searchCommand = `FT.SEARCH ${indexName} *`;
56+
//Send FT.SEARCH and switch to Text view
57+
await workbenchPage.sendCommandInWorkbench(searchCommand);
58+
await workbenchPage.selectViewTypeText();
59+
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTextResult).visible).ok(`The text view is switched for command FT.SEARCH`);
60+
//Switch to Table view and check result
61+
await workbenchPage.selectViewTypeTable();
62+
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTableResult).exists).ok(`The table view is switched for command FT.SEARCH`);
63+
});
64+
//skipped due the inaccessibility of the iframe
65+
test.skip('Verify that user can switches between Table and Text for FT.AGGREGATE and see results corresponding to their views', async t => {
66+
const aggregateCommand = `FT.Aggregate ${indexName} * GROUPBY 0 REDUCE MAX 1 @price AS max_price`;
67+
//Send FT.AGGREGATE and switch to Text view
68+
await workbenchPage.sendCommandInWorkbench(aggregateCommand);
69+
await workbenchPage.selectViewTypeText();
70+
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTextResult).visible).ok(`The text view is switched for command FT.AGGREGATE`);
71+
//Switch to Table view and check result
72+
await workbenchPage.selectViewTypeTable();
73+
await t.expect(await workbenchPage.queryCardContainer.nth(0).find(workbenchPage.cssQueryTableResult).exists).ok(`The table view is switched for command FT.AGGREGATE`);
74+
});

0 commit comments

Comments
 (0)