Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add E2E test for Statement #1196

Merged
merged 51 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
b880717
test: add use database filter and search function
Jan 18, 2022
24a17c5
test: add select columns test
Jan 18, 2022
af0f0f0
fix: missing fields in slowquery
shhdgit Jan 20, 2022
bc26674
fix: lower case field names in tests
shhdgit Jan 20, 2022
8d64754
update
Jan 20, 2022
ff49c3a
update tiup reboot
Jan 21, 2022
4aa1de8
test: slow query available fields
shhdgit Jan 21, 2022
092261b
test: move available fields tests to compatibility test
shhdgit Jan 21, 2022
1d597a2
chore: remove test log
shhdgit Jan 21, 2022
dd3a142
Merge branch 'master' into fix/missing-fields
shhdgit Jan 21, 2022
62fd6f8
merge pr/1150
Jan 21, 2022
1d53d88
update slowquery
Jan 21, 2022
b5863b9
merge upstream
Jan 26, 2022
653bea6
update slow query e2e test
Jan 25, 2022
2999f88
Merge branch 'master' into addSlowQueryE2ETest
YiniXu9506 Jan 27, 2022
3294031
update export slow query csv
Jan 27, 2022
b2ae7c3
add missing regex
Jan 27, 2022
f70a417
update slow query table order
Jan 27, 2022
b1fac49
Merge remote-tracking branch 'upstream/master' into addSlowQueryE2ETest
Feb 16, 2022
38b983b
update apiURL
Feb 17, 2022
c7adf6c
fix time-range selector
Feb 17, 2022
fce5dda
update comment
Feb 17, 2022
a3e6ae6
slow query detail
Feb 18, 2022
ebdbc6b
update slow query detail page e2e
Feb 21, 2022
147e32a
update slow query detail page
Feb 22, 2022
852d4e5
Merge remote-tracking branch 'upstream/master' into slowQueryDetailPa…
Feb 22, 2022
a1cd687
add statement e2e test
Feb 22, 2022
0bfb659
Merge remote-tracking branch 'upstream/master' into addE2E_statementL…
Feb 23, 2022
a379b11
update yarn.lock
Feb 23, 2022
853151a
update statement list
Feb 24, 2022
a42cabd
update statement list
Feb 25, 2022
2fd5d22
update statement
Feb 28, 2022
7a18543
update statement list
Mar 1, 2022
3653a94
update statement list
Mar 2, 2022
2beaa78
update statement list
Mar 3, 2022
1344958
update statement
Mar 7, 2022
1bcc02a
update statement list
Mar 7, 2022
0d23683
update statement list
Mar 8, 2022
abdfe70
update statement
Mar 14, 2022
321cff8
test statement
Mar 14, 2022
6e4acbc
Merge remote-tracking branch 'upstream/master' into addE2E_statementL…
Mar 14, 2022
fd6d9e3
test statement
Mar 14, 2022
7b4c046
update statement
Mar 14, 2022
0965cd5
update statement
Mar 14, 2022
d6ceb38
resolve comments
Mar 16, 2022
cca91ba
fix typo
Mar 18, 2022
ac171a0
Merge branch 'master' into addE2E_statementListPage
YiniXu9506 Mar 18, 2022
04e7a8a
update statement config
Mar 18, 2022
989eb7d
Merge branch 'addE2E_statementListPage' of https://github.com/YiniXu9…
Mar 18, 2022
68332c6
update statement default max size value
Mar 22, 2022
b3a9ee8
remove useless e2e data value
Mar 22, 2022
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
4 changes: 3 additions & 1 deletion ui/cypress/fixtures/uri.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"root": "/",
"login": "/signin",
"overview": "/overview",
"slow_query": "/slow_query"
"slow_query": "/slow_query",
"statement": "/statement",
"configuration": "/configuration"
}
31 changes: 31 additions & 0 deletions ui/cypress/integration/components.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2022 PingCAP, Inc. Licensed under Apache-2.0.

export const testBaseSelectorOptions = (optionsList, index) => {
YiniXu9506 marked this conversation as resolved.
Show resolved Hide resolved
cy.get('[data-e2e=base_selector]')
.eq(index)
.click()
.then(() => {
cy.get('[data-e2e=multi_select_options]')
.should('have.length', optionsList.length)
.each(($option, $idx) => {
cy.wrap($option).should('have.text', optionsList[$idx])
})
})
}

export const checkAllOptionsInBaseSelector = (index) => {
YiniXu9506 marked this conversation as resolved.
Show resolved Hide resolved
cy.get('[data-e2e=base_selector]')
.eq(index)
.click()
.then(() => {
if (cy.get('.ant-dropdown').should('exist')) {
cy.get('.ant-dropdown').within(() => {
cy.get('[role=columnheader]')
.eq(0)
.within(() => {
cy.get('.ant-checkbox').click()
})
})
}
})
}
52 changes: 24 additions & 28 deletions ui/cypress/integration/slow_query/01-list.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
// Copyright 2022 PingCAP, Inc. Licensed under Apache-2.0.

import dayjs from 'dayjs'
import { validateCSVList, deleteDownloadsFolder } from '../utils'
import {
restartTiUP,
validateSlowQueryCSVList,
deleteDownloadsFolder,
} from '../utils'
import { testBaseSelectorOptions } from '../components'

const neatCSV = require('neat-csv')
const path = require('path')
Expand All @@ -13,13 +18,7 @@ describe('SlowQuery list page', () => {
})

// Restart tiup
cy.exec(
`bash ../scripts/start_tiup.sh ${Cypress.env('TIDB_VERSION')} restart`,
{ log: true }
)

