Michael Wang 2 سال پیش
والد
کامیت
847bc3dea1
2فایلهای تغییر یافته به همراه17 افزوده شده و 23 حذف شده
  1. 1 4
      cypress/e2e/mark-header.spec.cy.ts
  2. 16 19
      cypress/e2e/markbody-container.spec.cy.ts

+ 1 - 4
cypress/e2e/mark-header.spec.cy.ts

@@ -1,27 +1,24 @@
 describe("评卷页面", () => {
 describe("评卷页面", () => {
   beforeEach(() => {
   beforeEach(() => {
     cy.networkStub();
     cy.networkStub();
+    cy.visit("/");
   });
   });
 
 
   it("成功加载", () => {
   it("成功加载", () => {
-    cy.visit("/");
     cy.wait(1000);
     cy.wait(1000);
   });
   });
 
 
   it("科目代码和名称显示", () => {
   it("科目代码和名称显示", () => {
-    cy.visit("/");
     cy.wait(1000)
     cy.wait(1000)
       .get(".header-container a")
       .get(".header-container a")
       .should("contain", "431-金融学综合");
       .should("contain", "431-金融学综合");
   });
   });
 
 
   it("用户姓名显示", () => {
   it("用户姓名显示", () => {
-    cy.visit("/");
     cy.wait(1000).get(".header-container").should("contain", "王小兰");
     cy.wait(1000).get(".header-container").should("contain", "王小兰");
   });
   });
 
 
   it("小助手显示", () => {
   it("小助手显示", () => {
-    cy.visit("/");
     cy.wait(1000).get(".header-container .assistant-text").click();
     cy.wait(1000).get(".header-container .assistant-text").click();
     cy.get(".assistant-table").should("contain", "全卷");
     cy.get(".assistant-table").should("contain", "全卷");
   });
   });

+ 16 - 19
cypress/e2e/markbody-container.spec.cy.ts

@@ -1,17 +1,16 @@
 describe("评卷页面-裁切图", () => {
 describe("评卷页面-裁切图", () => {
   beforeEach(() => {
   beforeEach(() => {
     cy.networkStub();
     cy.networkStub();
+    cy.visit("/");
   });
   });
 
 
   it("裁切图显示", () => {
   it("裁切图显示", () => {
-    cy.visit("/");
     cy.wait(4000)
     cy.wait(4000)
       .get(".mark-body-container .single-image-container")
       .get(".mark-body-container .single-image-container")
       .should("exist");
       .should("exist");
   });
   });
 
 
   it("键盘选择鼠标分数成功", () => {
   it("键盘选择鼠标分数成功", () => {
-    cy.visit("/");
     cy.wait(1000)
     cy.wait(1000)
       .get(".mark-body-container")
       .get(".mark-body-container")
       .get("body")
       .get("body")
@@ -25,7 +24,6 @@ describe("评卷页面-裁切图", () => {
   });
   });
 
 
   it("键盘选择鼠标分数失败", () => {
   it("键盘选择鼠标分数失败", () => {
-    cy.visit("/");
     cy.wait(1000)
     cy.wait(1000)
       .get(".mark-body-container")
       .get(".mark-body-container")
       .get("body")
       .get("body")
@@ -39,32 +37,32 @@ describe("评卷页面-裁切图", () => {
   });
   });
 
 
   it("裁切图点击-分数增加", () => {
   it("裁切图点击-分数增加", () => {
-    cy.visit("/");
     // 任务开始渲染了
     // 任务开始渲染了
     cy.get(".single-image-container");
     cy.get(".single-image-container");
     // 等待遮罩层消除
     // 等待遮罩层消除
     cy.get('[data-test="status-spin"]').should("not.exist");
     cy.get('[data-test="status-spin"]').should("not.exist");
-    cy.get(".total-score span span").invoke("html").as("oldTotal");
 
 
-    const addScore = "2";
-    cy.get("body .mark-body-container")
+    cy.get(".mark-body-container")
       .scrollTo(0, 0)
       .scrollTo(0, 0)
       .get("body")
       .get("body")
-      .type(addScore)
-      .click(200, 200)
-      // 要给点时间页面计算动画
+      .type("1")
+      .click(200, 300)
+      .wait(1500)
+      .type("2")
+      .click(300, 500)
+      .wait(1500)
+      .get(".single-image-container:nth(2)")
+      .scrollIntoView()
+      .get("body")
+      .type("3")
+      .click(400, 200)
       .wait(500);
       .wait(500);
-    cy.get("body .mark-body-container .score-container").should(
-      "have.length",
-      1
-    );
-    cy.get(".total-score span span").then(function ($div) {
-      expect($div.html()).eq(+this.oldTotal + +addScore + "");
-    });
+    cy.get(".score-container").should("have.length", 3);
+
+    cy.get(".total-score span span").contains("6");
   });
   });
 
 
   it("裁切图点击-分数在有效区域外", () => {
   it("裁切图点击-分数在有效区域外", () => {
-    cy.visit("/");
     // 任务开始渲染了
     // 任务开始渲染了
     cy.get(".single-image-container");
     cy.get(".single-image-container");
     // 等待遮罩层消除
     // 等待遮罩层消除
@@ -85,7 +83,6 @@ describe("评卷页面-裁切图", () => {
   });
   });
 
 
   it("清除本题分数", () => {
   it("清除本题分数", () => {
-    cy.visit("/");
     // 任务开始渲染了
     // 任务开始渲染了
     cy.get(".single-image-container");
     cy.get(".single-image-container");
     // 等待遮罩层消除
     // 等待遮罩层消除