|
1 | 1 | import {Organization} from '../../../src/types' |
2 | 2 |
|
3 | 3 | const doSetup = (cy, numAccounts: number) => { |
4 | | - cy.signin().then(() => { |
5 | | - cy.get('@org').then(({id}: Organization) => { |
6 | | - cy.setFeatureFlags({ |
7 | | - uiUnificationFlag: true, |
8 | | - multiAccount: true, |
9 | | - }).then(() => { |
10 | | - cy.quartzProvision({ |
11 | | - accountType: 'free', |
12 | | - numAccounts, |
| 4 | + cy.flush().then(() => { |
| 5 | + cy.signin().then(() => { |
| 6 | + cy.get('@org').then(({id}: Organization) => { |
| 7 | + cy.setFeatureFlags({ |
| 8 | + uiUnificationFlag: true, |
| 9 | + multiAccount: true, |
13 | 10 | }).then(() => { |
14 | | - cy.visit(`/orgs/${id}/accounts/settings`) |
| 11 | + cy.quartzProvision({ |
| 12 | + accountType: 'free', |
| 13 | + numAccounts, |
| 14 | + }).then(() => { |
| 15 | + cy.visit(`/orgs/${id}/accounts/settings`) |
| 16 | + }) |
15 | 17 | }) |
16 | 18 | }) |
17 | 19 | }) |
18 | 20 | }) |
19 | 21 | } |
20 | 22 |
|
21 | | -describe('Account Page; user with 4 accounts', () => { |
22 | | - beforeEach(() => doSetup(cy, 4)) |
| 23 | +describe('Account Page tests', () => { |
| 24 | + describe('User with 4 accounts', () => { |
| 25 | + beforeEach(() => doSetup(cy, 4)) |
23 | 26 |
|
24 | | - it('can change the default account, and then see that it changed on the switch dialog; also checks that the switch button is enabled and disabled correctly', () => { |
25 | | - cy.getByTestID('account-settings--header').should('be.visible') |
26 | | - cy.getByTestID('user-account-switch-btn').should('be.visible') |
27 | | - cy.getByTestID('input--active-account-name').should('have.value', 'Influx') |
| 27 | + it('can change the default account, and then see that it changed on the switch dialog; also checks that the switch button is enabled and disabled correctly', () => { |
| 28 | + cy.getByTestID('account-settings--header').should('be.visible') |
| 29 | + cy.getByTestID('user-account-switch-btn').should('be.visible') |
| 30 | + cy.getByTestID('input--active-account-name').should( |
| 31 | + 'have.value', |
| 32 | + 'Influx' |
| 33 | + ) |
28 | 34 |
|
29 | | - cy.getByTestID('user-account-switch-btn').click() |
| 35 | + cy.getByTestID('user-account-switch-btn').click() |
30 | 36 |
|
31 | | - const prefix = 'accountSwitch-toggle-choice' |
| 37 | + const prefix = 'accountSwitch-toggle-choice' |
32 | 38 |
|
33 | | - cy.getByTestID('switch-account--dialog').within(() => { |
34 | | - cy.getByTestID(`${prefix}-0-ID`).should('be.visible') |
35 | | - cy.getByTestID(`${prefix}-0-ID`).contains('Influx') |
36 | | - cy.getByTestID(`${prefix}-0-ID--input`).should('be.checked') |
| 39 | + cy.getByTestID('switch-account--dialog').within(() => { |
| 40 | + cy.getByTestID(`${prefix}-0-ID`).should('be.visible') |
| 41 | + cy.getByTestID(`${prefix}-0-ID`).contains('Influx') |
| 42 | + cy.getByTestID(`${prefix}-0-ID--input`).should('be.checked') |
37 | 43 |
|
38 | | - cy.getByTestID(`${prefix}-1-ID`).should('be.visible') |
39 | | - cy.getByTestID(`${prefix}-1-ID`).contains('Veganomicon (default)') |
| 44 | + cy.getByTestID(`${prefix}-1-ID`).should('be.visible') |
| 45 | + cy.getByTestID(`${prefix}-1-ID`).contains('Veganomicon (default)') |
40 | 46 |
|
41 | | - cy.getByTestID(`${prefix}-2-ID`).should('be.visible') |
42 | | - cy.getByTestID(`${prefix}-2-ID`).contains('Stradivarius') |
| 47 | + cy.getByTestID(`${prefix}-2-ID`).should('be.visible') |
| 48 | + cy.getByTestID(`${prefix}-2-ID`).contains('Stradivarius') |
43 | 49 |
|
44 | | - cy.getByTestID(`${prefix}-3-ID`).should('be.visible') |
45 | | - cy.getByTestID(`${prefix}-3-ID`).contains('Yamaha') |
| 50 | + cy.getByTestID(`${prefix}-3-ID`).should('be.visible') |
| 51 | + cy.getByTestID(`${prefix}-3-ID`).contains('Yamaha') |
46 | 52 |
|
47 | | - // at first; the switch button should be disabled: |
48 | | - cy.getByTestID('actually-switch-account--btn').should('be.disabled') |
| 53 | + // at first; the switch button should be disabled: |
| 54 | + cy.getByTestID('actually-switch-account--btn').should('be.disabled') |
49 | 55 |
|
50 | | - // the set default button should be *enabled* |
51 | | - cy.getByTestID('switch-default-account--btn').should('be.enabled') |
| 56 | + // the set default button should be *enabled* |
| 57 | + cy.getByTestID('switch-default-account--btn').should('be.enabled') |
52 | 58 |
|
53 | | - // now: select another option: |
54 | | - cy.getByTestID(`${prefix}-1-ID`).click() |
| 59 | + // now: select another option: |
| 60 | + cy.getByTestID(`${prefix}-1-ID`).click() |
55 | 61 |
|
56 | | - // check that it is selected before checking the button enabled state: |
57 | | - cy.getByTestID(`${prefix}-1-ID--input`).should('be.checked') |
| 62 | + // check that it is selected before checking the button enabled state: |
| 63 | + cy.getByTestID(`${prefix}-1-ID--input`).should('be.checked') |
58 | 64 |
|
59 | | - // now; the button should be enabled: |
60 | | - cy.getByTestID('actually-switch-account--btn').should('be.enabled') |
| 65 | + // now; the button should be enabled: |
| 66 | + cy.getByTestID('actually-switch-account--btn').should('be.enabled') |
61 | 67 |
|
62 | | - // and the default button should be *disabled* b/c just chose the default acct: |
63 | | - cy.getByTestID('switch-default-account--btn').should('be.disabled') |
| 68 | + // and the default button should be *disabled* b/c just chose the default acct: |
| 69 | + cy.getByTestID('switch-default-account--btn').should('be.disabled') |
64 | 70 |
|
65 | | - // ok; now pick the third option: |
66 | | - cy.getByTestID(`${prefix}-2-ID`).click() |
| 71 | + // ok; now pick the third option: |
| 72 | + cy.getByTestID(`${prefix}-2-ID`).click() |
67 | 73 |
|
68 | | - // check that it is selected before going to the next step: |
69 | | - cy.getByTestID(`${prefix}-2-ID--input`).should('be.checked') |
70 | | - cy.getByTestID('switch-default-account--btn').should('be.enabled') |
| 74 | + // check that it is selected before going to the next step: |
| 75 | + cy.getByTestID(`${prefix}-2-ID--input`).should('be.checked') |
| 76 | + cy.getByTestID('switch-default-account--btn').should('be.enabled') |
71 | 77 |
|
72 | | - cy.getByTestID('switch-default-account--btn').click() |
73 | | - }) |
74 | | - // test that the notification is up: |
75 | | - cy.getByTestID('notification-success').should('be.visible') |
| 78 | + cy.getByTestID('switch-default-account--btn').click() |
| 79 | + }) |
| 80 | + // test that the notification is up: |
| 81 | + cy.getByTestID('notification-success').should('be.visible') |
76 | 82 |
|
77 | | - // now; bring up the dialog again, the default one should be changed: |
78 | | - cy.getByTestID('user-account-switch-btn').click() |
| 83 | + // now; bring up the dialog again, the default one should be changed: |
| 84 | + cy.getByTestID('user-account-switch-btn').click() |
79 | 85 |
|
80 | | - cy.getByTestID('switch-account--dialog').within(() => { |
81 | | - cy.getByTestID(`${prefix}-0-ID`).should('be.visible') |
82 | | - cy.getByTestID(`${prefix}-0-ID`).contains('Influx') |
83 | | - cy.getByTestID(`${prefix}-0-ID--input`).should('be.checked') |
| 86 | + cy.getByTestID('switch-account--dialog').within(() => { |
| 87 | + cy.getByTestID(`${prefix}-0-ID`).should('be.visible') |
| 88 | + cy.getByTestID(`${prefix}-0-ID`).contains('Influx') |
| 89 | + cy.getByTestID(`${prefix}-0-ID--input`).should('be.checked') |
84 | 90 |
|
85 | | - cy.getByTestID(`${prefix}-1-ID`).should('be.visible') |
86 | | - cy.getByTestID(`${prefix}-1-ID`).contains('Veganomicon') |
| 91 | + cy.getByTestID(`${prefix}-1-ID`).should('be.visible') |
| 92 | + cy.getByTestID(`${prefix}-1-ID`).contains('Veganomicon') |
87 | 93 |
|
88 | | - cy.getByTestID(`${prefix}-2-ID`).should('be.visible') |
89 | | - cy.getByTestID(`${prefix}-2-ID`).contains('Stradivarius (default)') |
| 94 | + cy.getByTestID(`${prefix}-2-ID`).should('be.visible') |
| 95 | + cy.getByTestID(`${prefix}-2-ID`).contains('Stradivarius (default)') |
| 96 | + }) |
90 | 97 | }) |
91 | 98 | }) |
92 | | -}) |
93 | 99 |
|
94 | | -describe('Account Page; user with one account', () => { |
95 | | - beforeEach(() => cy.flush().then(() => doSetup(cy, 1))) |
| 100 | + describe('User with one account', () => { |
| 101 | + beforeEach(() => doSetup(cy, 1)) |
96 | 102 |
|
97 | | - it('can get to the page and get the accounts, and the switch button is NOT showing', () => { |
98 | | - cy.getByTestID('account-settings--header').should('be.visible') |
99 | | - cy.getByTestID('user-account-switch-btn').should('not.exist') |
| 103 | + it('can get to the page and get the accounts, and the switch button is NOT showing', () => { |
| 104 | + cy.getByTestID('account-settings--header').should('be.visible') |
| 105 | + cy.getByTestID('user-account-switch-btn').should('not.exist') |
100 | 106 |
|
101 | | - cy.getByTestID('input--active-account-name').should( |
102 | | - 'have.value', |
103 | | - 'Veganomicon' |
104 | | - ) |
| 107 | + cy.getByTestID('input--active-account-name').should( |
| 108 | + 'have.value', |
| 109 | + 'Veganomicon' |
| 110 | + ) |
| 111 | + }) |
105 | 112 | }) |
106 | | -}) |
107 | 113 |
|
108 | | -describe('Account Page; user with two accounts', () => { |
109 | | - beforeEach(() => cy.flush().then(() => doSetup(cy, 2))) |
| 114 | + describe('User with two accounts', () => { |
| 115 | + beforeEach(() => doSetup(cy, 2)) |
110 | 116 |
|
111 | | - it('can get to the account page and rename the active account', () => { |
112 | | - cy.getByTestID('account-settings--header').should('be.visible') |
| 117 | + it('can get to the account page and rename the active account', () => { |
| 118 | + cy.getByTestID('account-settings--header').should('be.visible') |
113 | 119 |
|
114 | | - cy.getByTestID('input--active-account-name').should('have.value', 'Influx') |
| 120 | + cy.getByTestID('input--active-account-name').should( |
| 121 | + 'have.value', |
| 122 | + 'Influx' |
| 123 | + ) |
115 | 124 |
|
116 | | - cy.getByTestID('input--active-account-name').clear() |
117 | | - cy.getByTestID('input--active-account-name').should('have.value', '') |
| 125 | + cy.getByTestID('input--active-account-name').clear() |
| 126 | + cy.getByTestID('input--active-account-name').should('have.value', '') |
118 | 127 |
|
119 | | - // what can I say? i am a fan |
120 | | - const newName = 'Bruno-no-no-no' |
121 | | - cy.getByTestID('input--active-account-name').type(newName) |
122 | | - cy.getByTestID('rename-account--button').click() |
| 128 | + // what can I say? i am a fan |
| 129 | + const newName = 'Bruno-no-no-no' |
| 130 | + cy.getByTestID('input--active-account-name').type(newName) |
| 131 | + cy.getByTestID('rename-account--button').click() |
123 | 132 |
|
124 | | - // test that the notification is up: |
125 | | - cy.getByTestID('notification-success').should('be.visible') |
| 133 | + // test that the notification is up: |
| 134 | + cy.getByTestID('notification-success').should('be.visible') |
126 | 135 |
|
127 | | - // now; bring up the dialog, the active name should be changed: |
128 | | - cy.getByTestID('user-account-switch-btn').click() |
| 136 | + // now; bring up the dialog, the active name should be changed: |
| 137 | + cy.getByTestID('user-account-switch-btn').click() |
129 | 138 |
|
130 | | - const prefix = 'accountSwitch-toggle-choice' |
| 139 | + const prefix = 'accountSwitch-toggle-choice' |
131 | 140 |
|
132 | | - cy.getByTestID('switch-account--dialog').within(() => { |
133 | | - cy.getByTestID(`${prefix}-0-ID`).should('be.visible') |
134 | | - cy.getByTestID(`${prefix}-0-ID`).contains(newName) |
135 | | - cy.getByTestID(`${prefix}-0-ID--input`).should('be.checked') |
136 | | - cy.getByTestID('multi-account-switch-cancel').click() |
137 | | - }) |
| 141 | + cy.getByTestID('switch-account--dialog').within(() => { |
| 142 | + cy.getByTestID(`${prefix}-0-ID`).should('be.visible') |
| 143 | + cy.getByTestID(`${prefix}-0-ID`).contains(newName) |
| 144 | + cy.getByTestID(`${prefix}-0-ID--input`).should('be.checked') |
| 145 | + cy.getByTestID('multi-account-switch-cancel').click() |
| 146 | + }) |
138 | 147 |
|
139 | | - // circle-ci and e2e tests got unstable, so best to put all the toys back |
140 | | - // (reset the name) |
141 | | - cy.getByTestID('account-settings--header').should('be.visible') |
| 148 | + // circle-ci and e2e tests got unstable, so best to put all the toys back |
| 149 | + // (reset the name) |
| 150 | + cy.getByTestID('account-settings--header').should('be.visible') |
142 | 151 |
|
143 | | - cy.getByTestID('input--active-account-name') |
144 | | - .clear() |
145 | | - .type('Influx') |
146 | | - cy.getByTestID('rename-account--button').click() |
| 152 | + cy.getByTestID('input--active-account-name') |
| 153 | + .clear() |
| 154 | + .type('Influx') |
| 155 | + cy.getByTestID('rename-account--button').click() |
147 | 156 |
|
148 | | - // test that the notification is up: |
149 | | - cy.getByTestID('notification-success').should('be.visible') |
| 157 | + // test that the notification is up: |
| 158 | + cy.getByTestID('notification-success').should('be.visible') |
150 | 159 |
|
151 | | - // now; bring up the dialog again, the active name should be changed: |
152 | | - cy.getByTestID('user-account-switch-btn').click() |
| 160 | + // now; bring up the dialog again, the active name should be changed: |
| 161 | + cy.getByTestID('user-account-switch-btn').click() |
153 | 162 |
|
154 | | - cy.getByTestID('switch-account--dialog').within(() => { |
155 | | - cy.getByTestID(`${prefix}-0-ID`).should('be.visible') |
156 | | - cy.getByTestID(`${prefix}-0-ID`).contains('Influx') |
157 | | - cy.getByTestID(`${prefix}-0-ID--input`).should('be.checked') |
158 | | - cy.getByTestID('multi-account-switch-cancel').click() |
| 163 | + cy.getByTestID('switch-account--dialog').within(() => { |
| 164 | + cy.getByTestID(`${prefix}-0-ID`).should('be.visible') |
| 165 | + cy.getByTestID(`${prefix}-0-ID`).contains('Influx') |
| 166 | + cy.getByTestID(`${prefix}-0-ID--input`).should('be.checked') |
| 167 | + cy.getByTestID('multi-account-switch-cancel').click() |
| 168 | + }) |
159 | 169 | }) |
160 | 170 | }) |
161 | 171 | }) |
0 commit comments