// Wait TiUP Playground
cy.exec('bash ../scripts/wait_tiup_playground.sh 1 300 &> wait_tiup.log')
restartTiUP()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can stop all tiup components processes after the test to avoid process leaks. Though these processes will be killed before the next round of tests.


deleteDownloadsFolder()
})
Expand Down Expand Up @@ -206,7 +205,10 @@ describe('SlowQuery list page', () => {

describe('Filter slow query by changing database', () => {
it('No database selected by default', () => {
cy.get('[data-e2e=base_select_input]').should('has.text', '')
cy.get('[data-e2e=base_select_input_text]').should(
'has.text',
'All Databases'
)
})

it('Show all databases', () => {
Expand All @@ -216,14 +218,7 @@ describe('SlowQuery list page', () => {

cy.wait('@databases').then((res) => {
const databaseList = res.response.body
cy.get('[data-e2e=base_selector]')
.click()
.then(() => {
cy.get('[data-e2e=multi_select_options]').should(
'have.length',
databaseList.length
)
})
testBaseSelectorOptions(databaseList, 0)
})
})

Expand All @@ -239,11 +234,11 @@ describe('SlowQuery list page', () => {
// global and use database queries will be listed
cy.get('[data-automation-key=query]').should('has.length', 3)

cy.get('[data-e2e=base_select_input]')
.click()
cy.get('[data-e2e=base_select_input_text]')
.click({ force: true })
.then(() => {
cy.get('.ms-DetailsHeader-checkTooltip')
.click()
.click({ force: true })
.then(() => {
// global query will not be listed
cy.get('[data-automation-key=query]').should('has.length', 2)
Expand Down Expand Up @@ -308,7 +303,8 @@ describe('SlowQuery list page', () => {
.eq(1)
.click()
.then(() => {
cy.get('[data-automation-key=query]').should('has.length', 3)
cy.reload()
cy.get('[data-e2e=slow_query_limit_select]').contains('200')
})
})
})
Expand All @@ -331,7 +327,7 @@ describe('SlowQuery list page', () => {
})
})

it('Hover on columns selector and check selected fileds ', () => {
it('Hover on columns selector and check selected fields ', () => {
cy.get('[data-e2e=columns_selector_popover]')
.trigger('mouseover')
.then(() => {
Expand All @@ -352,11 +348,11 @@ describe('SlowQuery list page', () => {
})
})

it('Select all column fileds', () => {
it('Select all column fields', () => {
cy.get('[data-e2e=columns_selector_popover]')
.trigger('mouseover')
.then(() => {
cy.get('[data-e2e=slow_query_schema_table_column_tile]')
cy.get('[data-e2e=column_selector_title]')
.check()
.then(() => {
cy.get('[role=columnheader]')
Expand All @@ -370,7 +366,7 @@ describe('SlowQuery list page', () => {
cy.get('[data-e2e=columns_selector_popover]')
.trigger('mouseover')
.then(() => {
cy.get('[data-e2e=slow_query_schema_table_column_reset]')
cy.get('[data-e2e=column_selector_reset]')
.click()
.then(() => {
cy.get('[role=columnheader]')
Expand Down Expand Up @@ -422,7 +418,7 @@ describe('SlowQuery list page', () => {
.then(() => {
cy.get('[data-automation-key=query]')
.eq(0)
.find('[data-e2e=text_wrap_multiline]')
.find('[data-e2e=syntax_highlighter_original]')
})

cy.get('[data-e2e=slow_query_show_full_sql]')
Expand All @@ -431,7 +427,7 @@ describe('SlowQuery list page', () => {
cy.get('[data-automation-key=query]')
.eq(0)
.trigger('mouseover')
.find('[data-e2e=text_wrap_singleline_with_tooltip]')
.find('[data-e2e=syntax_highlighter_compact]')
})
})
})
Expand Down Expand Up @@ -581,7 +577,7 @@ describe('SlowQuery list page', () => {
cy.readFile(downloadedFilename, { timeout: 15000 })
// parse CSV text into objects
.then(neatCSV)
.then(validateCSVList)
.then(validateSlowQueryCSVList)
})
})
})
Expand Down
6 changes: 3 additions & 3 deletions ui/cypress/integration/slow_query/02-detail.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('Slow query detail page E2E test', () => {
it('Check sql and default format', () => {
// sql is collapsed by default
cy.get('[data-e2e=expandText]').eq(0).should('have.text', 'Expand')
cy.get('[data-e2e=slow_query_detail_page_query]')
cy.get('[data-e2e=statement_query_detail_page_query]')
.eq(0)
.find('[data-e2e=syntax_highlighter_compact]')
.and('have.text', 'SELECT sleep(1.2);')
Expand All @@ -32,7 +32,7 @@ describe('Slow query detail page E2E test', () => {

// sql is collapsed by default
cy.get('[data-e2e=collapseText]').eq(0).should('have.text', 'Collapse')
cy.get('[data-e2e=slow_query_detail_page_query]')
cy.get('[data-e2e=statement_query_detail_page_query]')
.eq(0)
.find('[data-e2e=syntax_highlighter_original]')
.and('have.text', 'SELECT\n sleep(1.2);')
Expand Down Expand Up @@ -79,7 +79,7 @@ describe('Slow query detail page E2E test', () => {

cy.wait('@slow_query_detail').then((res) => {
const responseBody = res.response.body
cy.get('[data-e2e=slow_query_detail_page_query]')
cy.get('[data-e2e=statement_query_detail_page_query]')
.eq(1)
.and('have.text', responseBody.plan)
})
Expand Down
Loading