Skip to content

Commit 40e804f

Browse files
authored
fix: update load data sources test for iox (#6579)
* fix: update load data sources test for iox * chore: organize comments * chore: remove unnecessary load data sources test
1 parent 80bef64 commit 40e804f

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed

cypress/e2e/shared/loadDataSources.test.ts

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
import {Organization} from '../../src/types'
22

3-
describe.skip('Load Data Sources', () => {
3+
const isIOxOrg = Boolean(Cypress.env('useIox'))
4+
5+
// Library to use when testing client library details view.
6+
// As of 2/2023, IOx only has one client library - python, which has a wizard.
7+
// In TSM, there are more libraries, and it's desirable to test a page both with and without a wizard.
8+
const libraryWithWizard = isIOxOrg ? 'python' : 'arduino'
9+
const libraryWithoutWizard = 'csharp'
10+
11+
describe('Load Data Sources', () => {
412
beforeEach(() => {
513
cy.flush()
614
cy.signin()
15+
cy.setFeatureFlags({
16+
newDataExplorer: true,
17+
showOldDataExplorerInNewIOx: true,
18+
})
719
cy.get('@org').then(({id}: Organization) =>
820
cy.fixture('routes').then(({orgs}) => {
921
cy.visit(`${orgs}/${id}/load-data/sources`)
@@ -13,9 +25,14 @@ describe.skip('Load Data Sources', () => {
1325
})
1426

1527
it('navigates to Client Library details view and renders details without a wizard', () => {
28+
// Skip this test in IOx because as of 2/2023, there is only one library (python), which has a wizard.
29+
cy.skipOn(isIOxOrg)
30+
1631
cy.getByTestID('write-data--section client-libraries').within(() => {
1732
cy.getByTestID('square-grid').within(() => {
18-
cy.getByTestIDSubStr('load-data-item csharp').first().click()
33+
cy.getByTestIDSubStr(`load-data-item ${libraryWithoutWizard}`)
34+
.first()
35+
.click()
1936
})
2037
})
2138

@@ -28,10 +45,9 @@ describe.skip('Load Data Sources', () => {
2845
})
2946

3047
it('navigates to Client Library details view and renders a wizard', () => {
31-
const libaryWithWizard = 'Arduino'
3248
cy.getByTestID('write-data--section client-libraries').within(() => {
3349
cy.getByTestID('square-grid').within(() => {
34-
cy.getByTestIDSubStr(`load-data-item ${libaryWithWizard.toLowerCase()}`)
50+
cy.getByTestIDSubStr(`load-data-item ${libraryWithWizard}`)
3551
.first()
3652
.click()
3753
})
@@ -42,7 +58,11 @@ describe.skip('Load Data Sources', () => {
4258
contentNav.children().should('exist')
4359

4460
const titleElement = cy.get('.subway-navigation-title-text')
45-
titleElement.contains(libaryWithWizard)
61+
62+
const capitalizedLibraryWithWizard =
63+
libraryWithWizard[0].toUpperCase() + libraryWithWizard.slice(1)
64+
65+
titleElement.contains(capitalizedLibraryWithWizard)
4666
})
4767

4868
it('navigates to Telegraf Plugin details view and render it with essentials', () => {
@@ -73,7 +93,7 @@ describe.skip('Load Data Sources', () => {
7393
})
7494

7595
// TODO(ariel): address these skipped tests later https://github.com/influxdata/ui/issues/3394
76-
it.skip('can write data to buckets', () => {
96+
it('can write data to buckets', () => {
7797
// writing a well-formed line is accepted
7898
cy.getByTestID('load-data-item lp').click()
7999
cy.getByTestID('Enter Manually').click()
@@ -109,7 +129,7 @@ describe.skip('Load Data Sources', () => {
109129
cy.getByTestID('line-protocol--status').contains('Success')
110130
})
111131

112-
it.skip('upload a file and write data', () => {
132+
it('upload a file and write data', () => {
113133
cy.getByTestID('load-data-item lp').click()
114134
cy.getByTestID('Upload File').click()
115135

@@ -152,32 +172,32 @@ describe.skip('Load Data Sources', () => {
152172
cy.getByTestID('lp-close--button').click()
153173

154174
// navigate to data explorer to see data
175+
// use new data explorer, since old data explorer is being deprecated
155176
cy.getByTestID('nav-item-data-explorer').click({force: true})
177+
178+
cy.getByTestID('script-query-builder-toggle').click()
179+
156180
cy.getByTestID('timerange-dropdown').click()
157-
cy.getByTestID('dropdown-item-customtimerange').click()
158181

159182
// time range start
160-
cy.getByTestID('timerange--input')
183+
cy.get('.date-picker__input')
161184
.first()
162185
.clear()
163186
.type('2020-08-06 00:00:00.000')
164187

165188
// time range stop
166-
cy.getByTestID('timerange--input')
167-
.last()
168-
.clear()
169-
.type('2020-08-08 00:00:00.000')
189+
cy.get('.date-picker__input').last().clear().type('2020-08-08 00:00:00.000')
170190

171191
cy.getByTestID('daterange--apply-btn').click()
172192

173-
// TODO replace this with proper health checks
174193
cy.wait(1000)
175-
cy.get<string>('@defaultBucketListSelector').then(
176-
(defaultBucketListSelector: string) => {
177-
cy.getByTestID(defaultBucketListSelector).click()
178-
}
179-
)
194+
cy.getByTestID('bucket-selector--dropdown-button').click()
195+
cy.getByTestID('bucket-selector--dropdown--defbuck').click()
196+
180197
// mymeasurement comes from fixtures/data.txt
181-
cy.getByTestID('selector-list mymeasurement').should('exist')
198+
cy.getByTestID('measurement-selector--dropdown-button').click()
199+
cy.getByTestID('searchable-dropdown--item mymeasurement')
200+
.contains('mymeasurement')
201+
.click()
182202
})
183203
})

0 commit comments

Comments
 (0)