Skip to content

Commit 8b29713

Browse files
authored
updated workbench flakey test to match gitfram (#1740)
Signed-off-by: sumukhswamy <sumukhhs@amazon.com>
1 parent 0e90963 commit 8b29713

File tree

2 files changed

+37
-36
lines changed
  • cypress

2 files changed

+37
-36
lines changed

cypress/integration/plugins/query-workbench-dashboards/ui.spec.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ describe('Test PPL UI', () => {
4242
beforeEach(() => {
4343
cy.visit('app/opensearch-query-workbench');
4444
cy.wait(delay);
45-
cy.get('[data-test-subj="workbench-ppl-language-button"]').click({ force: true });
45+
cy.get('.euiToggle__input[title=PPL]').click({ force: true });
4646
cy.wait(delay);
4747
});
4848

@@ -117,7 +117,7 @@ describe('Test SQL UI', () => {
117117
beforeEach(() => {
118118
cy.visit('app/opensearch-query-workbench');
119119
cy.wait(delay);
120-
cy.get('[data-test-subj="workbench-sql-language-button"]').click({ force: true });
120+
cy.get('.euiToggle__input[title=SQL]').click({ force: true });
121121
cy.wait(delay);
122122
});
123123

@@ -162,7 +162,7 @@ describe('Test SQL UI', () => {
162162
cy.get('.euiButton__text').contains('Explain').click({ force: true });
163163
cy.wait(delay);
164164

165-
cy.contains('OpenSearchQueryRequest(indexName=accounts')
165+
cy.contains('OpenSearchQueryRequest(indexName=accounts');
166166
});
167167

168168
it('Test Clear button', () => {
@@ -203,10 +203,14 @@ describe('Test and verify SQL downloads', () => {
203203
'osd-xsrf': true,
204204
},
205205
body: {
206-
query: 'select * from accounts where balance > 49500',
206+
query:
207+
'select * from accounts where balance > 49500 order by account_number',
207208
},
208209
}).then((response) => {
209-
if (title === 'Download and verify CSV' || title === 'Download and verify Text') {
210+
if (
211+
title === 'Download and verify CSV' ||
212+
title === 'Download and verify Text'
213+
) {
210214
expect(response.body.data.body).to.have.string(files[file]);
211215
} else {
212216
expect(response.body.data.resp).to.have.string(files[file]);
@@ -220,7 +224,7 @@ describe('Test table display', () => {
220224
beforeEach(() => {
221225
cy.visit('app/opensearch-query-workbench');
222226
cy.wait(delay);
223-
cy.get('[data-test-subj="workbench-sql-language-button"]').click({ force: true });
227+
cy.get('.euiToggle__input[title=SQL]').click({ force: true });
224228
cy.wait(delay);
225229
cy.get('textarea.ace_text-input')
226230
.eq(0)
@@ -260,6 +264,6 @@ describe('Test table display', () => {
260264

261265
cy.get('button.euiLink').eq(2).click({ force: true });
262266
cy.wait(delay);
263-
cy.contains('comment_2_1');
267+
cy.contains('message');
264268
});
265269
});

cypress/utils/plugins/query-workbench-dashboards/constants.js

+26-29
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
76
export const delay = 1000;
87

98
export const testDataSet = [
@@ -13,30 +12,30 @@ export const testDataSet = [
1312
},
1413
{
1514
url: 'https://raw.githubusercontent.com/opensearch-project/sql/main/integ-test/src/test/resources/employee_nested.json',
16-
index: 'employee_nested'
17-
}
18-
]
15+
index: 'employee_nested',
16+
},
17+
];
1918

2019
export const verifyDownloadData = [
2120
{
2221
title: 'Download and verify JSON',
2322
url: 'api/sql_console/sqljson',
24-
file: 'JSONFile'
23+
file: 'JSONFile',
2524
},
2625
{
2726
title: 'Download and verify JDBC',
2827
url: 'api/sql_console/sqlquery',
29-
file: 'JDBCFile'
28+
file: 'JDBCFile',
3029
},
3130
{
3231
title: 'Download and verify CSV',
3332
url: 'api/sql_console/sqlcsv',
34-
file: 'CSVFile'
33+
file: 'CSVFile',
3534
},
3635
{
3736
title: 'Download and verify Text',
3837
url: 'api/sql_console/sqltext',
39-
file: 'TextFile'
38+
file: 'TextFile',
4039
},
4140
];
4241

@@ -45,55 +44,53 @@ export const testQueries = [
4544
title: 'Test GROUP BY',
4645
query: 'select count(*) from accounts group by gender;',
4746
cell_idx: 3,
48-
expected_string: '493'
47+
expected_string: '493',
4948
},
5049
{
5150
title: 'Test GROUP BY with aliases and scalar function',
5251
query: 'SELECT ABS(age) AS a FROM accounts GROUP BY ABS(age);',
5352
cell_idx: 17,
54-
expected_string: '27'
53+
expected_string: '27',
5554
},
5655
{
5756
title: 'Test GROUP BY and HAVING',
58-
query: 'SELECT age, MAX(balance) FROM accounts GROUP BY age HAVING MIN(balance) > 3000;',
57+
query:
58+
'SELECT age, MAX(balance) FROM accounts GROUP BY age HAVING MIN(balance) > 3000;',
5959
cell_idx: 5,
60-
expected_string: '49119'
60+
expected_string: '49119',
6161
},
6262
{
6363
title: 'Test ORDER BY',
6464
query: 'SELECT account_number FROM accounts ORDER BY account_number DESC;',
6565
cell_idx: 5,
66-
expected_string: '998'
66+
expected_string: '998',
6767
},
6868
{
6969
title: 'Test JOIN',
70-
query: 'select a.account_number, a.firstname, a.lastname, e.id, e.name from accounts a join employee_nested e order by a.account_number;',
70+
query:
71+
'select a.account_number, a.firstname, a.lastname, e.id, e.name from accounts a join employee_nested e order by a.account_number;',
7172
cell_idx: 45,
72-
expected_string: 'Duke'
73+
expected_string: 'Duke',
7374
},
7475
];
7576

7677
export const files = {
77-
JSONFile:
78-
`"hits":{"total":{"value":7,"relation":"eq"},"max_score":0,"hits":[{"_index":"accounts","_type":"_doc","_id":"842","_score":0,"_source":{"account_number":842,"balance":49587,"firstname":"Meagan","lastname":"Buckner","age":23,"gender":"F","address":"833 Bushwick Court","employer":"Biospan","email":"meaganbuckner@biospan.com","city":"Craig","state":"TX"}},{"_index":"accounts","_type":"_doc","_id":"854","_score":0,"_source":{"account_number":854,"balance":49795,"firstname":"Jimenez","lastname":"Barry","age":25,"gender":"F","address":"603 Cooper Street","employer":"Verton","email":"jimenezbarry@verton.com","city":"Moscow","state":"AL"}},{"_index":"accounts","_type":"_doc","_id":"97","_score":0,"_source":{"account_number":97,"balance":49671,"firstname":"Karen","lastname":"Trujillo","age":40,"gender":"F","address":"512 Cumberland Walk","employer":"Tsunamia","email":"karentrujillo@tsunamia.com","city":"Fredericktown","state":"MO"}},{"_index":"accounts","_type":"_doc","_id":"168","_score":0,"_source":{"account_number":168,"balance":49568,"firstname":"Carissa","lastname":"Simon","age":20,"gender":"M","address":"975 Flatbush Avenue","employer":"Zillacom","email":"carissasimon@zillacom.com","city":"Neibert","state":"IL"}},{"_index":"accounts","_type":"_doc","_id":"240","_score":0,"_source":{"account_number":240,"balance":49741,"firstname":"Oconnor","lastname":"Clay","age":35,"gender":"F","address":"659 Highland Boulevard","employer":"Franscene","email":"oconnorclay@franscene.com","city":"Kilbourne","state":"NH"}},{"_index":"accounts","_type":"_doc","_id":"803","_score":0,"_source":{"account_number":803,"balance":49567,"firstname":"Marissa","lastname":"Spears","age":25,"gender":"M","address":"963 Highland Avenue","employer":"Centregy","email":"marissaspears@centregy.com","city":"Bloomington","state":"MS"}},{"_index":"accounts","_type":"_doc","_id":"248","_score":0,"_source":{"account_number":248,"balance":49989,"firstname":"West","lastname":"England","age":36,"gender":"M","address":"717 Hendrickson Place","employer":"Obliq","email":"westengland@obliq.com","city":"Maury","state":"WA"}}]}`,
79-
JDBCFile:
80-
`{"schema":[{"name":"account_number","type":"long"},{"name":"firstname","type":"text"},{"name":"address","type":"text"},{"name":"balance","type":"long"},{"name":"gender","type":"text"},{"name":"city","type":"text"},{"name":"employer","type":"text"},{"name":"state","type":"text"},{"name":"age","type":"long"},{"name":"email","type":"text"},{"name":"lastname","type":"text"}],"datarows":[[842,"Meagan","833 Bushwick Court",49587,"F","Craig","Biospan","TX",23,"meaganbuckner@biospan.com","Buckner"],[854,"Jimenez","603 Cooper Street",49795,"F","Moscow","Verton","AL",25,"jimenezbarry@verton.com","Barry"],[97,"Karen","512 Cumberland Walk",49671,"F","Fredericktown","Tsunamia","MO",40,"karentrujillo@tsunamia.com","Trujillo"],[168,"Carissa","975 Flatbush Avenue",49568,"M","Neibert","Zillacom","IL",20,"carissasimon@zillacom.com","Simon"],[240,"Oconnor","659 Highland Boulevard",49741,"F","Kilbourne","Franscene","NH",35,"oconnorclay@franscene.com","Clay"],[803,"Marissa","963 Highland Avenue",49567,"M","Bloomington","Centregy","MS",25,"marissaspears@centregy.com","Spears"],[248,"West","717 Hendrickson Place",49989,"M","Maury","Obliq","WA",36,"westengland@obliq.com","England"]],"total":7,"size":7,"status":200}`,
81-
CSVFile:
82-
`account_number,firstname,address,balance,gender,city,employer,state,age,email,lastname
83-
842,Meagan,833 Bushwick Court,49587,F,Craig,Biospan,TX,23,meaganbuckner@biospan.com,Buckner
84-
854,Jimenez,603 Cooper Street,49795,F,Moscow,Verton,AL,25,jimenezbarry@verton.com,Barry
78+
JSONFile: `[{"_index":"accounts","_type":"_doc","_id":"97","_score":null,"_source":{"account_number":97,"balance":49671,"firstname":"Karen","lastname":"Trujillo","age":40,"gender":"F","address":"512 Cumberland Walk","employer":"Tsunamia","email":"karentrujillo@tsunamia.com","city":"Fredericktown","state":"MO"},"sort":[97]},{"_index":"accounts","_type":"_doc","_id":"168","_score":null,"_source":{"account_number":168,"balance":49568,"firstname":"Carissa","lastname":"Simon","age":20,"gender":"M","address":"975 Flatbush Avenue","employer":"Zillacom","email":"carissasimon@zillacom.com","city":"Neibert","state":"IL"},"sort":[168]},{"_index":"accounts","_type":"_doc","_id":"240","_score":null,"_source":{"account_number":240,"balance":49741,"firstname":"Oconnor","lastname":"Clay","age":35,"gender":"F","address":"659 Highland Boulevard","employer":"Franscene","email":"oconnorclay@franscene.com","city":"Kilbourne","state":"NH"},"sort":[240]},{"_index":"accounts","_type":"_doc","_id":"248","_score":null,"_source":{"account_number":248,"balance":49989,"firstname":"West","lastname":"England","age":36,"gender":"M","address":"717 Hendrickson Place","employer":"Obliq","email":"westengland@obliq.com","city":"Maury","state":"WA"},"sort":[248]},{"_index":"accounts","_type":"_doc","_id":"803","_score":null,"_source":{"account_number":803,"balance":49567,"firstname":"Marissa","lastname":"Spears","age":25,"gender":"M","address":"963 Highland Avenue","employer":"Centregy","email":"marissaspears@centregy.com","city":"Bloomington","state":"MS"},"sort":[803]},{"_index":"accounts","_type":"_doc","_id":"842","_score":null,"_source":{"account_number":842,"balance":49587,"firstname":"Meagan","lastname":"Buckner","age":23,"gender":"F","address":"833 Bushwick Court","employer":"Biospan","email":"meaganbuckner@biospan.com","city":"Craig","state":"TX"},"sort":[842]},{"_index":"accounts","_type":"_doc","_id":"854","_score":null,"_source":{"account_number":854,"balance":49795,"firstname":"Jimenez","lastname":"Barry","age":25,"gender":"F","address":"603 Cooper Street","employer":"Verton","email":"jimenezbarry@verton.com","city":"Moscow","state":"AL"},"sort":[854]}]`,
79+
JDBCFile: `{"schema":[{"name":"account_number","type":"long"},{"name":"firstname","type":"text"},{"name":"address","type":"text"},{"name":"balance","type":"long"},{"name":"gender","type":"text"},{"name":"city","type":"text"},{"name":"employer","type":"text"},{"name":"state","type":"text"},{"name":"age","type":"long"},{"name":"email","type":"text"},{"name":"lastname","type":"text"}],"datarows":[[97,"Karen","512 Cumberland Walk",49671,"F","Fredericktown","Tsunamia","MO",40,"karentrujillo@tsunamia.com","Trujillo"],[168,"Carissa","975 Flatbush Avenue",49568,"M","Neibert","Zillacom","IL",20,"carissasimon@zillacom.com","Simon"],[240,"Oconnor","659 Highland Boulevard",49741,"F","Kilbourne","Franscene","NH",35,"oconnorclay@franscene.com","Clay"],[248,"West","717 Hendrickson Place",49989,"M","Maury","Obliq","WA",36,"westengland@obliq.com","England"],[803,"Marissa","963 Highland Avenue",49567,"M","Bloomington","Centregy","MS",25,"marissaspears@centregy.com","Spears"],[842,"Meagan","833 Bushwick Court",49587,"F","Craig","Biospan","TX",23,"meaganbuckner@biospan.com","Buckner"],[854,"Jimenez","603 Cooper Street",49795,"F","Moscow","Verton","AL",25,"jimenezbarry@verton.com","Barry"]],"total":7,"size":7,"status":200}`,
80+
CSVFile: `account_number,firstname,address,balance,gender,city,employer,state,age,email,lastname
8581
97,Karen,512 Cumberland Walk,49671,F,Fredericktown,Tsunamia,MO,40,karentrujillo@tsunamia.com,Trujillo
8682
168,Carissa,975 Flatbush Avenue,49568,M,Neibert,Zillacom,IL,20,carissasimon@zillacom.com,Simon
8783
240,Oconnor,659 Highland Boulevard,49741,F,Kilbourne,Franscene,NH,35,oconnorclay@franscene.com,Clay
84+
248,West,717 Hendrickson Place,49989,M,Maury,Obliq,WA,36,westengland@obliq.com,England
8885
803,Marissa,963 Highland Avenue,49567,M,Bloomington,Centregy,MS,25,marissaspears@centregy.com,Spears
89-
248,West,717 Hendrickson Place,49989,M,Maury,Obliq,WA,36,westengland@obliq.com,England`,
90-
TextFile:
91-
`account_number|firstname|address|balance|gender|city|employer|state|age|email|lastname
92-
842|Meagan|833 Bushwick Court|49587|F|Craig|Biospan|TX|23|meaganbuckner@biospan.com|Buckner
93-
854|Jimenez|603 Cooper Street|49795|F|Moscow|Verton|AL|25|jimenezbarry@verton.com|Barry
86+
842,Meagan,833 Bushwick Court,49587,F,Craig,Biospan,TX,23,meaganbuckner@biospan.com,Buckner
87+
854,Jimenez,603 Cooper Street,49795,F,Moscow,Verton,AL,25,jimenezbarry@verton.com,Barry`,
88+
TextFile: `account_number|firstname|address|balance|gender|city|employer|state|age|email|lastname
9489
97|Karen|512 Cumberland Walk|49671|F|Fredericktown|Tsunamia|MO|40|karentrujillo@tsunamia.com|Trujillo
9590
168|Carissa|975 Flatbush Avenue|49568|M|Neibert|Zillacom|IL|20|carissasimon@zillacom.com|Simon
9691
240|Oconnor|659 Highland Boulevard|49741|F|Kilbourne|Franscene|NH|35|oconnorclay@franscene.com|Clay
92+
248|West|717 Hendrickson Place|49989|M|Maury|Obliq|WA|36|westengland@obliq.com|England
9793
803|Marissa|963 Highland Avenue|49567|M|Bloomington|Centregy|MS|25|marissaspears@centregy.com|Spears
98-
248|West|717 Hendrickson Place|49989|M|Maury|Obliq|WA|36|westengland@obliq.com|England`,
94+
842|Meagan|833 Bushwick Court|49587|F|Craig|Biospan|TX|23|meaganbuckner@biospan.com|Buckner
95+
854|Jimenez|603 Cooper Street|49795|F|Moscow|Verton|AL|25|jimenezbarry@verton.com|Barry`,
9996
};

0 commit comments

Comments
 (0)