|
| 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 | +}) |
0 commit comments