Skip to content

Commit

Permalink
add e2e tests for suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
sunker committed Aug 18, 2022
1 parent b429d3a commit aa75ed6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions cypress/integration/smoke.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,28 @@ e2e.scenario({
// Change database selection for query
e2eSelectors.ConfigEditor.database.input().click({ force: true });
e2e().contains('cloudtrail');
e2eSelectors.ConfigEditor.database.input().type('{selectall}cloudtrail{enter}');
e2eSelectors.ConfigEditor.database.input().type('{selectall}cloudtrail{enter} {enter}{enter}');

// Select a table from the explorer
e2eSelectors.ConfigEditor.table.input().click({ force: true });
e2eSelectors.ConfigEditor.table.wrapper().contains('cloudtrail_logs');
e2eSelectors.ConfigEditor.table.input().type('cloudtrail_logs').type('{enter}');

// The follwing section will verify that autocompletion in behaving as expected.
// Throughout the composition of the SQL query, the autocompletion engine will provide appropriate suggestions.
// In this test the first few suggestions are accepted by hitting enter, and that will create a basic query including
// suggestions that are resolved by the plugin such as tables and columns.
e2eSelectors.QueryEditor.CodeEditor.container()
.click({ force: true })
.type(`s{enter}{enter}{enter}{enter} {enter}{enter}`, { delay: 2000 });
e2eSelectors.QueryEditor.CodeEditor.container().contains(
'SELECT * FROM cloudtrail_logs GROUP BY additionaleventdata'
);

e2eSelectors.QueryEditor.CodeEditor.container()
.click({ force: true })
.type(
`
`{selectall}
SELECT $__parseTime(eventtime, 'yyyy-MM-dd''T''HH:mm:ss''Z'), sum(cast(json_extract_scalar(additionaleventdata, '$.bytesTransferredOut') as real)) AS bytes
FROM $__table WHERE additionaleventdata IS NOT NULL AND json_extract_scalar(additionaleventdata, '$.bytesTransferredOut') IS NOT NULL AND $__timeFilter(eventtime, 'yyyy-MM-dd''T''HH:mm:ss''Z')
GROUP BY 1
Expand Down

0 comments on commit aa75ed6

Please sign in to comment.