Skip to content

Commit 0bb249f

Browse files
ngodugu-marklogicMarkLogic Builder
authored andcommitted
DHFPROD-6681 - Refactoring the existing e2e scripts
1 parent fc7674f commit 0bb249f

25 files changed

+2781
-2903
lines changed
Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ describe("Add Matching step to a flow", () => {
3333
cy.deleteFlows("matchE2ETest", "matchE2ETestRun");
3434
cy.resetTestUser();
3535
});
36-
it("Navigating to curate tab", () => {
36+
it("Navigating to Customer Match tab", () => {
3737
cy.waitUntil(() => toolbar.getCurateToolbarIcon()).click();
3838
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
39-
});
40-
it("Open Customer entity", () => {
4139
curatePage.toggleEntityTypeId("Customer");
4240
curatePage.selectMatchTab("Customer");
4341
});
@@ -51,54 +49,46 @@ describe("Add Matching step to a flow", () => {
5149
cy.waitForAsyncRequest();
5250
curatePage.verifyStepNameIsVisible(matchStep);
5351
});
54-
it("Create match step with duplicate name", () => {
52+
it("Create match step with duplicate name and verify duplicate name modal is displayed", () => {
5553
cy.waitUntil(() => curatePage.addNewStep()).click();
5654
createEditStepDialog.stepNameInput().type(matchStep);
5755
createEditStepDialog.setSourceRadio("Query");
5856
createEditStepDialog.setQueryInput("test");
5957
createEditStepDialog.saveButton("matching").click();
6058
cy.waitForAsyncRequest();
61-
});
62-
it("Verify duplicate name modal is displayed", () => {
6359
loadPage.duplicateStepErrorMessage();
6460
loadPage.confirmationOptions("OK").click();
6561
loadPage.duplicateStepErrorMessageClosed();
6662
});
67-
it("Add the Match step to new flow and validate the step was added", () => {
63+
it("Add the Match step to new flow and Run the step(new)", () => {
6864
curatePage.addToNewFlow("Customer", matchStep);
6965
cy.findByText("New Flow").should("be.visible");
7066
runPage.setFlowName(flowName1);
7167
runPage.setFlowDescription(`${flowName1} description`);
7268
loadPage.confirmationOptions("Save").click();
7369
cy.waitForAsyncRequest();
7470
cy.verifyStepAddedToFlow("Match", matchStep);
75-
});
76-
it("Run the match step and verify success message(new)", () => {
7771
runPage.runStep(matchStep).click();
7872
cy.waitForAsyncRequest();
7973
cy.verifyStepRunResult("success", "Matching", matchStep);
8074
tiles.closeRunMessage();
8175
});
82-
it("Delete the step", () => {
76+
it("Delete the step and Navigate back to match tab", () => {
8377
runPage.deleteStep(matchStep).click();
8478
loadPage.confirmationOptions("Yes").click();
8579
cy.waitForAsyncRequest();
86-
});
87-
it("Navigate back to match tab", () => {
8880
cy.waitUntil(() => toolbar.getCurateToolbarIcon()).click();
8981
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
9082
curatePage.toggleEntityTypeId("Customer");
9183
curatePage.selectMatchTab("Customer");
9284
});
93-
it("Add the Match step to an existing flow and validate the step was added", () => {
85+
it("Add the Match step to an existing flow and Run the step(existing)", () => {
9486
curatePage.openExistingFlowDropdown("Customer", matchStep);
9587
curatePage.getExistingFlowFromDropdown(flowName1).click();
9688
curatePage.addStepToFlowConfirmationMessage();
9789
curatePage.confirmAddStepToFlow(matchStep, flowName1);
9890
cy.waitForAsyncRequest();
9991
cy.verifyStepAddedToFlow("Match", matchStep);
100-
});
101-
it("Run the match step and verify success message(existing)", () => {
10292
runPage.runStep(matchStep).click();
10393
cy.waitForAsyncRequest();
10494
cy.verifyStepRunResult("success", "Matching", matchStep);
@@ -128,12 +118,10 @@ describe("Add Matching step to a flow", () => {
128118
cy.verifyStepRunResult("success", "Matching", matchStep);
129119
tiles.closeRunMessage();
130120
});
131-
it("Delete the match step", () => {
121+
it("Delete the match step and Navigate back to match tab", () => {
132122
runPage.deleteStep(matchStep).click();
133123
loadPage.confirmationOptions("Yes").click();
134124
cy.waitForAsyncRequest();
135-
});
136-
it("Navigating to match tab", () => {
137125
cy.waitUntil(() => toolbar.getCurateToolbarIcon()).click();
138126
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
139127
curatePage.toggleEntityTypeId("Customer");
Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ describe("Add Merge step to a flow", () => {
3333
cy.deleteFlows("mergeE2ETest", "mergeE2ETestRun");
3434
cy.resetTestUser();
3535
});
36-
it("Navigating to curate tab", () => {
36+
it("Navigating to Customer Merge tab", () => {
3737
cy.waitUntil(() => toolbar.getCurateToolbarIcon()).click();
3838
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
39-
});
40-
it("Open Customer entity", () => {
4139
curatePage.toggleEntityTypeId("Customer");
4240
curatePage.selectMergeTab("Customer");
4341
});
@@ -52,55 +50,47 @@ describe("Add Merge step to a flow", () => {
5250
cy.waitForAsyncRequest();
5351
curatePage.verifyStepNameIsVisible(mergeStep);
5452
});
55-
it("Create merge step with duplicate name", () => {
53+
it("Create merge step with duplicate name and verify duplicate name modal is displayed", () => {
5654
cy.waitUntil(() => curatePage.addNewStep()).click();
5755
createEditStepDialog.stepNameInput().type(mergeStep);
5856
createEditStepDialog.stepDescriptionInput().type("merge order step example");
5957
createEditStepDialog.setSourceRadio("Query");
6058
createEditStepDialog.setQueryInput("test");
6159
createEditStepDialog.saveButton("merging").click();
6260
cy.waitForAsyncRequest();
63-
});
64-
it("Verify duplicate name modal is displayed", () => {
6561
loadPage.duplicateStepErrorMessage();
6662
loadPage.confirmationOptions("OK").click();
6763
loadPage.duplicateStepErrorMessageClosed();
6864
});
69-
it("Add the Merge step to new flow and validate the step was added", () => {
65+
it("Add the Merge step to new flow and Run the step(new)", () => {
7066
curatePage.addToNewFlow("Customer", mergeStep);
7167
cy.findByText("New Flow").should("be.visible");
7268
runPage.setFlowName(flowName1);
7369
runPage.setFlowDescription(`${flowName1} description`);
7470
loadPage.confirmationOptions("Save").click();
7571
cy.waitForAsyncRequest();
7672
cy.verifyStepAddedToFlow("Merge", mergeStep);
77-
});
78-
it("Run the merge step and verify success message(new)", () => {
7973
runPage.runStep(mergeStep).click();
8074
cy.waitForAsyncRequest();
8175
cy.verifyStepRunResult("success", "Merging", mergeStep);
8276
tiles.closeRunMessage();
8377
});
84-
it("Delete the step", () => {
78+
it("Delete the step and Navigate back to merge tab", () => {
8579
runPage.deleteStep(mergeStep).click();
8680
loadPage.confirmationOptions("Yes").click();
8781
cy.waitForAsyncRequest();
88-
});
89-
it("Navigate back to merge tab", () => {
9082
cy.waitUntil(() => toolbar.getCurateToolbarIcon()).click();
9183
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
9284
curatePage.toggleEntityTypeId("Customer");
9385
curatePage.selectMergeTab("Customer");
9486
});
95-
it("Add the Merge step to an existing flow and validate the step was added", () => {
87+
it("Add the Merge step to an existing flow and Run the step(existing)", () => {
9688
curatePage.openExistingFlowDropdown("Customer", mergeStep);
9789
curatePage.getExistingFlowFromDropdown(flowName1).click();
9890
curatePage.addStepToFlowConfirmationMessage();
9991
curatePage.confirmAddStepToFlow(mergeStep, flowName1);
10092
cy.waitForAsyncRequest();
10193
cy.verifyStepAddedToFlow("Merge", mergeStep);
102-
});
103-
it("Run the merge step and verify success message(existing)", () => {
10494
runPage.runStep(mergeStep).click();
10595
cy.waitForAsyncRequest();
10696
cy.verifyStepRunResult("success", "Merging", mergeStep);
@@ -130,12 +120,10 @@ describe("Add Merge step to a flow", () => {
130120
cy.verifyStepRunResult("success", "Merging", mergeStep);
131121
tiles.closeRunMessage();
132122
});
133-
it("Delete the merge step", () => {
123+
it("Delete the merge step and Navigating to merge tab", () => {
134124
runPage.deleteStep(mergeStep).click();
135125
loadPage.confirmationOptions("Yes").click();
136126
cy.waitForAsyncRequest();
137-
});
138-
it("Navigating to merge tab", () => {
139127
cy.waitUntil(() => toolbar.getCurateToolbarIcon()).click();
140128
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
141129
curatePage.toggleEntityTypeId("Customer");
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
import {Application} from "../../../support/application.config";
2+
import {tiles, toolbar} from "../../../support/components/common";
3+
import {
4+
advancedSettingsDialog,
5+
createEditMappingDialog,
6+
sourceToEntityMap
7+
} from "../../../support/components/mapping/index";
8+
import loadPage from "../../../support/pages/load";
9+
import browsePage from "../../../support/pages/browse";
10+
import curatePage from "../../../support/pages/curate";
11+
import runPage from "../../../support/pages/run";
12+
import detailPage from "../../../support/pages/detail";
13+
import LoginPage from "../../../support/pages/login";
14+
import "cypress-wait-until";
15+
16+
const flowName = "orderCustomHeaderFlow";
17+
const flowName2 = "orderE2eFlow";
18+
const loadStep = "loadOrderCustomHeader";
19+
const mapStep = "mapOrderCustomHeader";
20+
21+
describe("Create and verify load steps, map step and flows with a custom header", () => {
22+
before(() => {
23+
cy.visit("/");
24+
cy.contains(Application.title);
25+
cy.loginAsTestUserWithRoles("hub-central-flow-writer", "hub-central-mapping-writer", "hub-central-load-writer").withRequest();
26+
LoginPage.postLogin();
27+
});
28+
beforeEach(() => {
29+
cy.loginAsTestUserWithRoles("hub-central-flow-writer", "hub-central-mapping-writer", "hub-central-load-writer").withRequest();
30+
});
31+
afterEach(() => {
32+
cy.resetTestUser();
33+
});
34+
after(() => {
35+
cy.loginAsDeveloper().withRequest();
36+
cy.deleteSteps("ingestion", "loadOrderCustomHeader");
37+
cy.deleteSteps("mapping", "mapOrderCustomHeader");
38+
cy.deleteFlows("orderCustomHeaderFlow", "orderE2eFlow");
39+
cy.resetTestUser();
40+
});
41+
it("Create load step", () => {
42+
toolbar.getLoadToolbarIcon().click();
43+
cy.waitUntil(() => loadPage.stepName("ingestion-step").should("be.visible"));
44+
loadPage.addNewButton("card").click();
45+
loadPage.stepNameInput().type(loadStep);
46+
loadPage.stepDescriptionInput().type("load order with a custom header");
47+
loadPage.stepSourceNameInput().type("backup-ABC123");
48+
loadPage.confirmationOptions("Save").click();
49+
cy.findByText(loadStep).should("be.visible");
50+
});
51+
it("Edit load step and Run", () => {
52+
// Open step settings and switch to Advanced tab
53+
loadPage.editStepInCardView(loadStep).click({force: true});
54+
loadPage.switchEditAdvanced().click();
55+
// add custom header to load step
56+
advancedSettingsDialog.setHeaderContent("loadTile/customHeader");
57+
advancedSettingsDialog.saveSettings(loadStep).click();
58+
advancedSettingsDialog.saveSettings(loadStep).should("not.be.exist");
59+
// add step to a new flow
60+
loadPage.addStepToNewFlow(loadStep);
61+
cy.findByText("New Flow").should("be.visible");
62+
runPage.setFlowName(flowName);
63+
runPage.setFlowDescription(`${flowName} description`);
64+
loadPage.confirmationOptions("Save").click();
65+
cy.verifyStepAddedToFlow("Load", loadStep);
66+
//Run the ingest with JSON
67+
runPage.runStep(loadStep).click();
68+
cy.uploadFile("input/10260.json");
69+
cy.verifyStepRunResult("success", "Ingestion", loadStep);
70+
tiles.closeRunMessage();
71+
});
72+
it("Create mapping step", () => {
73+
toolbar.getCurateToolbarIcon().click();
74+
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
75+
curatePage.toggleEntityTypeId("Order");
76+
cy.waitUntil(() => curatePage.addNewStep().click());
77+
createEditMappingDialog.setMappingName(mapStep);
78+
createEditMappingDialog.setMappingDescription("An order mapping with custom header");
79+
createEditMappingDialog.setSourceRadio("Query");
80+
createEditMappingDialog.setQueryInput(`cts.collectionQuery(['${loadStep}'])`);
81+
createEditMappingDialog.saveButton().click({force: true});
82+
//verify that step details automatically opens after step creation
83+
curatePage.verifyStepDetailsOpen(mapStep);
84+
//close modal
85+
cy.get("body").type("{esc}");
86+
curatePage.verifyStepNameIsVisible(mapStep);
87+
});
88+
it("Edit Map step", () => {
89+
// Open step settings and switch to Advanced tab
90+
cy.waitUntil(() => curatePage.editStep(mapStep).click({force: true}));
91+
curatePage.switchEditAdvanced().click();
92+
// add custom header
93+
advancedSettingsDialog.setHeaderContent("curateTile/customHeader");
94+
cy.waitUntil(() => advancedSettingsDialog.saveSettings(mapStep).click({force: true}));
95+
advancedSettingsDialog.saveSettings(mapStep).should("not.exist");
96+
// map source to entity
97+
curatePage.openSourceToEntityMap("Order", mapStep);
98+
cy.waitUntil(() => sourceToEntityMap.expandCollapseEntity().should("be.visible")).click();
99+
sourceToEntityMap.setXpathExpressionInput("orderId", "OrderID");
100+
sourceToEntityMap.setXpathExpressionInput("address", "/");
101+
sourceToEntityMap.setXpathExpressionInput("city", "ShipCity");
102+
sourceToEntityMap.setXpathExpressionInput("state", "ShipAddress");
103+
sourceToEntityMap.setXpathExpressionInput("orderDetails", "/");
104+
sourceToEntityMap.setXpathExpressionInput("productID", "OrderDetails/ProductID");
105+
sourceToEntityMap.setXpathExpressionInput("unitPrice", "head(OrderDetails/UnitPrice)");
106+
sourceToEntityMap.setXpathExpressionInput("quantity", "OrderDetails/Quantity");
107+
sourceToEntityMap.setXpathExpressionInput("discount", "head(OrderDetails/Discount)");
108+
sourceToEntityMap.setXpathExpressionInput("shipRegion", "ShipRegion");
109+
sourceToEntityMap.setXpathExpressionInput("shippedDate", "ShippedDate");
110+
// close modal
111+
cy.get("body").type("{esc}");
112+
});
113+
it("Add Map step to new flow and Run", () => {
114+
//Cancel add to new flow
115+
curatePage.addToNewFlow("Order", mapStep);
116+
cy.findByText("New Flow").should("be.visible");
117+
loadPage.confirmationOptions("Cancel").click();
118+
//should route user back to curate page
119+
cy.waitUntil(() => curatePage.getEntityTypePanel("Order").should("be.visible"));
120+
curatePage.openExistingFlowDropdown("Order", mapStep);
121+
curatePage.getExistingFlowFromDropdown(flowName).click();
122+
curatePage.addStepToFlowConfirmationMessage();
123+
curatePage.confirmAddStepToFlow(mapStep, flowName);
124+
runPage.runStep(mapStep).click();
125+
cy.verifyStepRunResult("success", "Mapping", mapStep);
126+
tiles.closeRunMessage();
127+
runPage.deleteStep(mapStep).click();
128+
loadPage.confirmationOptions("Yes").click();
129+
});
130+
it("Add Map step to existing flow Run", () => {
131+
//Verify Run Map step in an existing Flow
132+
toolbar.getCurateToolbarIcon().click();
133+
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
134+
curatePage.toggleEntityTypeId("Order");
135+
curatePage.runStepInCardView(mapStep).click();
136+
curatePage.runStepSelectFlowConfirmation().should("be.visible");
137+
curatePage.selectFlowToRunIn(flowName);
138+
//Step should automatically run
139+
cy.verifyStepRunResult("success", "Mapping", mapStep);
140+
tiles.closeRunMessage();
141+
});
142+
it("Delete the flow and Verify Run Map step in a new Flow", () => {
143+
runPage.deleteFlow(flowName).click();
144+
runPage.deleteFlowConfirmationMessage(flowName).should("be.visible");
145+
loadPage.confirmationOptions("Yes").click();
146+
runPage.getFlowName(flowName).should("not.be.visible");
147+
//Verify Run Map step in a new Flow
148+
toolbar.getCurateToolbarIcon().click();
149+
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
150+
curatePage.toggleEntityTypeId("Order");
151+
curatePage.runStepInCardView(mapStep).click();
152+
//Just deleted flow should not be visible on flows list
153+
cy.findByText(flowName).should("not.be.visible");
154+
curatePage.runInNewFlow(mapStep).click({force: true});
155+
cy.findByText("New Flow").should("be.visible");
156+
runPage.setFlowName(flowName);
157+
runPage.setFlowDescription(`${flowName} description`);
158+
loadPage.confirmationOptions("Save").click();
159+
//Step should automatically run
160+
cy.verifyStepRunResult("success", "Mapping", mapStep);
161+
tiles.closeRunMessage();
162+
});
163+
it("Verify Run Map step in flow where step exists, should run automatically", () => {
164+
toolbar.getCurateToolbarIcon().click();
165+
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
166+
curatePage.toggleEntityTypeId("Order");
167+
curatePage.runStepInCardView(mapStep).click();
168+
curatePage.runStepExistsOneFlowConfirmation().should("be.visible");
169+
curatePage.confirmContinueRun();
170+
cy.waitForAsyncRequest();
171+
cy.verifyStepAddedToFlow("Map", mapStep);
172+
cy.waitUntil(() => runPage.getFlowName(flowName).should("be.visible"));
173+
cy.verifyStepRunResult("success", "Mapping", mapStep);
174+
tiles.closeRunMessage();
175+
});
176+
it("Add step to a new flow, Run Map step where step exists in multiple flows and explore data", () => {
177+
toolbar.getCurateToolbarIcon().click();
178+
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
179+
curatePage.toggleEntityTypeId("Order");
180+
curatePage.addToNewFlow("Order", mapStep);
181+
cy.findByText("New Flow").should("be.visible");
182+
runPage.setFlowName(flowName2);
183+
runPage.setFlowDescription(`${flowName2} description`);
184+
loadPage.confirmationOptions("Save").click();
185+
cy.verifyStepAddedToFlow("Map", mapStep);
186+
//Verify Run Map step where step exists in multiple flows, choose one to automatically run in
187+
toolbar.getCurateToolbarIcon().click();
188+
cy.waitUntil(() => curatePage.getEntityTypePanel("Customer").should("be.visible"));
189+
curatePage.toggleEntityTypeId("Order");
190+
curatePage.runStepInCardView(mapStep).click();
191+
curatePage.runStepExistsMultFlowsConfirmation().should("be.visible");
192+
curatePage.selectFlowToRunIn(flowName);
193+
cy.waitForAsyncRequest();
194+
cy.verifyStepAddedToFlow("Map", mapStep);
195+
cy.waitUntil(() => runPage.getFlowName(flowName).should("be.visible"));
196+
cy.verifyStepRunResult("success", "Mapping", mapStep);
197+
runPage.explorerLink().click();
198+
browsePage.getTableViewInstanceIcon().click();
199+
detailPage.getDocumentSource().should("contain", "backup-ABC123");
200+
detailPage.getDocumentTimestamp().should("not.exist");
201+
detailPage.getSourceView().click();
202+
cy.contains("accessLevel");
203+
cy.contains("999ABC");
204+
});
205+
});

0 commit comments

Comments
 (0)