|
@@ -0,0 +1,35 @@
|
|
|
|
+describe("The /web/mark Page", () => {
|
|
|
|
+ it("logs in programmatically without using the UI", function () {
|
|
|
|
+ const user = {
|
|
|
|
+ loginType: "mark-login",
|
|
|
|
+ loginName: "1-431-2-1",
|
|
|
|
+ password: "123456",
|
|
|
|
+ examId: "1",
|
|
|
|
+ markerId: "451",
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ const { loginType, loginName, password, examId, markerId } = user;
|
|
|
|
+ const form = new FormData();
|
|
|
|
+ form.append("loginType", loginType);
|
|
|
|
+ form.append("loginName", loginName);
|
|
|
|
+ form.append("password", password);
|
|
|
|
+
|
|
|
|
+ // programmatically log us in without needing the UI
|
|
|
|
+ cy.request("POST", "/login", form);
|
|
|
|
+
|
|
|
|
+ const formSubject = new FormData();
|
|
|
|
+ formSubject.append("examId", examId);
|
|
|
|
+ formSubject.append("markerId", markerId);
|
|
|
|
+ cy.request("POST", "/mark/subject-select", formSubject);
|
|
|
|
+
|
|
|
|
+ // now that we're logged in, we can visit
|
|
|
|
+ // any kind of restricted route!
|
|
|
|
+ cy.visit("/");
|
|
|
|
+
|
|
|
|
+ // our auth cookie should be present
|
|
|
|
+ // cy.getCookie("").should("exist");
|
|
|
|
+
|
|
|
|
+ // UI should reflect this user being logged in
|
|
|
|
+ cy.get(".header-container").should("contain", "张小兰");
|
|
|
|
+ });
|
|
|
|
+});
|