Skip to content

Commit 76f3e36

Browse files
authored
feat(6562): marty release test (#6569)
* fix(6562): leaving all other e2es to test the full UI compatibility with the backend, and have a marty-specific release test chore: remove unused feature flag chore: fix unhandled promise rejection * chore: handle webpack dependency resolution with oats geenrated files * chore: move the marty-specific release navigation and 404 tests into the single test location
1 parent 4825ff3 commit 76f3e36

File tree

5 files changed

+185
-35
lines changed

5 files changed

+185
-35
lines changed

cypress/e2e/cloud/releases.test.ts

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
import {Organization} from '../../../src/types'
2+
3+
// webpack bundling error if try importing --> due to imports in the constants file
4+
const IOX_SWITCHOVER_CREATION_DATE = '2023-01-31T00:00:00Z'
5+
6+
describe('Deprecations per cloud release', () => {
7+
before(() => {
8+
cy.flush().then(() =>
9+
cy.signin().then(() =>
10+
cy.isIoxOrg().then(isIox => {
11+
cy.skipOn(!isIox)
12+
cy.visit('/')
13+
cy.getByTestID('home-page--header').should('be.visible')
14+
})
15+
)
16+
)
17+
})
18+
19+
describe('Marty-release', () => {
20+
beforeEach(() => {
21+
cy.signinWithoutUserReprovision()
22+
})
23+
24+
describe('has specific navigation options', () => {
25+
describe('depreciated features do not exist', () => {
26+
;[
27+
{
28+
route: orgID => `orgs/${orgID}/notebooks`,
29+
navId: 'nav-item-flows',
30+
name: 'notebooks',
31+
},
32+
{
33+
route: orgID => `orgs/${orgID}/alerting`,
34+
navId: 'nav-item-alerting',
35+
name: 'alerts',
36+
},
37+
{
38+
route: orgID => `orgs/${orgID}/dashboards-list`,
39+
navId: 'nav-item-dashboards',
40+
name: 'dashboards',
41+
},
42+
{
43+
route: orgID => `orgs/${orgID}/tasks`,
44+
navId: 'nav-item-tasks',
45+
name: 'tasks',
46+
},
47+
].forEach(({route, navId, name}) => {
48+
it(`does not permit access to ${name}`, () => {
49+
cy.getByTestID(navId).should('not.exist')
50+
cy.get<Organization>('@org').then(({id: orgID}: Organization) => {
51+
cy.visit(route(orgID))
52+
cy.getByTestID('tree-nav').should('be.visible')
53+
cy.contains('404: Page Not Found')
54+
})
55+
})
56+
})
57+
})
58+
59+
describe('supported features are still navigable', () => {
60+
;[
61+
{navId: 'nav-item-data-explorer', title: 'Data Explorer'},
62+
{navId: 'nav-item-load-data', title: 'Load Data'},
63+
{navId: 'nav-item-settings', title: 'Settings'},
64+
].forEach(({navId, title}) => {
65+
it(`for ${title} page`, () => {
66+
cy.getByTestID(navId).should('be.visible').click({force: true})
67+
cy.getByTestID('page-title').contains(title)
68+
})
69+
})
70+
})
71+
72+
describe('nav subItems are navigable based upon selective support', () => {
73+
;[
74+
{
75+
navId: 'nav-item-load-data',
76+
navSubId: 'nav-subitem-sources',
77+
tabId: 'sources--tab',
78+
supported: true,
79+
},
80+
{
81+
navId: 'nav-item-load-data',
82+
navSubId: 'nav-subitem-buckets',
83+
tabId: 'buckets--tab',
84+
supported: true,
85+
},
86+
{
87+
navId: 'nav-item-load-data',
88+
navSubId: 'nav-subitem-telegrafs',
89+
tabId: 'telegrafs--tab',
90+
supported: true,
91+
},
92+
{
93+
navId: 'nav-item-load-data',
94+
navSubId: 'nav-subitem-tokens',
95+
tabId: 'tokens--tab',
96+
supported: true,
97+
},
98+
{
99+
navId: 'nav-item-load-data',
100+
navSubId: 'nav-subitem-subscriptions',
101+
tabId: 'subscriptions--tab',
102+
supported: false,
103+
},
104+
{
105+
navId: 'nav-item-settings',
106+
navSubId: 'nav-subitem-labels',
107+
tabId: 'labels--tab',
108+
supported: true,
109+
},
110+
{
111+
navId: 'nav-item-settings',
112+
navSubId: 'nav-subitem-secrets',
113+
tabId: 'secrets--tab',
114+
supported: true,
115+
},
116+
{
117+
navId: 'nav-item-settings',
118+
navSubId: 'nav-subitem-templates',
119+
tabId: 'templates--tab',
120+
supported: false,
121+
},
122+
].forEach(({navId, navSubId, tabId, supported}) => {
123+
it(`${navSubId} is ${
124+
supported ? 'supported' : 'not supported'
125+
}`, () => {
126+
cy.getByTestID(navId).should('be.visible').click({force: true})
127+
cy.getByTestID(navSubId).should(supported ? 'exist' : 'not.exist')
128+
cy.getByTestID(tabId).should(supported ? 'be.visible' : 'not.exist')
129+
})
130+
})
131+
})
132+
})
133+
})
134+
135+
describe('iox users prior to the Marty-release date', () => {
136+
const beforeCutoff = new Date(
137+
new Date(IOX_SWITCHOVER_CREATION_DATE) - 10000
138+
).toISOString()
139+
beforeEach(() => {
140+
cy.intercept('GET', '/api/v2/orgs', req => {
141+
req.continue(res => {
142+
const orgs = res.body.orgs.map(org => ({
143+
...org,
144+
createdAt: beforeCutoff,
145+
}))
146+
res.body.orgs = orgs
147+
})
148+
})
149+
cy.signinWithoutUserReprovision()
150+
})
151+
152+
it('have everything exist except notebooks', () => {
153+
cy.getByTestID('nav-item-flows').should('not.exist')
154+
155+
cy.getByTestID('nav-item-dashboards').should('exist').click({force: true})
156+
cy.getByTestID('page-title').contains('Dashboards')
157+
158+
cy.getByTestID('nav-item-tasks').should('exist').click({force: true})
159+
cy.getByTestID('page-title').contains('Tasks')
160+
161+
cy.getByTestID('nav-item-alerting').should('exist').click({force: true})
162+
cy.getByTestID('page-title').contains('Alerts')
163+
})
164+
165+
it('if pre-existing notebooks --> then notebooks access does exist', () => {
166+
cy.get('@org').then(({id}: Organization) =>
167+
cy.createNotebook(id).then(() => cy.reload())
168+
)
169+
cy.getByTestID('nav-item-flows').should('exist').click({force: true})
170+
cy.getByTestID('page-title').contains('Notebooks')
171+
})
172+
})
173+
})

cypress/e2e/shared/dashboardsView.test.ts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import {Organization} from '../../../src/types'
22
import {points} from '../../support/commands'
33

4-
const isIOxOrg = Boolean(Cypress.env('useIox'))
5-
const isTSMOrg = !isIOxOrg
6-
74
describe('Dashboard - TSM and pre marty release IOx', () => {
85
beforeEach(() => {
96
cy.flush().then(() =>
@@ -544,20 +541,3 @@ describe('Dashboard - TSM and pre marty release IOx', () => {
544541
})
545542
})
546543
})
547-
548-
describe('Dashboard - post marty release IOx', () => {
549-
it('should not show Dashboard', () => {
550-
cy.skipOn(isTSMOrg)
551-
552-
cy.flush()
553-
cy.signin()
554-
cy.fixture('routes').then(({orgs}) => {
555-
cy.get<Organization>('@org').then(({id: orgID}: Organization) => {
556-
cy.visit(`${orgs}/${orgID}/dashboards-list`)
557-
cy.getByTestID('tree-nav').should('be.visible')
558-
cy.getByTestID('nav-item-dashboards').should('not.exist')
559-
})
560-
})
561-
cy.contains('404: Page Not Found')
562-
})
563-
})

src/settings/components/SettingsHeader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {Page} from '@influxdata/clockface'
66
class SettingsHeader extends Component {
77
public render() {
88
return (
9-
<Page.Header fullWidth={true}>
10-
<Page.Title title="Settings" testID="settings-page--header" />
9+
<Page.Header fullWidth={true} testID="settings-page--header">
10+
<Page.Title title="Settings" />
1111
</Page.Header>
1212
)
1313
}

src/shared/selectors/app.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
import {CLOUD, IOX_SWITCHOVER_CREATION_DATE} from 'src/shared/constants'
1212

1313
import {selectOrgCreationDate, isOrgIOx} from 'src/organizations/selectors'
14-
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
1514

1615
export const timeZone = (state: AppState): TimeZone =>
1716
state.app.persisted.timeZone || ('Local' as TimeZone)
@@ -46,10 +45,6 @@ export const selectIsNewIOxOrg = (state: AppState): boolean => {
4645
return false
4746
}
4847

49-
if (isFlagEnabled('ioxLaunchMock')) {
50-
return true
51-
}
52-
5348
const orgCreationDate = new Date(selectOrgCreationDate(state)).valueOf()
5449
const ioxCutoffDate = new Date(IOX_SWITCHOVER_CREATION_DATE).valueOf()
5550
const isIOxEnabled = isOrgIOx(state)

src/usage/context/usage.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,17 @@ export const UsageProvider: FC<Props> = React.memo(({children}) => {
226226
)
227227
})
228228

229-
Promise.all(promises).then(result => {
230-
const amount: number = result
231-
.reduce((a: number, b) => a + parseFloat(b), 0)
232-
.toFixed(2)
233-
setCreditUsage({
234-
amount,
235-
status: RemoteDataState.Done,
229+
Promise.all(promises)
230+
.then(result => {
231+
const amount: number = result
232+
.reduce((a: number, b) => a + parseFloat(b), 0)
233+
.toFixed(2)
234+
setCreditUsage({
235+
amount,
236+
status: RemoteDataState.Done,
237+
})
236238
})
237-
})
239+
.catch(err => console.error(err))
238240
} catch (error) {
239241
setCreditUsage(prev => ({
240242
...prev,

0 commit comments

Comments
 (0)