@vtex/faststore-plugin-buyer-portal 1.1.93 → 1.1.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,12 +48,8 @@ export const TEST_DATA = {
48
48
  },
49
49
  USER_NAME_FOR_ROLES: "User for Test Roles",
50
50
  NEW_USER: {
51
- NAME: `New User ${Date.now().toString(36)}-${Math.random()
52
- .toString(36)
53
- .substring(2, 5)}`,
54
- EMAIL: `new_user+e2e_test${Date.now().toString(36)}-${Math.random()
55
- .toString(36)
56
- .substring(2, 5)}@vtex.com`,
51
+ NAME: "New User",
52
+ EMAIL: "new_user+e2e_test@vtex.com",
57
53
  ROLE: "Buyer",
58
54
  },
59
55
  USER_FROM_OTHER_ORG_UNIT: {
@@ -83,7 +79,6 @@ export const TEST_DATA = {
83
79
  NO_ALLOCATION_MESSAGE: "No allocations yet",
84
80
  },
85
81
  ADDRESS: {
86
- EXISTING_ADDRESS: "Existing Test Address",
87
82
  NEW_ADDRESS_NAME: "VTEX RJ",
88
83
  NEW_ADDRESS_STREET: "Praia de Botafogo, 300",
89
84
  EDIT_ADDRESS_STREET: "Praia de Botafogo, 400",
@@ -93,7 +88,7 @@ export const TEST_DATA = {
93
88
  NEW_ADDRESS_POSTAL_CODE: "22250-905",
94
89
  },
95
90
  LOCATIONS: {
96
- LOCATION_ADDRESS_NAME: "ADDRESS FOR LOCATION TEST",
91
+ LOCATION_ADDRESS_NAME: "LOCATIONS",
97
92
  FIRST_LOCATION: "Location 1",
98
93
  SECOND_LOCATION: "Location 2",
99
94
  THIRD_LOCATION: "Location 3",
@@ -101,7 +96,7 @@ export const TEST_DATA = {
101
96
  EDITED_LOCATION: "Edited Location",
102
97
  },
103
98
  RECIPIENTS: {
104
- RECIPIENTS_ADDRESS_NAME: "ADDRESS FOR RECIPIENTS TESTS",
99
+ RECIPIENTS_ADDRESS_NAME: "RECIPIENTS",
105
100
  FIRST_RECIPIENT_NAME: "First Recipient",
106
101
  RECIPIENT_PHONE: "9999999999",
107
102
  SECOND_RECIPIENT_NAME: "Second Recipient",
@@ -1,5 +1,9 @@
1
1
  import { TEST_CONFIG, TEST_DATA } from "../constants";
2
- import { clickConfirmButton } from "../shared";
2
+ import {
3
+ clickConfirmButton,
4
+ generateRandomString,
5
+ useInternalSearch,
6
+ } from "../shared";
3
7
  import {
4
8
  goToAddressPage,
5
9
  navigateToAddressByName,
@@ -7,7 +11,15 @@ import {
7
11
  openAddressActionsDropdown,
8
12
  } from "../support/addressHelper";
9
13
 
10
- describe("Address Page", () => {
14
+ let ADDRESS_NAME: string;
15
+
16
+ describe("Address Page", { retries: 2 }, () => {
17
+ before(() => {
18
+ // By using random address names, we stop runs from interfering with each other
19
+ ADDRESS_NAME = `${
20
+ TEST_DATA.ADDRESS.NEW_ADDRESS_NAME
21
+ } ${generateRandomString()}`;
22
+ });
11
23
  beforeEach(() => {
12
24
  cy.login();
13
25
 
@@ -17,11 +29,6 @@ describe("Address Page", () => {
17
29
  goToAddressPage(TEST_DATA.PROFILE.TEST_CONTRACT_NAME);
18
30
  });
19
31
  it("Should load current addresses, create a new one and be able to see it's details", () => {
20
- // Check Existing Address
21
- cy.get("[data-fs-addresses-table]").within(() => {
22
- cy.contains(TEST_DATA.ADDRESS.EXISTING_ADDRESS).should("exist");
23
- });
24
-
25
32
  openCreateAddressDrawer();
26
33
 
27
34
  // Fill The Address Form
@@ -34,9 +41,7 @@ describe("Address Page", () => {
34
41
  });
35
42
 
36
43
  // Address Name
37
- cy.get("[data-fs-bp-autocomplete-dropdown]")
38
- .eq(1)
39
- .type(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME);
44
+ cy.get("[data-fs-bp-autocomplete-dropdown]").eq(1).type(ADDRESS_NAME);
40
45
 
41
46
  // Street
42
47
  cy.get("[class=street-address]").type(TEST_DATA.ADDRESS.NEW_ADDRESS_STREET);
@@ -71,23 +76,14 @@ describe("Address Page", () => {
71
76
  });
72
77
 
73
78
  clickConfirmButton();
74
-
75
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
76
-
77
- //Sometimes masterdata has cache, the reload helps with that
78
- cy.reload();
79
-
80
- // Check to see if address was created
81
- cy.get("[data-fs-addresses-table]")
82
- .contains(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME)
83
- .should("be.visible");
79
+ cy.contains("Address added successfully").should("be.visible");
84
80
  });
85
81
  it("Should be able to edit street in specific Address via address details", () => {
86
82
  // Navigate to Address Details
87
- navigateToAddressByName(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME);
83
+ navigateToAddressByName(ADDRESS_NAME);
88
84
 
89
85
  // // Check if sections are rendered correctly
90
- cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME).should("be.visible");
86
+ cy.contains(ADDRESS_NAME).should("be.visible");
91
87
  cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_STREET).should("be.visible");
92
88
  cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_COMPLEMENT).should("be.visible");
93
89
  cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_POSTAL_CODE).should("be.visible");
@@ -95,26 +91,24 @@ describe("Address Page", () => {
95
91
  // Open Edit Drawer
96
92
  cy.get("[data-fs-address-details-button]").click();
97
93
 
98
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
99
-
100
94
  // Edit street
101
95
  cy.get("[class=street-address]")
102
96
  .clear()
103
97
  .type(TEST_DATA.ADDRESS.EDIT_ADDRESS_STREET);
104
98
 
105
99
  clickConfirmButton();
100
+ cy.contains("Address updated successfully").should("be.visible");
106
101
 
107
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
108
102
  cy.reload();
109
103
 
110
104
  // Check to see if information is edited
111
- cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME).should("be.visible");
105
+ cy.contains(ADDRESS_NAME).should("be.visible");
112
106
  cy.contains(TEST_DATA.ADDRESS.EDIT_ADDRESS_STREET).should("be.visible");
113
107
  cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_COMPLEMENT).should("be.visible");
114
108
  cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_POSTAL_CODE).should("be.visible");
115
109
  });
116
110
  it("Should be able to edit the address from the address list page", () => {
117
- openAddressActionsDropdown(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME);
111
+ openAddressActionsDropdown(ADDRESS_NAME);
118
112
 
119
113
  cy.contains("Edit details").click();
120
114
 
@@ -124,42 +118,37 @@ describe("Address Page", () => {
124
118
  .type(TEST_DATA.ADDRESS.NEW_ADDRESS_STREET);
125
119
 
126
120
  clickConfirmButton();
127
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
121
+ cy.contains("Address updated successfully").should("be.visible");
128
122
  });
129
123
 
130
124
  it("Should be able to set the address as default", () => {
131
- openAddressActionsDropdown(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME);
125
+ openAddressActionsDropdown(ADDRESS_NAME);
132
126
 
133
127
  cy.contains("Set as default").click();
128
+ cy.contains("Setting the default address...").should("be.visible");
134
129
 
135
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
136
-
130
+ useInternalSearch(ADDRESS_NAME);
137
131
  // Check to see if is set as default
138
132
  cy.get("[data-fs-addresses-table]")
139
- .contains(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME)
133
+ .contains(ADDRESS_NAME)
140
134
  .parent()
141
135
  .parent()
142
136
  .get("[data-fs-bp-table-row-default-icon]")
143
137
  .should("be.visible");
144
138
  });
145
139
  it("Should be able to Remove the address from the unit", () => {
146
- openAddressActionsDropdown(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME);
140
+ openAddressActionsDropdown(ADDRESS_NAME);
147
141
 
148
142
  // Inside the Action dropdown, remove from unit
149
143
  cy.contains("Remove from Unit").click();
150
144
 
151
145
  clickConfirmButton();
152
-
153
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
154
- cy.reload();
155
-
156
- // Check to see if the address has been removed
157
- cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME).should("not.exist");
146
+ cy.contains("Address removed successfully").should("be.visible");
158
147
  });
159
148
 
160
149
  it("Should be able to Add existing Address", () => {
161
150
  // Check to see if address is really absent
162
- cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME).should("not.exist");
151
+ cy.contains(ADDRESS_NAME).should("not.exist");
163
152
 
164
153
  openCreateAddressDrawer();
165
154
 
@@ -167,39 +156,34 @@ describe("Address Page", () => {
167
156
  cy.get('[data-fs-bp-input-text="true"]')
168
157
  .eq(1)
169
158
  .should("be.visible")
170
- .type(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME, { delay: 500 });
159
+ .type(ADDRESS_NAME, { delay: 500 });
171
160
 
172
161
  // Select existing address
173
- cy.get('[data-fs-bp-autocomplete-dropdown-menu="true"]')
174
- .contains(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME)
162
+ cy.get('[data-fs-bp-autocomplete-dropdown-menu="bottom"]')
163
+ .contains(ADDRESS_NAME)
175
164
  .should("exist")
176
165
  .click();
177
166
 
178
167
  clickConfirmButton();
179
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
180
-
181
- cy.reload();
168
+ cy.contains("Address added successfully").should("be.visible");
182
169
 
170
+ useInternalSearch(ADDRESS_NAME);
183
171
  // Check to see if address has been added
184
- cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME).should("be.visible");
172
+ cy.contains(ADDRESS_NAME).should("be.visible");
185
173
  });
186
174
 
187
175
  it("Should be able to delete the address", () => {
188
- openAddressActionsDropdown(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME);
176
+ openAddressActionsDropdown(ADDRESS_NAME);
189
177
 
190
178
  cy.contains("Delete").click();
191
179
 
192
180
  // Fill check to allow deletion
193
- cy.get("[class=address-name-confirmation]").type(
194
- TEST_DATA.ADDRESS.NEW_ADDRESS_NAME
195
- );
181
+ cy.get("[class=address-name-confirmation]").type(ADDRESS_NAME);
196
182
 
197
183
  cy.get('[data-fs-bp-basic-drawer-button-variant="danger"]').click();
198
-
199
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
200
- cy.reload();
184
+ cy.contains("Address deleted successfully").should("be.visible");
201
185
 
202
186
  // Check if address has been deleted
203
- cy.contains(TEST_DATA.ADDRESS.NEW_ADDRESS_NAME).should("not.exist");
187
+ cy.contains(ADDRESS_NAME).should("not.exist");
204
188
  });
205
189
  });
@@ -1,12 +1,25 @@
1
1
  import { TEST_CONFIG, TEST_DATA } from "../constants";
2
- import { clickConfirmButton } from "../shared";
2
+ import { clickConfirmButton, generateRandomString } from "../shared";
3
3
 
4
4
  function navigateToBudgetByName(budgetName: string) {
5
5
  cy.get("[data-fs-bp-budgets-table]").within(() => {
6
- cy.contains(budgetName).should("be.visible").parent().parent().click();
6
+ cy.contains(budgetName).should("be.visible").parent().click();
7
7
  });
8
8
 
9
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
9
+ cy.get("[data-fs-bp-budgets-details-layout]", {
10
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
11
+ }).should("be.visible");
12
+ }
13
+
14
+ function checkFirstBudget() {
15
+ cy.get("body").then(($body) => {
16
+ const exists = $body
17
+ .html()
18
+ .includes(`data-fs-bp-budget-add-success-description-wrapper`);
19
+ if (exists) {
20
+ clickConfirmButton();
21
+ }
22
+ });
10
23
  }
11
24
 
12
25
  function generateDate(daysAfterToday = 1) {
@@ -26,44 +39,46 @@ function goToBudgetsPage() {
26
39
  // Navigate to Addresses page
27
40
  cy.contains("Budgets").click();
28
41
 
29
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
30
-
31
42
  // Check to see if contract details loaded correctly
32
- cy.get("[data-fs-bp-header-inside]").should("exist");
33
- cy.contains(TEST_DATA.PROFILE.TEST_CONTRACT_NAME).should("be.visible");
43
+ cy.get("[data-fs-bp-header-inside-title]", {
44
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
45
+ }).should("exist");
34
46
  }
35
47
 
36
48
  function openActionsDropdown(budgetName: string) {
37
49
  cy.get("[data-fs-bp-budgets-table]")
38
50
  .contains(budgetName)
39
51
  .parent()
40
- .parent()
41
52
  .find("[data-fs-bp-basic-dropdown-menu-trigger]")
42
53
  .click();
43
54
  }
44
55
 
45
- describe("Budgets list", () => {
56
+ let NEW_BUDGET_NAME: string;
57
+ let EDITED_BUDGET_NAME: string;
58
+
59
+ describe("Budgets list", { retries: 2 }, () => {
60
+ before(() => {
61
+ NEW_BUDGET_NAME = `${
62
+ TEST_DATA.BUDGET.FIRST_BUDGET_NAME
63
+ } ${generateRandomString()}`;
64
+ EDITED_BUDGET_NAME = `Edited ${NEW_BUDGET_NAME}`;
65
+ });
46
66
  beforeEach(() => {
67
+ // Visit the homepage
47
68
  cy.login();
48
69
 
49
- // Visit the homepage
50
70
  cy.visit(TEST_CONFIG.ROUTES.BUYER_PORTAL);
51
71
 
52
72
  // Go to Budget Page and check empty state
53
73
  goToBudgetsPage();
54
74
  });
55
- it("Create first budget", () => {
56
- // Check to see if the empty section loaded
57
- cy.get("[data-fs-empty-state]").should("exist");
58
-
75
+ it("Create budget", () => {
59
76
  // Open the Budget Creation modal
60
77
  cy.get('[data-fs-button-variant="primary"]').click();
61
78
 
62
79
  // Inside the modal, fill budget information
63
80
  cy.get("[data-fs-bp-add-budget-drawer]").within(() => {
64
- cy.get("[data-fs-bp-budget-name]").type(
65
- TEST_DATA.BUDGET.FIRST_BUDGET_NAME
66
- );
81
+ cy.get("[data-fs-bp-budget-name]").type(NEW_BUDGET_NAME);
67
82
  cy.get("[data-fs-bp-budget-amount]").type(TEST_DATA.BUDGET.BUDGET_AMOUNT);
68
83
  cy.get("[data-fs-bp-budget-start-date]").type(generateDate());
69
84
  cy.get("[data-fs-bp-budget-end-date]").type(generateDate(10));
@@ -73,77 +88,91 @@ describe("Budgets list", () => {
73
88
 
74
89
  clickConfirmButton();
75
90
 
76
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
91
+ cy.get("[data-fs-bp-budget-allocation-table]", {
92
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
93
+ }).should("be.visible");
94
+
95
+ cy.get("[data-fs-skeleton-shimmer]", {
96
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
97
+ }).should("not.exist");
77
98
 
78
99
  // Add Alocation
79
- cy.get("[data-fs-bp-budget-allocation-row-select-all]").check();
100
+ cy.get("[data-fs-bp-budget-allocation-row-select-all]").check({
101
+ force: true,
102
+ });
80
103
 
81
104
  clickConfirmButton();
82
105
 
83
- cy.contains(TEST_DATA.BUDGET.FIRST_BUDGET_MESSAGE).should("be.visible");
84
-
85
- clickConfirmButton();
106
+ // Deal with the possibility of being the first budget
107
+ checkFirstBudget();
86
108
 
87
- cy.reload();
109
+ cy.get("[data-fs-bp-budget-allocation-table]", {
110
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
111
+ }).should("not.exist");
88
112
 
89
113
  // Check to see if the table loaded and has the budget
90
114
  cy.get("[data-fs-bp-budgets-table]").should("exist");
91
- cy.contains(TEST_DATA.BUDGET.FIRST_BUDGET_NAME).should("be.visible");
115
+ cy.contains(NEW_BUDGET_NAME).should("be.visible");
92
116
  });
93
117
  it("Edit a budget from the list", () => {
94
118
  // Check to see if the table loaded and has the budget
95
119
  cy.get("[data-fs-bp-budgets-table]").should("exist");
96
- cy.contains(TEST_DATA.BUDGET.FIRST_BUDGET_NAME).should("be.visible");
120
+ cy.contains(NEW_BUDGET_NAME).should("be.visible");
97
121
 
98
- openActionsDropdown(TEST_DATA.BUDGET.FIRST_BUDGET_NAME);
122
+ openActionsDropdown(NEW_BUDGET_NAME);
99
123
 
100
124
  cy.contains("Edit settings").click();
101
125
 
102
- cy.get("[data-fs-bp-budget-name]")
103
- .clear()
104
- .type(TEST_DATA.BUDGET.EDIT_BUDGET_NAME);
126
+ cy.get("[data-fs-bp-budget-name]").clear().type(EDITED_BUDGET_NAME);
105
127
 
106
128
  clickConfirmButton();
107
129
 
108
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
109
-
110
- cy.reload();
130
+ cy.get("[data-fs-bp-edit-budget-drawer]").should("not.exist");
111
131
 
112
132
  // Check to see if the table loaded and has the budget
113
133
  cy.get("[data-fs-bp-budgets-table]").should("exist");
114
- cy.contains(TEST_DATA.BUDGET.EDIT_BUDGET_NAME).should("be.visible");
134
+ cy.contains(EDITED_BUDGET_NAME).should("be.visible");
115
135
  });
116
136
 
117
- it("Add Allocations from list", () => {
137
+ it("Add and check allocations from list", () => {
118
138
  // Check to see if the table loaded and has the budget
119
139
  cy.get("[data-fs-bp-budgets-table]").should("exist");
120
- cy.contains(TEST_DATA.BUDGET.EDIT_BUDGET_NAME).should("be.visible");
140
+ cy.contains(EDITED_BUDGET_NAME).should("be.visible");
121
141
 
122
- openActionsDropdown(TEST_DATA.BUDGET.EDIT_BUDGET_NAME);
142
+ openActionsDropdown(EDITED_BUDGET_NAME);
123
143
 
124
144
  cy.contains("Add allocations").click();
125
145
 
126
- cy.wait(1000);
146
+ cy.get("[data-fs-bp-budget-allocation-table]", {
147
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
148
+ }).should("be.visible");
127
149
 
128
150
  cy.get("[data-fs-bp-budget-allocation-select-current]").click();
129
151
 
130
152
  cy.contains("Users").click();
131
153
 
132
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
154
+ cy.get("[data-fs-bp-budget-allocation-row-name]", {
155
+ timeout: TEST_CONFIG.TIMEOUTS.RETRY_DELAY,
156
+ }).should("be.visible");
157
+
158
+ cy.get("[data-fs-skeleton-shimmer]", {
159
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
160
+ }).should("not.exist");
133
161
 
134
162
  // Add Alocation
135
- cy.get("[data-fs-bp-budget-allocation-row-select-all]").check();
163
+ cy.get("[data-fs-bp-budget-allocation-row-select-all]")
164
+ .scrollIntoView()
165
+ .check({ force: true });
166
+
167
+ cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
136
168
 
137
169
  clickConfirmButton();
138
170
 
139
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
140
- });
141
- it("Enter budget details and check allocations", () => {
142
- // Check to see if the table loaded and has the budget
143
- cy.get("[data-fs-bp-budgets-table]").should("exist");
144
- cy.contains(TEST_DATA.BUDGET.EDIT_BUDGET_NAME).should("be.visible");
171
+ cy.get("[data-fs-bp-budget-allocation-table]", {
172
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
173
+ }).should("not.exist");
145
174
 
146
- navigateToBudgetByName(TEST_DATA.BUDGET.EDIT_BUDGET_NAME);
175
+ navigateToBudgetByName(EDITED_BUDGET_NAME);
147
176
 
148
177
  cy.get("[data-fs-bp-budget-details-allocation-table]")
149
178
  .should("exist")
@@ -152,33 +181,34 @@ describe("Budgets list", () => {
152
181
  cy.contains(TEST_DATA.BUDGET.ALLOCATION_TYPE_2).should("exist");
153
182
  });
154
183
  });
155
-
156
184
  it("Delete a budget from list", () => {
157
185
  // Check to see if the table loaded and has the budget
158
186
  cy.get("[data-fs-bp-budgets-table]").should("exist");
159
- cy.contains(TEST_DATA.BUDGET.EDIT_BUDGET_NAME).should("be.visible");
187
+ cy.contains(EDITED_BUDGET_NAME).should("be.visible");
160
188
 
161
- openActionsDropdown(TEST_DATA.BUDGET.EDIT_BUDGET_NAME);
189
+ openActionsDropdown(EDITED_BUDGET_NAME);
162
190
 
163
191
  cy.contains("Delete").click();
164
192
 
165
193
  cy.get("[data-fs-bp-basic-drawer-body-wrapper]").within(() => {
166
- cy.get("[data-fs-bp-input-text-input]").type(
167
- TEST_DATA.BUDGET.EDIT_BUDGET_NAME,
168
- { delay: 500 }
169
- );
194
+ cy.get("[data-fs-bp-input-text-input]").type(EDITED_BUDGET_NAME, {
195
+ delay: 300,
196
+ });
170
197
  });
171
198
 
172
199
  cy.get('[data-fs-bp-basic-drawer-button-variant="danger"]').click();
173
200
 
174
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
175
-
176
- // Check to see if the empty section loaded
177
- cy.get("[data-fs-empty-state]").should("exist");
201
+ cy.get("[data-fs-bp-budget-delete-drawer]").should("not.exist");
178
202
  });
179
203
  });
180
204
 
181
205
  describe("Budget Details", () => {
206
+ before(() => {
207
+ NEW_BUDGET_NAME = `${
208
+ TEST_DATA.BUDGET.BUDGET_DETAILS_NAME
209
+ } ${generateRandomString()}`;
210
+ EDITED_BUDGET_NAME = `Edited ${NEW_BUDGET_NAME}`;
211
+ });
182
212
  beforeEach(() => {
183
213
  cy.login();
184
214
 
@@ -189,17 +219,12 @@ describe("Budget Details", () => {
189
219
  goToBudgetsPage();
190
220
  });
191
221
  it("Create budget", () => {
192
- // Check to see if the empty section loaded
193
- cy.get("[data-fs-empty-state]").should("exist");
194
-
195
222
  // Open the Budget Creation modal
196
223
  cy.get('[data-fs-button-variant="primary"]').click();
197
224
 
198
225
  // Inside the modal, fill budget information
199
226
  cy.get("[data-fs-bp-add-budget-drawer]").within(() => {
200
- cy.get("[data-fs-bp-budget-name]").type(
201
- TEST_DATA.BUDGET.BUDGET_DETAILS_NAME
202
- );
227
+ cy.get("[data-fs-bp-budget-name]").type(NEW_BUDGET_NAME);
203
228
  cy.get("[data-fs-bp-budget-amount]").type(TEST_DATA.BUDGET.BUDGET_AMOUNT);
204
229
  cy.get("[data-fs-bp-budget-start-date]").type(generateDate());
205
230
  cy.get("[data-fs-bp-budget-end-date]").type(generateDate(10));
@@ -209,59 +234,59 @@ describe("Budget Details", () => {
209
234
 
210
235
  clickConfirmButton();
211
236
 
212
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
237
+ cy.get("[data-fs-bp-budget-allocation-table]", {
238
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
239
+ }).should("be.visible");
240
+
241
+ cy.get("[data-fs-skeleton-shimmer]", {
242
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
243
+ }).should("not.exist");
213
244
 
214
245
  // Add Alocation
215
- cy.get("[data-fs-bp-budget-allocation-row-select-all]").check();
246
+ cy.get("[data-fs-bp-budget-allocation-row-select-all]").check({
247
+ force: true,
248
+ });
216
249
 
217
250
  clickConfirmButton();
218
251
 
219
- cy.contains(TEST_DATA.BUDGET.FIRST_BUDGET_MESSAGE).should("be.visible");
220
-
221
- clickConfirmButton();
252
+ checkFirstBudget();
222
253
 
223
- cy.reload();
254
+ cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
224
255
 
225
256
  // Check to see if the table loaded and has the budget
226
257
  cy.get("[data-fs-bp-budgets-table]").should("exist");
227
- cy.contains(TEST_DATA.BUDGET.BUDGET_DETAILS_NAME).should("be.visible");
258
+ cy.contains(NEW_BUDGET_NAME).should("be.visible");
228
259
  });
229
260
 
230
261
  it("Edit Inside Budget Details", () => {
231
- navigateToBudgetByName(TEST_DATA.BUDGET.BUDGET_DETAILS_NAME);
232
-
233
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
262
+ navigateToBudgetByName(NEW_BUDGET_NAME);
234
263
 
235
264
  cy.get("[data-fs-budget-settings-edit-button]").click();
236
- cy.get("[data-fs-bp-budget-name")
237
- .clear()
238
- .type(TEST_DATA.BUDGET.EDIT_BUDGET_DETAILS);
265
+ cy.get("[data-fs-bp-budget-name").clear().type(EDITED_BUDGET_NAME);
239
266
 
240
267
  clickConfirmButton();
241
268
 
242
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
269
+ cy.get("[data-fs-bp-edit-budget-drawer]").should("not.exist");
243
270
  cy.reload();
244
271
 
245
- cy.contains(TEST_DATA.BUDGET.EDIT_BUDGET_DETAILS).should("exist");
272
+ cy.contains(EDITED_BUDGET_NAME).should("exist");
246
273
  });
247
274
 
248
275
  it("Remove allocation inside details", () => {
249
- navigateToBudgetByName(TEST_DATA.BUDGET.EDIT_BUDGET_DETAILS);
250
-
251
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
276
+ navigateToBudgetByName(EDITED_BUDGET_NAME);
252
277
 
253
278
  cy.get("[data-fs-bp-budget-allocation-table-trash-icon]").click();
254
279
 
255
280
  cy.get("[data-fs-bp-delete-allocation-drawer-body]").within(() => {
256
281
  cy.get("[data-fs-bp-input-text-input]").type(
257
- TEST_DATA.CUSTOM_FIELDS.EXISTING_PO_NUMBER,
258
- { delay: 500 }
282
+ TEST_DATA.CUSTOM_FIELDS.EXISTING_PO_NUMBER
259
283
  );
260
284
  });
261
285
 
262
286
  clickConfirmButton();
263
287
 
264
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
288
+ cy.get("[data-fs-bp-delete-allocation-drawer]").should("not.exist");
289
+
265
290
  cy.reload();
266
291
 
267
292
  cy.get("[data-fs-empty-state-section]")
@@ -272,24 +297,33 @@ describe("Budget Details", () => {
272
297
  });
273
298
 
274
299
  it("Add alocation from inside details", () => {
275
- navigateToBudgetByName(TEST_DATA.BUDGET.EDIT_BUDGET_DETAILS);
300
+ navigateToBudgetByName(EDITED_BUDGET_NAME);
301
+ cy.get("[data-fs-budget-details-allocation-table-edit-button]").click();
276
302
 
277
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
303
+ cy.get("[data-fs-bp-budget-allocation-table]", {
304
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
305
+ }).should("be.visible");
278
306
 
279
- cy.get("[data-fs-budget-details-allocation-table-edit-button]").click();
307
+ cy.get("[data-fs-skeleton-shimmer]", {
308
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
309
+ }).should("not.exist");
280
310
 
281
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
311
+ cy.get("[data-fs-bp-budget-allocation-row-select-all]").check({
312
+ force: true,
313
+ });
282
314
 
283
- cy.get("[data-fs-bp-budget-allocation-row-select-all]").check();
315
+ cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
284
316
 
285
317
  clickConfirmButton();
286
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
287
- cy.reload();
318
+
319
+ cy.get("[data-fs-bp-budget-allocation-table]", {
320
+ timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
321
+ }).should("not.exist");
288
322
 
289
323
  cy.get("[data-fs-bp-budget-allocation-table-row-name-td]").should("exist");
290
324
  });
291
325
  it("Delete budget from inside details", () => {
292
- navigateToBudgetByName(TEST_DATA.BUDGET.EDIT_BUDGET_DETAILS);
326
+ navigateToBudgetByName(EDITED_BUDGET_NAME);
293
327
 
294
328
  cy.get("[data-fs-bp-budgets-details-header-wrapper]").within(() => {
295
329
  cy.get("[data-fs-bp-basic-dropdown-menu-trigger]").click();
@@ -300,17 +334,13 @@ describe("Budget Details", () => {
300
334
  cy.get("[data-fs-bp-input-wrapper]")
301
335
  .last()
302
336
  .within(() => {
303
- cy.get("[data-fs-bp-input-text-input]").type(
304
- TEST_DATA.BUDGET.EDIT_BUDGET_DETAILS,
305
- { delay: 500 }
306
- );
337
+ cy.get("[data-fs-bp-input-text-input]").type(EDITED_BUDGET_NAME, {
338
+ delay: 300,
339
+ });
307
340
  });
308
341
 
309
342
  cy.get('[data-fs-bp-basic-drawer-button-variant="danger"]').last().click();
310
343
 
311
- cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
312
-
313
- // Check to see if the empty section loaded
314
- cy.get("[data-fs-empty-state]").should("exist");
344
+ cy.get("[data-fs-bp-budget-delete-drawer]").should("not.exist");
315
345
  });
316
346
  });