Skip to content

Commit 4faba18

Browse files
Update e2e integration tests
Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
1 parent 1a67020 commit 4faba18

File tree

9 files changed

+549
-186
lines changed

9 files changed

+549
-186
lines changed

cypress/e2e/dashboard/dashboard.cy.ts

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ describe("Dashboard", () => {
2727
};
2828

2929
it("renders empty dashboard", () => {
30-
cy.intercept(routeSelectors.REPLICAS, {
31-
body: { replicas: [] },
32-
}).as("replicas");
33-
cy.intercept(routeSelectors.MIGRATIONS, {
34-
body: { migrations: [] },
35-
}).as("migrations");
30+
cy.intercept(routeSelectors.TRANSFERS, {
31+
body: { transfers: [] },
32+
}).as("transfers");
33+
cy.intercept(routeSelectors.DEPLOYMENTS, {
34+
body: { deployments: [] },
35+
}).as("deployments");
3636
cy.intercept(routeSelectors.ENDPOINTS, {
3737
body: { endpoints: [] },
3838
}).as("endpoints");
3939

4040
cy.visit("/");
4141
waitForAll();
42-
cy.wait(["@replicas", "@migrations", "@endpoints"]);
42+
cy.wait(["@transfers", "@deployments", "@endpoints"]);
4343

4444
cy.get("*[class^='DashboardActivity__Message']").should(
4545
"contain.text",
@@ -58,43 +58,42 @@ describe("Dashboard", () => {
5858

5959
cy.get("*[class^='DashboardLicence__ChartHeaderCurrent']").should(
6060
"contain.text",
61-
`${applianceStatus.appliance_licence_status.current_performed_replicas} Fulfilled Replica ${applianceStatus.appliance_licence_status.current_performed_migrations} Fulfilled Migrations`
61+
`${applianceStatus.appliance_licence_status.current_performed_replicas} Used Replica ${applianceStatus.appliance_licence_status.current_performed_migrations} Used Migrations`
6262
);
6363
});
6464

65-
cy.get("button").should("contain.text", "New Replica / Migration");
65+
cy.get("button").should("contain.text", "New Transfer");
6666
cy.get("button").should("contain.text", "New Endpoint");
6767
});
6868

6969
it("renders dashboard with data", () => {
70-
cy.intercept(routeSelectors.REPLICAS, {
70+
cy.intercept(routeSelectors.TRANSFERS, {
7171
fixture: "transfers/replicas.json",
72-
}).as("replicas");
73-
cy.intercept(routeSelectors.MIGRATIONS, {
74-
fixture: "transfers/migrations.json",
75-
}).as("migrations");
72+
}).as("transfers");
7673
cy.intercept(routeSelectors.ENDPOINTS, {
7774
fixture: "endpoints/endpoints.json",
7875
}).as("endpoints");
7976

8077
cy.visit("/");
8178
waitForAll();
82-
cy.wait(["@replicas", "@migrations", "@endpoints"]);
79+
cy.wait(["@transfers", "@endpoints"]);
8380

8481
cy.loadFixtures(
8582
[
8683
"transfers/replicas.json",
87-
"transfers/migrations.json",
8884
"endpoints/endpoints.json",
8985
],
9086
results => {
91-
const [replicasFixture, migrationsFixture, endpointsFixture] = results;
87+
const [transfersFixture, endpointsFixture] = results;
88+
const replicasCount = transfersFixture.transfers.filter(transfer => transfer.scenario === "replica").length;
89+
const migrationsCount = transfersFixture.transfers.filter(transfer => transfer.scenario === "live_migration").length;
90+
9291
cy.get("div[class^='DashboardInfoCount__CountBlock']").should(
9392
"contain.text",
94-
`${replicasFixture.replicas.length}Replicas${migrationsFixture.migrations.length}Migrations${endpointsFixture.endpoints.length}Endpoints`
93+
`${replicasCount}Replicas${migrationsCount}Migrations${endpointsFixture.endpoints.length}Endpoints`
9594
);
9695

97-
const checkItem = (type: "migration" | "replica", item: any) => {
96+
const checkItem = (type: "transfer", item: any) => {
9897
cy.get("div[class^='NotificationDropdown__ItemDescription']").should(
9998
"contain.text",
10099
`New ${type} ${item.id.substr(
@@ -104,12 +103,8 @@ describe("Dashboard", () => {
104103
);
105104
};
106105

107-
migrationsFixture.migrations.forEach((migration: any) => {
108-
checkItem("migration", migration);
109-
});
110-
111-
replicasFixture.replicas.forEach((replica: any) => {
112-
checkItem("replica", replica);
106+
transfersFixture.transfers.forEach((transfer: any) => {
107+
checkItem("transfer", transfer);
113108
});
114109
}
115110
);

cypress/e2e/migrations/migrations-list.cy.ts renamed to cypress/e2e/deployments/deployments-list.cy.ts

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { routeSelectors } from "../../support/routeSelectors";
44

5-
describe("Migrations list", () => {
5+
describe("Deployments list", () => {
66
beforeEach(() => {
77
cy.setProjectIdCookie();
88

@@ -20,28 +20,27 @@ describe("Migrations list", () => {
2020
};
2121

2222
it("renders empty list", () => {
23-
cy.intercept(routeSelectors.MIGRATIONS, {
24-
body: { replicas: [] },
25-
}).as("migrations");
23+
cy.intercept(routeSelectors.DEPLOYMENTS, {
24+
body: { deployments: [] },
25+
}).as("deployments");
2626

27-
cy.visit("/migrations");
27+
cy.visit("/deployments");
2828
waitForAll();
2929

30-
cy.wait(["@migrations"]);
30+
cy.wait(["@deployments"]);
3131

3232
cy.get("div[class^='MainList__EmptyListMessage']").should(
3333
"contain.text",
34-
"don't have any Migrations in this project"
34+
"don't have any Deployments in this project"
3535
);
36-
cy.get("button").should("contain.text", "Create a Migration");
3736
});
3837

3938
it("filters list", () => {
40-
cy.visit("/migrations");
39+
cy.visit("/deployments");
4140
waitForAll();
4241

4342
cy.loadFixtures(["transfers/migrations"], (results: any[]) => {
44-
const migrations = results[0].migrations;
43+
const deployments = results[0].deployments;
4544

4645
cy.get("div[class^='MainListFilter__FilterItem']")
4746
.contains("Running")
@@ -53,57 +52,57 @@ describe("Migrations list", () => {
5352
.click();
5453
cy.get("div[class^='TransferListItem__Wrapper']").should(
5554
"have.length",
56-
migrations.filter(r => r.last_execution_status === "ERROR").length
55+
deployments.filter(r => r.last_execution_status === "ERROR").length
5756
);
5857

5958
cy.get("div[class^='MainListFilter__FilterItem']")
6059
.contains("Completed")
6160
.click();
6261
cy.get("div[class^='TransferListItem__Wrapper']").should(
6362
"have.length",
64-
migrations.filter(r => r.last_execution_status === "COMPLETED").length
63+
deployments.filter(r => r.last_execution_status === "COMPLETED").length
6564
);
6665

6766
cy.get("div[class^='MainListFilter__FilterItem']")
6867
.contains("Canceled")
6968
.click();
7069
cy.get("div[class^='TransferListItem__Wrapper']").should(
7170
"have.length",
72-
migrations.filter(r => r.last_execution_status === "CANCELED").length
71+
deployments.filter(r => r.last_execution_status === "CANCELED").length
7372
);
7473

7574
cy.get("div[class^='MainListFilter__FilterItem']")
7675
.contains("All")
7776
.click();
7877
cy.get("div[class^='TransferListItem__Wrapper']").should(
7978
"have.length",
80-
migrations.length
79+
deployments.length
8180
);
8281

8382
cy.get("div[class^='SearchButton__Wrapper']").click();
8483
cy.get("input[class*='SearchInput']").type("ol88-uefi");
8584
cy.get("div[class^='TransferListItem__Wrapper']").should(
8685
"have.length",
87-
migrations.filter(r => r.instances.find(i => i.includes("ol88-uefi")))
86+
deployments.filter(r => r.instances.find(i => i.includes("ol88-uefi")))
8887
.length
8988
);
9089
cy.get("div[class^='TextInput__Close']").click();
9190
});
9291
});
9392

9493
it("does bulk actions", () => {
95-
cy.visit("/migrations");
94+
cy.visit("/deployments");
9695
waitForAll();
9796

9897
cy.loadFixtures(["transfers/migrations"], (results: any[]) => {
99-
const migrations: any[] = results[0].migrations;
98+
const deployments: any[] = results[0].deployments;
10099

101100
cy.get("div[class*='TransferListItem__Checkbox']").eq(0).click();
102101
cy.get("div[class^='SearchButton__Wrapper']").click();
103102
cy.get("input[class*='SearchInput']").type("ol88-uefi");
104103
cy.get("div[class^='TransferListItem__Wrapper']").should(
105104
"have.length",
106-
migrations.filter(r => r.instances.find(i => i.includes("ol88-uefi")))
105+
deployments.filter(r => r.instances.find(i => i.includes("ol88-uefi")))
107106
.length
108107
);
109108
cy.get("div[class*='TransferListItem__Checkbox']").eq(0).click();
@@ -114,29 +113,20 @@ describe("Migrations list", () => {
114113

115114
cy.get("div[class^='ActionDropdown__Wrapper']").click();
116115
cy.get("div[class^='ActionDropdown__ListItem']")
117-
.contains("Recreate Migrations")
116+
.contains("Recreate Deployments")
118117
.click();
119118
cy.get("div[class^='AlertModal__Message']").should(
120119
"contain.text",
121120
"Are you sure you want to recreate"
122121
);
123122

124-
let postCount = 0;
125-
cy.intercept("POST", routeSelectors.MIGRATIONS, req => {
126-
postCount += 1;
127-
if (postCount === 1) {
128-
expect(req.body.migration.instances).to.deep.eq([
129-
"Datacenter/ol88-bios",
130-
]);
131-
} else if (postCount === 2) {
132-
expect(req.body.migration.instances).to.deep.eq([
133-
"Datacenter/ol88-uefi",
134-
]);
135-
}
136-
}).as("migrations-recreate");
123+
cy.intercept("POST", routeSelectors.DEPLOYMENTS, req => {
124+
expect(req.body.deployment.transfer_id,
125+
"Transfer ID should be present in the request body").to.exist;
126+
}).as("deployments-recreate");
137127

138128
cy.get("button").contains("Yes").click();
139-
cy.wait(["@migrations-recreate"]);
129+
cy.wait(["@deployments-recreate"]);
140130
});
141131
});
142132
});

cypress/e2e/page header/page-header.cy.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe("Page header", () => {
2323
};
2424

2525
it("switches project", () => {
26-
cy.visit("/replicas");
26+
cy.visit("/transfers");
2727
waitForAll();
2828

2929
cy.get("div[class^='Dropdown__Wrapper']").contains("admin").click();
@@ -44,15 +44,15 @@ describe("Page header", () => {
4444
});
4545

4646
it("redirects to user info", () => {
47-
cy.visit("/replicas");
47+
cy.visit("/transfers");
4848
waitForAll();
4949
cy.get("div[class^='UserDropdown__Wrapper']").click();
5050
cy.get("a[class^='UserDropdown__Username']").click();
5151
cy.url().should("include", "/users");
5252
});
5353

5454
it("shows about coriolis", () => {
55-
cy.visit("/replicas");
55+
cy.visit("/transfers");
5656
waitForAll();
5757
cy.get("div[class^='UserDropdown__Wrapper']").click();
5858

@@ -82,7 +82,7 @@ describe("Page header", () => {
8282
});
8383

8484
it("redirects to help", () => {
85-
cy.visit("/replicas", {
85+
cy.visit("/transfers", {
8686
onBeforeLoad(win) {
8787
cy.stub(win, "open").as("winOpen");
8888
},
@@ -98,7 +98,7 @@ describe("Page header", () => {
9898
});
9999

100100
it("logs out", () => {
101-
cy.visit("/replicas");
101+
cy.visit("/transfers");
102102
waitForAll();
103103

104104
cy.get("div[class^='UserDropdown__Wrapper']").click();

0 commit comments

Comments
 (0)