Skip to content

Commit 8481cd1

Browse files
e2e - fix iframe tests
1 parent e60e4be commit 8481cd1

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

redisinsight/ui/src/components/query-card/QueryCardCliPlugin/QueryCardCliPlugin.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ const QueryCardCliPlugin = (props: Props) => {
164164
ref={pluginIframeRef}
165165
referrerPolicy="no-referrer"
166166
sandbox="allow-same-origin allow-scripts"
167+
data-testid="pluginIframe"
167168
/>
168169
{!!error && (
169170
<div className={styles.container}>

tests/e2e/pageObjects/workbench-page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class WorkbenchPage {
6767
this.paginationButtonPrevious = Selector(this.cssSelectorPaginationButtonPrevious);
6868
this.paginationButtonNext = Selector(this.cssSelectorPaginationButtonNext);
6969
this.selectViewType = Selector('[data-testid=select-view-type]');
70-
this.textViewTypeOption = Selector('[data-test-subj=view-type-option-Text]');
70+
this.textViewTypeOption = Selector('[data-test-subj^=view-type-option-Text]');
7171
this.preselectList = Selector('[data-testid*=preselect-List]');
7272
this.preselectIndexInfo = Selector('[data-testid*=preselect-Index]');
7373
this.preselectSearch = Selector('[data-testid=preselect-Search]');
@@ -94,7 +94,7 @@ export class WorkbenchPage {
9494
this.monacoCommandDetails = Selector('div.suggest-details-container');
9595
this.monacoCloseCommandDetails = Selector('span.codicon-close');
9696
this.monacoSuggestion = Selector('span.monaco-icon-name-container');
97-
this.iframe = Selector('.pluginIframe', { timeout: 90000 });
97+
this.iframe = Selector('[data-testid=pluginIframe]');
9898
}
9999

100100
/**

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ fixture `Default scripts area at Workbench`
3030
//Drop index and documents
3131
await workbenchPage.sendCommandInWorkbench('FT.DROPINDEX products DD');
3232
})
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 => {
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 => {
3534
const commandsForSend = [
3635
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
3736
'HMSET product:1 name "Apple Juice" ',
@@ -54,7 +53,9 @@ test.skip('Verify that user can edit and run automatically added "FT._LIST" and
5453
await t.pressKey('ctrl+a delete');
5554
await workbenchPage.sendCommandInWorkbench(addedScript);
5655
//Check the FT.INFO result
56+
await t.switchToIframe(workbenchPage.iframe);
5757
await t.expect(workbenchPage.queryColumns.textContent).contains('name', 'The result of the FT.INFO command');
58+
await t.switchToMainWindow();
5859
});
5960
//skipped due the inaccessibility of the iframe
6061
test.skip('Verify that user can edit and run automatically added "Search" script in Workbench and see the results', async t => {
@@ -72,10 +73,12 @@ test.skip('Verify that user can edit and run automatically added "Search" script
7273
await t.pressKey('ctrl+a delete');
7374
await workbenchPage.sendCommandInWorkbench(searchCommand);
7475
//Check the FT.SEARCH result
76+
await t.switchToIframe(workbenchPage.iframe);
7577
const key = workbenchPage.queryTableResult.withText('product:1');
7678
const name = workbenchPage.queryTableResult.withText('Apple Juice');
7779
await t.expect(key.exists).ok('The added key is in the Search result');
7880
await t.expect(name.exists).ok('The added key name field is in the Search result');
81+
await t.switchToMainWindow();
7982
});
8083
//skipped due the inaccessibility of the iframe
8184
test.skip('Verify that user can edit and run automatically added "Aggregate" script in Workbench and see the results', async t => {
@@ -94,8 +97,10 @@ test.skip('Verify that user can edit and run automatically added "Aggregate" scr
9497
await t.pressKey('ctrl+a delete');
9598
await workbenchPage.sendCommandInWorkbench(searchCommand);
9699
//Check the FT.Aggregate result
100+
await t.switchToIframe(workbenchPage.iframe);
97101
await t.expect(workbenchPage.queryTableResult.textContent).contains(aggregationResultField, 'The aggregation field name is in the Search result');
98102
await t.expect(workbenchPage.queryTableResult.textContent).contains('100', 'The aggregation max value is in the Search result');
103+
await t.switchToMainWindow();
99104
});
100105
test('Verify that when the “Manual” option clicked, user can see the Editor is automatically prepopulated with the information', async t => {
101106
const information = [

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ fixture `Index Schema at Workbench`
3434
//Drop index and documents
3535
await workbenchPage.sendCommandInWorkbench(`FT.DROPINDEX ${indexName} DD`);
3636
})
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 => {
37+
test('Verify that user can open results in Text and Table views for FT.INFO for Hash in Workbench', async t => {
3938
const commandsForSend = [
4039
`FT.CREATE ${indexName} ON HASH PREFIX 1 product: SCHEMA name TEXT`,
4140
`HMSET product:1 name "Apple Juice"`
@@ -49,12 +48,12 @@ test.skip('Verify that user can open results in Text and Table views for FT.INFO
4948
await t.switchToIframe(workbenchPage.iframe);
5049
await t.expect(workbenchPage.queryTableResult.exists).ok('The result is displayed in Table view');
5150
//Select Text view type
51+
await t.switchToMainWindow();
5252
await workbenchPage.selectViewTypeText();
5353
//Check that result is displayed in Text view
5454
await t.expect(workbenchPage.queryTextResult.exists).ok('The result is displayed in Text view');
5555
});
56-
//skipped due the inaccessibility of the iframe
57-
test.skip('Verify that user can open results in Text and Table views for FT.INFO for JSON in Workbench', async t => {
56+
test('Verify that user can open results in Text and Table views for FT.INFO for JSON in Workbench', async t => {
5857
const commandsForSend = [
5958
`FT.CREATE ${indexName} ON JSON SCHEMA $.user.name AS name TEXT $.user.tag AS country TAG`,
6059
`JSON.SET myDoc1 $ '{"user":{"name":"John Smith","tag":"foo,bar","hp":1000, "dmg":150}}'`
@@ -65,8 +64,10 @@ test.skip('Verify that user can open results in Text and Table views for FT.INFO
6564
//Send search command
6665
await workbenchPage.sendCommandInWorkbench(searchCommand);
6766
//Check that result is displayed in Table view
67+
await t.switchToIframe(workbenchPage.iframe);
6868
await t.expect(workbenchPage.queryTableResult.exists).ok('The result is displayed in Table view');
6969
//Select Text view type
70+
await t.switchToMainWindow();
7071
await workbenchPage.selectViewTypeText();
7172
//Check that result is displayed in Text view
7273
await t.expect(workbenchPage.queryTextResult.exists).ok('The result is displayed in Text view');

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

Lines changed: 3 additions & 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.skip('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('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}}'`,
@@ -47,8 +47,10 @@ test.skip('Verify that user can see result in Table and Text view for JSON data
4747
//Send search command
4848
await workbenchPage.sendCommandInWorkbench(searchCommand);
4949
//Check that result is displayed in Table view
50+
await t.switchToIframe(workbenchPage.iframe);
5051
await t.expect(workbenchPage.queryTableResult.exists).ok('The result is displayed in Table view');
5152
//Select Text view type
53+
await t.switchToMainWindow();
5254
await workbenchPage.selectViewTypeText();
5355
//Check that result is displayed in Text view
5456
await t.expect(workbenchPage.queryTextResult.exists).ok('The result is displayed in Text view');

tests/e2e/tests/critical-path/workbench/scripting-area.e2e.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,13 @@ test.skip('Verify that user when he have more than 10 results can request to vie
8080
//Get needed container
8181
const containerOfCommand = await workbenchPage.getCardContainerByCommand(searchCommand);
8282
//Verify that we have pagination buttons
83+
await t.switchToIframe(workbenchPage.iframe);
8384
await t.expect(containerOfCommand.find(workbenchPage.cssSelectorPaginationButtonPrevious).exists)
8485
.ok('Pagination previous button exists');
8586
await t.expect(containerOfCommand.find(workbenchPage.cssSelectorPaginationButtonNext).exists)
8687
.ok('Pagination next button exists');
8788
//Drop index and documents
89+
await t.switchToMainWindow();
8890
await workbenchPage.sendCommandInWorkbench('FT.DROPINDEX products DD');
8991
});
9092
//skipped due the inaccessibility of the iframe
@@ -105,8 +107,10 @@ test.skip
105107
//Send search command
106108
await workbenchPage.sendCommandInWorkbench(searchCommand);
107109
//Check that result is displayed in Table view
110+
await t.switchToIframe(workbenchPage.iframe);
108111
await t.expect(workbenchPage.queryTableResult.exists).ok('The result is displayed in Table view');
109112
//Select Text view type
113+
await t.switchToMainWindow();
110114
await workbenchPage.selectViewTypeText();
111115
//Check that result is displayed in Text view
112116
await t.expect(workbenchPage.queryTextResult.exists).ok('The result is displayed in Text view');

0 commit comments

Comments
 (0)