|
1 | 1 | import {Organization} from '../../../src/types' |
2 | 2 |
|
3 | | -describe.skip('Variables', () => { |
| 3 | +const isIOxOrg = Boolean(Cypress.env('useIox')) |
| 4 | +const isTSMOrg = !isIOxOrg |
| 5 | + |
| 6 | +const setupTest = (shouldShowVariables: boolean = true) => { |
| 7 | + cy.flush().then(() => |
| 8 | + cy.signin().then(() => |
| 9 | + cy |
| 10 | + .setFeatureFlags({ |
| 11 | + showVariablesInNewIOx: shouldShowVariables, |
| 12 | + schemaComposition: true, |
| 13 | + }) |
| 14 | + .then(() => |
| 15 | + cy.get('@org').then(({id}: Organization) => { |
| 16 | + cy.createQueryVariable(id) |
| 17 | + // cy.wait($time) is necessary to consistently ensure sufficient time for the feature flag override. |
| 18 | + // The flag reset happens via redux, (it's not a network request), so we can't cy.wait($intercepted_route). |
| 19 | + cy.visit(`orgs/${id}/settings/variables`) |
| 20 | + cy.wait(1200) |
| 21 | + cy.location('pathname').should('match', /\/variables$/) |
| 22 | + }) |
| 23 | + ) |
| 24 | + ) |
| 25 | + ) |
| 26 | +} |
| 27 | + |
| 28 | +describe('Variables - TSM', () => { |
4 | 29 | beforeEach(() => { |
5 | | - cy.flush() |
6 | | - cy.signin() |
7 | | - cy.get('@org').then(({id}: Organization) => { |
8 | | - cy.createQueryVariable(id) |
9 | | - cy.visit(`orgs/${id}/settings/variables`) |
10 | | - cy.getByTestID('tree-nav') |
11 | | - }) |
12 | | - // Double check that the new schemaComposition flag does not interfere. |
13 | | - cy.setFeatureFlags({ |
14 | | - schemaComposition: true, |
15 | | - }) |
16 | | - // cy.wait($time) is necessary to consistently ensure sufficient time for the feature flag override. |
17 | | - // The flag reset happens via redux, (it's not a network request), so we can't cy.wait($intercepted_route). |
18 | | - cy.wait(1200) |
19 | | - cy.location('pathname').should('match', /\/variables$/) |
| 30 | + setupTest() |
20 | 31 | }) |
21 | 32 |
|
22 | 33 | it('can CRUD a CSV, upload, map, and query variable and search for variables based on names', () => { |
23 | 34 | // Navigate away from and back to variables index using the nav bar |
24 | | - cy.clickNavBarItem('nav-item-dashboards') |
| 35 | + cy.clickNavBarItem('nav-item-data-explorer') |
25 | 36 | cy.clickNavBarItem('nav-item-settings') |
26 | | - cy.getByTestID('templates--tab').click() |
| 37 | + cy.getByTestID('labels--tab').click() |
27 | 38 | cy.getByTestID('variables--tab').click() |
28 | 39 |
|
29 | 40 | cy.getByTestID('resource-card variable').should('have.length', 1) |
@@ -87,9 +98,9 @@ describe.skip('Variables', () => { |
87 | 98 |
|
88 | 99 | const lastMapItem = 'Mila Emile,"o61AhpOGr5aO3cYVArC0"' |
89 | 100 | cy.get('textarea').type(`Juanito MacNeil,"5TKl6l8i4idg15Fxxe4P" |
90 | | - Astrophel Chaudhary,"bDhZbuVj5RV94NcFXZPm" |
91 | | - Ochieng Benes,"YIhg6SoMKRUH8FMlHs3V" |
92 | | - ${lastMapItem}`) |
| 101 | + Astrophel Chaudhary,"bDhZbuVj5RV94NcFXZPm" |
| 102 | + Ochieng Benes,"YIhg6SoMKRUH8FMlHs3V" |
| 103 | + ${lastMapItem}`) |
93 | 104 |
|
94 | 105 | cy.getByTestID('map-variable-dropdown--button').click() |
95 | 106 | cy.contains(lastMapItem).click() |
@@ -158,7 +169,7 @@ describe.skip('Variables', () => { |
158 | 169 | cy.getByInputName('name').type(mapVariableName) |
159 | 170 |
|
160 | 171 | cy.get('textarea').type(`Astrophel Chaudhary,"bDhZbuVj5RV94NcFXZPm" |
161 | | - Ochieng Benes,"YIhg6SoMKRUH8FMlHs3V"`) |
| 172 | + Ochieng Benes,"YIhg6SoMKRUH8FMlHs3V"`) |
162 | 173 |
|
163 | 174 | cy.getByTestID('map-variable-dropdown--button').click().last().click() |
164 | 175 |
|
@@ -412,3 +423,14 @@ describe.skip('Variables', () => { |
412 | 423 | .contains(thirdVariableName) |
413 | 424 | }) |
414 | 425 | }) |
| 426 | + |
| 427 | +describe('Variables - IOx', () => { |
| 428 | + it('routes to 404 page when IOx user attempts to access variables', () => { |
| 429 | + cy.skipOn(isTSMOrg) |
| 430 | + const shouldShowVariables = false |
| 431 | + setupTest(shouldShowVariables) |
| 432 | + cy.contains('404: Page Not Found') |
| 433 | + cy.clickNavBarItem('nav-item-settings') |
| 434 | + cy.getByTestID('variables--tab').should('not.exist') |
| 435 | + }) |
| 436 | +}) |
0 commit comments