@vtex/faststore-plugin-buyer-portal 1.1.92 → 1.1.94
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.
- package/cypress/constants.ts +4 -9
- package/cypress/integration/addresses.test.ts +39 -55
- package/cypress/integration/budgets.test.ts +130 -100
- package/cypress/integration/buying-policies.test.ts +66 -96
- package/cypress/integration/collections.test.ts +192 -172
- package/cypress/integration/credit-cards.test.ts +1 -1
- package/cypress/integration/locations.test.ts +39 -43
- package/cypress/integration/organizational-units.test.ts +70 -33
- package/cypress/integration/recipients.test.ts +34 -46
- package/cypress/integration/users.test.ts +83 -136
- package/cypress/shared.ts +32 -2
- package/cypress/support/addressHelper.tsx +17 -6
- package/package.json +1 -1
- package/public/buyer-portal-icons.svg +1 -1
- package/src/features/addresses/components/DeleteRecipientAddressDrawer/DeleteRecipientAddressDrawer.tsx +1 -1
- package/src/features/addresses/services/get-addresses-by-unit-id.service.ts +13 -1
- package/src/features/addresses/services/get-addresses.service.ts +15 -2
- package/src/features/buying-policies/services/get-buying-policies.service.ts +19 -21
- package/src/features/contracts/services/get-contract-details.service.ts +13 -1
- package/src/features/contracts/services/get-contracts-org-by-unit-id.service.ts +18 -11
- package/src/features/contracts/services/update-contract-status.service.ts +18 -11
- package/src/features/profile/layouts/ProfileLayout/profile-layout.scss +1 -0
- package/src/features/shared/clients/Client.ts +84 -8
- package/src/features/shared/components/BuyerPortalProvider/BuyerPortalProvider.tsx +4 -1
- package/src/features/shared/components/Error/Error.tsx +31 -0
- package/src/features/shared/components/Error/error.scss +71 -0
- package/src/features/shared/components/ErrorBoundary/ErrorBoundary.tsx +63 -0
- package/src/features/shared/components/ErrorBoundary/types.ts +14 -0
- package/src/features/shared/components/index.ts +3 -0
- package/src/features/shared/components/withErrorBoundary/withErrorBoundary.tsx +35 -0
- package/src/features/shared/layouts/BaseTabsLayout/SidebarMenu.tsx +9 -2
- package/src/features/shared/layouts/ContractTabsLayout/ContractTabsLayout.tsx +4 -2
- package/src/features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout.tsx +119 -0
- package/src/features/shared/layouts/ErrorTabsLayout/error-tabs-layout.scss +1 -0
- package/src/features/shared/utils/constants.ts +1 -1
- package/src/features/shared/utils/environment.ts +41 -0
- package/src/features/shared/utils/extractErrorMessage.ts +22 -0
- package/src/features/shared/utils/getHome.tsx +5 -0
- package/src/features/shared/utils/index.ts +2 -0
- package/src/features/shared/utils/withClientErrorBoundary.ts +61 -0
- package/src/features/shared/utils/withLoaderErrorBoundary.ts +46 -0
- package/src/features/users/clients/UsersClient.ts +0 -1
- package/src/pages/address-details.tsx +38 -11
- package/src/pages/addresses.tsx +35 -6
- package/src/pages/budgets-details.tsx +38 -8
- package/src/pages/budgets.tsx +33 -8
- package/src/pages/buying-policies.tsx +36 -12
- package/src/pages/buying-policy-details.tsx +38 -8
- package/src/pages/collections.tsx +36 -12
- package/src/pages/cost-centers.tsx +38 -8
- package/src/pages/credit-cards.tsx +38 -8
- package/src/pages/home.tsx +22 -5
- package/src/pages/org-unit-details.tsx +43 -7
- package/src/pages/org-units.tsx +39 -8
- package/src/pages/payment-methods.tsx +38 -8
- package/src/pages/po-numbers.tsx +38 -8
- package/src/pages/profile.tsx +31 -6
- package/src/pages/releases.tsx +33 -8
- package/src/pages/role-details.tsx +39 -7
- package/src/pages/roles.tsx +28 -7
- package/src/pages/user-details.tsx +39 -8
- package/src/pages/users.tsx +25 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TEST_CONFIG, TEST_DATA } from "../constants";
|
|
2
|
-
import { clickConfirmButton } from "../shared";
|
|
2
|
+
import { clickConfirmButton, generateRandomString } from "../shared";
|
|
3
3
|
import {
|
|
4
4
|
clickAddressTab,
|
|
5
5
|
goToAddressPage,
|
|
@@ -8,7 +8,14 @@ import {
|
|
|
8
8
|
openAddressActionsDropdown,
|
|
9
9
|
} from "../support/addressHelper";
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
let ADDRESS_NAME: string;
|
|
12
|
+
|
|
13
|
+
describe("Locations", { retries: 2 }, () => {
|
|
14
|
+
before(() => {
|
|
15
|
+
ADDRESS_NAME = `${
|
|
16
|
+
TEST_DATA.LOCATIONS.LOCATION_ADDRESS_NAME
|
|
17
|
+
} ${generateRandomString()}`;
|
|
18
|
+
});
|
|
12
19
|
beforeEach(() => {
|
|
13
20
|
cy.login();
|
|
14
21
|
// Visit the homepage
|
|
@@ -29,9 +36,7 @@ describe("Locations", () => {
|
|
|
29
36
|
});
|
|
30
37
|
|
|
31
38
|
// Address Name
|
|
32
|
-
cy.get("[data-fs-bp-autocomplete-dropdown]")
|
|
33
|
-
.eq(1)
|
|
34
|
-
.type(TEST_DATA.LOCATIONS.LOCATION_ADDRESS_NAME);
|
|
39
|
+
cy.get("[data-fs-bp-autocomplete-dropdown]").eq(1).type(ADDRESS_NAME);
|
|
35
40
|
|
|
36
41
|
// Street
|
|
37
42
|
cy.get("[class=street-address]").type(TEST_DATA.ADDRESS.NEW_ADDRESS_STREET);
|
|
@@ -66,15 +71,9 @@ describe("Locations", () => {
|
|
|
66
71
|
});
|
|
67
72
|
|
|
68
73
|
clickConfirmButton();
|
|
74
|
+
cy.contains("Address added successfully").should("be.visible");
|
|
69
75
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// Check to see if address was created
|
|
73
|
-
cy.get("[data-fs-addresses-table]")
|
|
74
|
-
.contains(TEST_DATA.LOCATIONS.LOCATION_ADDRESS_NAME)
|
|
75
|
-
.should("be.visible");
|
|
76
|
-
|
|
77
|
-
openAddressActionsDropdown(TEST_DATA.LOCATIONS.LOCATION_ADDRESS_NAME);
|
|
76
|
+
openAddressActionsDropdown(ADDRESS_NAME);
|
|
78
77
|
|
|
79
78
|
// Inside the Action dropdown, open locations drawer
|
|
80
79
|
cy.contains("Add Locations").click();
|
|
@@ -92,10 +91,12 @@ describe("Locations", () => {
|
|
|
92
91
|
|
|
93
92
|
clickConfirmButton();
|
|
94
93
|
|
|
95
|
-
cy.
|
|
94
|
+
cy.get("[data-fs-bp-location-form]", {
|
|
95
|
+
timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
|
|
96
|
+
}).should("not.exist");
|
|
96
97
|
});
|
|
97
98
|
it("Enter addressDetails and add locations", () => {
|
|
98
|
-
navigateToAddressByName(
|
|
99
|
+
navigateToAddressByName(ADDRESS_NAME);
|
|
99
100
|
|
|
100
101
|
clickAddressTab("Locations");
|
|
101
102
|
|
|
@@ -119,16 +120,14 @@ describe("Locations", () => {
|
|
|
119
120
|
|
|
120
121
|
clickConfirmButton();
|
|
121
122
|
|
|
122
|
-
cy.
|
|
123
|
-
|
|
123
|
+
cy.get("[data-fs-bp-location-form]", {
|
|
124
|
+
timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
|
|
125
|
+
}).should("not.exist");
|
|
124
126
|
|
|
125
|
-
cy.contains(
|
|
126
|
-
cy.contains(TEST_DATA.LOCATIONS.SECOND_LOCATION).should("be.visible");
|
|
127
|
-
cy.contains(TEST_DATA.LOCATIONS.THIRD_LOCATION).should("be.visible");
|
|
128
|
-
cy.contains(TEST_DATA.LOCATIONS.FOURTH_LOCATION).should("be.visible");
|
|
127
|
+
cy.contains("Locations added successfully").should("exist");
|
|
129
128
|
});
|
|
130
129
|
it("Enter addressDetails and edit location", () => {
|
|
131
|
-
navigateToAddressByName(
|
|
130
|
+
navigateToAddressByName(ADDRESS_NAME);
|
|
132
131
|
|
|
133
132
|
clickAddressTab("Locations");
|
|
134
133
|
|
|
@@ -140,21 +139,20 @@ describe("Locations", () => {
|
|
|
140
139
|
cy.get("[data-fs-bp-input-text-input]")
|
|
141
140
|
.clear()
|
|
142
141
|
.type(TEST_DATA.LOCATIONS.EDITED_LOCATION);
|
|
143
|
-
|
|
144
|
-
// Save
|
|
145
|
-
clickConfirmButton();
|
|
146
|
-
|
|
147
|
-
// Confirm shared
|
|
148
|
-
clickConfirmButton();
|
|
149
142
|
});
|
|
143
|
+
// Save
|
|
144
|
+
clickConfirmButton();
|
|
150
145
|
|
|
151
|
-
|
|
152
|
-
|
|
146
|
+
// Confirm shared
|
|
147
|
+
clickConfirmButton();
|
|
148
|
+
cy.get("[data-fs-bp-location-form]", {
|
|
149
|
+
timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
|
|
150
|
+
}).should("not.exist");
|
|
153
151
|
|
|
154
|
-
cy.contains(
|
|
152
|
+
cy.contains("Location edited successfully").should("exist");
|
|
155
153
|
});
|
|
156
154
|
it("Delete one location", () => {
|
|
157
|
-
navigateToAddressByName(
|
|
155
|
+
navigateToAddressByName(ADDRESS_NAME);
|
|
158
156
|
|
|
159
157
|
clickAddressTab("Locations");
|
|
160
158
|
|
|
@@ -175,26 +173,24 @@ describe("Locations", () => {
|
|
|
175
173
|
|
|
176
174
|
cy.get('[data-fs-bp-basic-drawer-button-variant="danger"').click();
|
|
177
175
|
|
|
178
|
-
cy.
|
|
176
|
+
cy.get("[data-fs-bp-location-form]", {
|
|
177
|
+
timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
|
|
178
|
+
}).should("not.exist");
|
|
179
179
|
|
|
180
|
-
cy.contains(
|
|
180
|
+
cy.contains("Location removed successfully").should("exist");
|
|
181
181
|
});
|
|
182
182
|
it("Delete Address Test", () => {
|
|
183
|
-
openAddressActionsDropdown(
|
|
183
|
+
openAddressActionsDropdown(ADDRESS_NAME);
|
|
184
184
|
|
|
185
185
|
cy.contains("Delete").click();
|
|
186
186
|
|
|
187
187
|
// Fill check to allow deletion
|
|
188
|
-
cy.get("[class=address-name-confirmation]").type(
|
|
189
|
-
TEST_DATA.LOCATIONS.LOCATION_ADDRESS_NAME
|
|
190
|
-
);
|
|
188
|
+
cy.get("[class=address-name-confirmation]").type(ADDRESS_NAME);
|
|
191
189
|
|
|
192
190
|
cy.get('[data-fs-bp-basic-drawer-button-variant="danger"]').click();
|
|
193
191
|
|
|
194
|
-
cy.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
// Check if address has been deleted
|
|
198
|
-
cy.contains(TEST_DATA.LOCATIONS.LOCATION_ADDRESS_NAME).should("not.exist");
|
|
192
|
+
cy.contains("Address deleted successfully", {
|
|
193
|
+
timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
|
|
194
|
+
}).should("be.visible");
|
|
199
195
|
});
|
|
200
196
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TEST_CONFIG, TEST_DATA } from "../constants";
|
|
2
|
+
import { generateRandomString, useInternalSearch } from "../shared";
|
|
2
3
|
|
|
3
4
|
const verifyOrgUnitState = (
|
|
4
5
|
orgUnitName: string,
|
|
@@ -6,10 +7,19 @@ const verifyOrgUnitState = (
|
|
|
6
7
|
maxRetries = TEST_CONFIG.RETRY.DEFAULT_MAX_ATTEMPTS
|
|
7
8
|
) => {
|
|
8
9
|
const verifyAndRetry = (currentRetry = 0) => {
|
|
9
|
-
|
|
10
|
+
if (shouldExist) {
|
|
11
|
+
cy.get("[data-fs-org-units-section]", {
|
|
12
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
13
|
+
}).should("exist");
|
|
14
|
+
|
|
15
|
+
useInternalSearch(orgUnitName);
|
|
16
|
+
} else {
|
|
17
|
+
cy.get("[data-fs-buyer-portal-internal-search-input]").clear();
|
|
18
|
+
}
|
|
10
19
|
|
|
11
20
|
cy.get("body").then(($body) => {
|
|
12
21
|
const exists = $body.text().includes(orgUnitName);
|
|
22
|
+
cy.log("Searching for Org Unit", orgUnitName, exists);
|
|
13
23
|
if (exists !== shouldExist && currentRetry < maxRetries) {
|
|
14
24
|
cy.log(`Retry attempt ${currentRetry + 1} of ${maxRetries}`);
|
|
15
25
|
cy.wait(TEST_CONFIG.TIMEOUTS.RETRY_DELAY);
|
|
@@ -28,29 +38,43 @@ const verifyOrgUnitState = (
|
|
|
28
38
|
|
|
29
39
|
// Final verification
|
|
30
40
|
if (shouldExist) {
|
|
31
|
-
cy.contains(orgUnitName).should("be.visible");
|
|
41
|
+
cy.contains(orgUnitName).scrollIntoView().should("be.visible");
|
|
32
42
|
} else {
|
|
33
43
|
cy.contains(orgUnitName).should("not.exist");
|
|
34
44
|
}
|
|
35
45
|
};
|
|
36
46
|
|
|
37
|
-
|
|
47
|
+
let UNIT_NAME: string;
|
|
48
|
+
let EDITED_UNIT_NAME: string;
|
|
49
|
+
|
|
50
|
+
describe("Organizational Units", { retries: 2 }, () => {
|
|
51
|
+
before(() => {
|
|
52
|
+
UNIT_NAME = `${TEST_DATA.ORG_UNITS.NEW_UNIT} ${generateRandomString()}`;
|
|
53
|
+
EDITED_UNIT_NAME = `Edited ${UNIT_NAME}`;
|
|
54
|
+
});
|
|
38
55
|
beforeEach(() => {
|
|
39
56
|
cy.login();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("Should load successfully", () => {
|
|
43
57
|
// Visit the homepage
|
|
44
58
|
cy.visit(TEST_CONFIG.ROUTES.BUYER_PORTAL);
|
|
59
|
+
});
|
|
45
60
|
|
|
61
|
+
it("Should load successfully", () => {
|
|
46
62
|
// Navigate to organizational units page
|
|
47
63
|
cy.contains("Organizational Units").click();
|
|
48
64
|
|
|
49
65
|
// Wait for the page to be fully loaded by checking for specific elements
|
|
50
|
-
cy.get("[data-fs-org-units-section]"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
cy.
|
|
66
|
+
cy.get("[data-fs-org-units-section]", {
|
|
67
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
68
|
+
}).should("exist");
|
|
69
|
+
cy.get("[data-fs-hierarchy-tree-wrapper]", {
|
|
70
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
71
|
+
}).should("exist");
|
|
72
|
+
|
|
73
|
+
// Make sure that a change in order doesn't break the test
|
|
74
|
+
useInternalSearch(TEST_DATA.ORG_UNITS.CHILD_1);
|
|
75
|
+
cy.contains(TEST_DATA.ORG_UNITS.CHILD_1)
|
|
76
|
+
.scrollIntoView()
|
|
77
|
+
.should("be.visible");
|
|
54
78
|
|
|
55
79
|
// Check if the page loads without errors
|
|
56
80
|
cy.window().should("exist");
|
|
@@ -58,17 +82,20 @@ describe("Organizational Units", () => {
|
|
|
58
82
|
});
|
|
59
83
|
|
|
60
84
|
it("Should load org unit details page successfully", () => {
|
|
61
|
-
// Visit the homepage and navigate to org units
|
|
62
|
-
cy.visit(TEST_CONFIG.ROUTES.BUYER_PORTAL);
|
|
63
85
|
cy.contains("Organizational Units").click();
|
|
64
86
|
|
|
65
87
|
// Wait for the org units page to be fully loaded
|
|
66
|
-
cy.get("[data-fs-org-units-section]"
|
|
67
|
-
|
|
88
|
+
cy.get("[data-fs-org-units-section]", {
|
|
89
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
90
|
+
}).should("exist");
|
|
91
|
+
cy.get("[data-fs-hierarchy-tree-wrapper]", {
|
|
92
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
93
|
+
}).should("exist");
|
|
68
94
|
|
|
69
95
|
// Check if the organizational units tree is visible and expand nodes
|
|
70
96
|
cy.get("[data-fs-org-unit-item-name]")
|
|
71
97
|
.contains(TEST_DATA.ORG_UNITS.CHILD_2)
|
|
98
|
+
.scrollIntoView()
|
|
72
99
|
.should("be.visible")
|
|
73
100
|
.parents("[data-fs-org-unit-item]")
|
|
74
101
|
.find("[data-fs-org-unit-item-toggle]")
|
|
@@ -78,10 +105,12 @@ describe("Organizational Units", () => {
|
|
|
78
105
|
// Wait for the child nodes to be visible after expanding
|
|
79
106
|
cy.get("[data-fs-hierarchy-tree-structure]")
|
|
80
107
|
.contains("[data-fs-org-unit-item-name]", TEST_DATA.ORG_UNITS.CHILD_2_1)
|
|
108
|
+
.scrollIntoView()
|
|
81
109
|
.should("be.visible");
|
|
82
110
|
|
|
83
111
|
cy.get("[data-fs-org-unit-item-name]")
|
|
84
112
|
.contains("Org Unit for E2E Tests Child 1")
|
|
113
|
+
.scrollIntoView()
|
|
85
114
|
.should("be.visible")
|
|
86
115
|
.parents("[data-fs-org-unit-item]")
|
|
87
116
|
.find("[data-fs-org-unit-item-toggle]")
|
|
@@ -91,17 +120,22 @@ describe("Organizational Units", () => {
|
|
|
91
120
|
// Wait for the child nodes to be visible after expanding
|
|
92
121
|
cy.get("[data-fs-hierarchy-tree-structure]")
|
|
93
122
|
.contains("[data-fs-org-unit-item-name]", TEST_DATA.ORG_UNITS.CHILD_1_1)
|
|
123
|
+
.scrollIntoView()
|
|
94
124
|
.should("be.visible");
|
|
95
125
|
});
|
|
96
126
|
|
|
97
127
|
it("Should display org unit details page correctly", () => {
|
|
98
|
-
// Visit the homepage and navigate to org units
|
|
99
|
-
cy.visit(TEST_CONFIG.ROUTES.BUYER_PORTAL);
|
|
100
128
|
cy.contains("Organizational Units").click();
|
|
101
129
|
|
|
102
130
|
// Wait for the org units page to be fully loaded
|
|
103
|
-
cy.get("[data-fs-org-units-section]"
|
|
104
|
-
|
|
131
|
+
cy.get("[data-fs-org-units-section]", {
|
|
132
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
133
|
+
}).should("exist");
|
|
134
|
+
cy.get("[data-fs-hierarchy-tree-wrapper]", {
|
|
135
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
136
|
+
}).should("exist");
|
|
137
|
+
|
|
138
|
+
useInternalSearch(TEST_DATA.ORG_UNITS.CHILD_1);
|
|
105
139
|
|
|
106
140
|
// Click on an org unit to go to details page
|
|
107
141
|
cy.get("[data-fs-org-unit-item-name]")
|
|
@@ -150,9 +184,6 @@ describe("Organizational Units", () => {
|
|
|
150
184
|
});
|
|
151
185
|
|
|
152
186
|
it("Should perform CRUD operations on organization unit", () => {
|
|
153
|
-
// Visit the org unit details page directly
|
|
154
|
-
cy.visit(TEST_CONFIG.ROUTES.BUYER_PORTAL);
|
|
155
|
-
|
|
156
187
|
// Wait for the page to be fully loaded
|
|
157
188
|
cy.get("[data-fs-org-units-details-section]").should("exist");
|
|
158
189
|
|
|
@@ -171,7 +202,7 @@ describe("Organizational Units", () => {
|
|
|
171
202
|
.contains("Name")
|
|
172
203
|
.parent()
|
|
173
204
|
.find("[data-fs-bp-input-text-input]")
|
|
174
|
-
.type(
|
|
205
|
+
.type(UNIT_NAME);
|
|
175
206
|
|
|
176
207
|
// Click on Add button and verify creation
|
|
177
208
|
cy.contains("button", "Add").click();
|
|
@@ -179,12 +210,15 @@ describe("Organizational Units", () => {
|
|
|
179
210
|
// Navigate to organizational units page
|
|
180
211
|
cy.contains("Organizational Units").click();
|
|
181
212
|
|
|
213
|
+
cy.get("[data-fs-hierarchy-tree-wrapper]", {
|
|
214
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
215
|
+
}).should("be.visible");
|
|
182
216
|
// Verify the org unit was created
|
|
183
|
-
verifyOrgUnitState(
|
|
217
|
+
verifyOrgUnitState(UNIT_NAME, true);
|
|
184
218
|
|
|
185
219
|
// Click on the more actions button for renaming
|
|
186
220
|
cy.get("[data-fs-org-unit-item-name]")
|
|
187
|
-
.contains(
|
|
221
|
+
.contains(UNIT_NAME)
|
|
188
222
|
.parents("[data-fs-org-unit-item]")
|
|
189
223
|
.find("[data-fs-bp-basic-dropdown-menu-trigger]")
|
|
190
224
|
.click();
|
|
@@ -194,19 +228,20 @@ describe("Organizational Units", () => {
|
|
|
194
228
|
|
|
195
229
|
// Verify the rename drawer is open and type the new name
|
|
196
230
|
cy.contains("Edit organization unit").should("be.visible");
|
|
197
|
-
cy.get("[data-fs-bp-input-text-input]")
|
|
198
|
-
.clear()
|
|
199
|
-
.type(TEST_DATA.ORG_UNITS.EDITED_UNIT);
|
|
231
|
+
cy.get("[data-fs-bp-input-text-input]").clear().type(EDITED_UNIT_NAME);
|
|
200
232
|
|
|
201
233
|
// Click on Save button and verify the rename
|
|
202
234
|
cy.contains("button", "Save").click();
|
|
203
235
|
|
|
236
|
+
cy.get("[data-fs-bp-update-org-unit-drawer]", {
|
|
237
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
238
|
+
}).should("not.exist");
|
|
204
239
|
// Verify the org unit was renamed
|
|
205
|
-
verifyOrgUnitState(
|
|
240
|
+
verifyOrgUnitState(EDITED_UNIT_NAME, true);
|
|
206
241
|
|
|
207
242
|
// Click on the more actions button for deleting
|
|
208
243
|
cy.get("[data-fs-org-unit-item-name]")
|
|
209
|
-
.contains(
|
|
244
|
+
.contains(EDITED_UNIT_NAME)
|
|
210
245
|
.parents("[data-fs-org-unit-item]")
|
|
211
246
|
.find("[data-fs-bp-basic-dropdown-menu-trigger]")
|
|
212
247
|
.click();
|
|
@@ -216,14 +251,16 @@ describe("Organizational Units", () => {
|
|
|
216
251
|
|
|
217
252
|
// Verify the delete drawer is open and type the org unit name to confirm
|
|
218
253
|
cy.contains("Delete organizational unit").should("be.visible");
|
|
219
|
-
cy.get("[data-fs-bp-input-text-input]").type(
|
|
220
|
-
TEST_DATA.ORG_UNITS.EDITED_UNIT
|
|
221
|
-
);
|
|
254
|
+
cy.get("[data-fs-bp-input-text-input]").type(EDITED_UNIT_NAME);
|
|
222
255
|
|
|
223
256
|
// Click on Delete button and verify deletion
|
|
224
257
|
cy.contains("button", "Delete").click();
|
|
225
258
|
|
|
259
|
+
cy.get("[data-fs-bp-delete-org-unit-drawer]", {
|
|
260
|
+
timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
|
|
261
|
+
}).should("not.exist");
|
|
262
|
+
|
|
226
263
|
// Verify the org unit was deleted
|
|
227
|
-
verifyOrgUnitState(
|
|
264
|
+
verifyOrgUnitState(EDITED_UNIT_NAME, false);
|
|
228
265
|
});
|
|
229
266
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TEST_CONFIG, TEST_DATA } from "../constants";
|
|
2
|
-
import { clickConfirmButton } from "../shared";
|
|
2
|
+
import { clickConfirmButton, generateRandomString } from "../shared";
|
|
3
3
|
import {
|
|
4
4
|
clickAddressTab,
|
|
5
5
|
goToAddressPage,
|
|
@@ -8,7 +8,14 @@ import {
|
|
|
8
8
|
openAddressActionsDropdown,
|
|
9
9
|
} from "../support/addressHelper";
|
|
10
10
|
|
|
11
|
+
let ADDRESS_NAME: string;
|
|
12
|
+
|
|
11
13
|
describe("Recipients", () => {
|
|
14
|
+
before(() => {
|
|
15
|
+
ADDRESS_NAME = `${
|
|
16
|
+
TEST_DATA.RECIPIENTS.RECIPIENTS_ADDRESS_NAME
|
|
17
|
+
} ${generateRandomString()}`;
|
|
18
|
+
});
|
|
12
19
|
beforeEach(() => {
|
|
13
20
|
cy.login();
|
|
14
21
|
|
|
@@ -30,9 +37,7 @@ describe("Recipients", () => {
|
|
|
30
37
|
});
|
|
31
38
|
|
|
32
39
|
// Address Name
|
|
33
|
-
cy.get("[data-fs-bp-autocomplete-dropdown]")
|
|
34
|
-
.eq(1)
|
|
35
|
-
.type(TEST_DATA.RECIPIENTS.RECIPIENTS_ADDRESS_NAME);
|
|
40
|
+
cy.get("[data-fs-bp-autocomplete-dropdown]").eq(1).type(ADDRESS_NAME);
|
|
36
41
|
|
|
37
42
|
// Street
|
|
38
43
|
cy.get("[class=street-address]").type(TEST_DATA.ADDRESS.NEW_ADDRESS_STREET);
|
|
@@ -68,14 +73,8 @@ describe("Recipients", () => {
|
|
|
68
73
|
|
|
69
74
|
clickConfirmButton();
|
|
70
75
|
|
|
71
|
-
cy.
|
|
72
|
-
|
|
73
|
-
// Check to see if address was created
|
|
74
|
-
cy.get("[data-fs-addresses-table]")
|
|
75
|
-
.contains(TEST_DATA.RECIPIENTS.RECIPIENTS_ADDRESS_NAME)
|
|
76
|
-
.should("be.visible");
|
|
77
|
-
|
|
78
|
-
openAddressActionsDropdown(TEST_DATA.RECIPIENTS.RECIPIENTS_ADDRESS_NAME);
|
|
76
|
+
cy.contains("Address added successfully").should("be.visible");
|
|
77
|
+
openAddressActionsDropdown(ADDRESS_NAME);
|
|
79
78
|
|
|
80
79
|
// Inside the Action dropdown, open recipients drawer
|
|
81
80
|
cy.contains("Add Recipients").click();
|
|
@@ -101,10 +100,12 @@ describe("Recipients", () => {
|
|
|
101
100
|
|
|
102
101
|
clickConfirmButton();
|
|
103
102
|
|
|
104
|
-
cy.
|
|
103
|
+
cy.get("[data-fs-bp-recipients-form]", {
|
|
104
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
105
|
+
}).should("not.exist");
|
|
105
106
|
});
|
|
106
107
|
it("Enter addressDetails and add recipients", () => {
|
|
107
|
-
navigateToAddressByName(
|
|
108
|
+
navigateToAddressByName(ADDRESS_NAME);
|
|
108
109
|
|
|
109
110
|
clickAddressTab("Recipients");
|
|
110
111
|
|
|
@@ -138,20 +139,14 @@ describe("Recipients", () => {
|
|
|
138
139
|
|
|
139
140
|
clickConfirmButton();
|
|
140
141
|
|
|
141
|
-
cy.
|
|
142
|
-
|
|
142
|
+
cy.get("[data-fs-bp-recipients-form]", {
|
|
143
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
144
|
+
}).should("not.exist");
|
|
143
145
|
|
|
144
|
-
cy.contains(
|
|
145
|
-
cy.contains(TEST_DATA.RECIPIENTS.SECOND_RECIPIENT_NAME).should(
|
|
146
|
-
"be.visible"
|
|
147
|
-
);
|
|
148
|
-
cy.contains(TEST_DATA.RECIPIENTS.THIRD_RECIPIENT_NAME).should("be.visible");
|
|
149
|
-
cy.contains(TEST_DATA.RECIPIENTS.FOURTH_RECIPIENT_NAME).should(
|
|
150
|
-
"be.visible"
|
|
151
|
-
);
|
|
146
|
+
cy.contains("Recipients added successfully").should("exist");
|
|
152
147
|
});
|
|
153
148
|
it("Enter addressDetails and edit recipients", () => {
|
|
154
|
-
navigateToAddressByName(
|
|
149
|
+
navigateToAddressByName(ADDRESS_NAME);
|
|
155
150
|
|
|
156
151
|
clickAddressTab("Recipients");
|
|
157
152
|
|
|
@@ -170,17 +165,14 @@ describe("Recipients", () => {
|
|
|
170
165
|
|
|
171
166
|
clickConfirmButton();
|
|
172
167
|
|
|
173
|
-
cy.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
clickAddressTab("Recipients");
|
|
177
|
-
|
|
178
|
-
cy.wait(TEST_CONFIG.TIMEOUTS.PAGE_LOAD);
|
|
168
|
+
cy.get("[data-fs-bp-recipients-form]", {
|
|
169
|
+
timeout: TEST_CONFIG.TIMEOUTS.LONG_DELAY,
|
|
170
|
+
}).should("not.exist");
|
|
179
171
|
|
|
180
|
-
cy.contains(
|
|
172
|
+
cy.contains("Recipient edited successfully").should("exist");
|
|
181
173
|
});
|
|
182
174
|
it("Delete one recipient", () => {
|
|
183
|
-
navigateToAddressByName(
|
|
175
|
+
navigateToAddressByName(ADDRESS_NAME);
|
|
184
176
|
|
|
185
177
|
clickAddressTab("Recipients");
|
|
186
178
|
|
|
@@ -201,28 +193,24 @@ describe("Recipients", () => {
|
|
|
201
193
|
|
|
202
194
|
cy.get('[data-fs-bp-basic-drawer-button-variant="danger"').click();
|
|
203
195
|
|
|
204
|
-
cy.
|
|
196
|
+
cy.get("[data-fs-bp-remove-recipient-form]", {
|
|
197
|
+
timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
|
|
198
|
+
}).should("not.exist");
|
|
205
199
|
|
|
206
|
-
cy.contains(
|
|
200
|
+
cy.contains("Recipient deleted successfully").should("exist");
|
|
207
201
|
});
|
|
208
202
|
it("Delete Address Test", () => {
|
|
209
|
-
openAddressActionsDropdown(
|
|
203
|
+
openAddressActionsDropdown(ADDRESS_NAME);
|
|
210
204
|
|
|
211
205
|
cy.contains("Delete").click();
|
|
212
206
|
|
|
213
207
|
// Fill check to allow deletion
|
|
214
|
-
cy.get("[class=address-name-confirmation]").type(
|
|
215
|
-
TEST_DATA.RECIPIENTS.RECIPIENTS_ADDRESS_NAME
|
|
216
|
-
);
|
|
208
|
+
cy.get("[class=address-name-confirmation]").type(ADDRESS_NAME);
|
|
217
209
|
|
|
218
210
|
cy.get('[data-fs-bp-basic-drawer-button-variant="danger"]').click();
|
|
219
211
|
|
|
220
|
-
cy.
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
// Check if address has been deleted
|
|
224
|
-
cy.contains(TEST_DATA.RECIPIENTS.RECIPIENTS_ADDRESS_NAME).should(
|
|
225
|
-
"not.exist"
|
|
226
|
-
);
|
|
212
|
+
cy.contains("Address deleted successfully", {
|
|
213
|
+
timeout: TEST_CONFIG.TIMEOUTS.PAGE_LOAD,
|
|
214
|
+
}).should("be.visible");
|
|
227
215
|
});
|
|
228
216
|
});
|