فهرست منبع

test(mark): 有效区域、清除本题分数

Michael Wang 2 سال پیش
والد
کامیت
855cf567a9
2فایلهای تغییر یافته به همراه54 افزوده شده و 5 حذف شده
  1. 53 5
      cypress/e2e/markbody-container.spec.cy.ts
  2. 1 0
      src/features/mark/MarkBoardTrack.vue

+ 53 - 5
cypress/e2e/markbody-container.spec.cy.ts

@@ -53,10 +53,58 @@ describe("评卷页面-裁切图", () => {
       .type(addScore)
       .click(200, 200)
       // 要给点时间页面计算动画
-      .wait(500)
-      .get(".total-score span span")
-      .then(function ($div) {
-        expect($div.html()).eq(+this.oldTotal + +addScore + "");
-      });
+      .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 + "");
+    });
+  });
+
+  it("裁切图点击-分数在有效区域外", () => {
+    cy.visit("/");
+    // 任务开始渲染了
+    cy.get(".single-image-container");
+    // 等待遮罩层消除
+    cy.get('[data-test="status-spin"]').should("not.exist");
+
+    cy.get("body .mark-body-container")
+      .scrollTo(0, 0)
+      .get("body")
+      .type("3")
+      .click(900, 200)
+      // 要给点时间页面计算动画
+      .wait(500);
+
+    cy.get("body .mark-body-container .score-container").should(
+      "have.length",
+      0
+    );
+  });
+
+  it("清除本题分数", () => {
+    cy.visit("/");
+    // 任务开始渲染了
+    cy.get(".single-image-container");
+    // 等待遮罩层消除
+    cy.get('[data-test="status-spin"]').should("not.exist");
+
+    cy.get("body .mark-body-container")
+      .scrollTo(0, 0)
+      .get("body")
+      .type("3")
+      .click(200, 200)
+      .wait(1500)
+      .type("2")
+      .click(200, 300)
+      .wait(500);
+
+    cy.get('[data-test="clear-score"]').click();
+    cy.get("body .mark-body-container .score-container").should(
+      "have.length",
+      0
+    );
   });
 });

+ 1 - 0
src/features/mark/MarkBoardTrack.vue

@@ -217,6 +217,7 @@
         shape="round"
         size="large"
         :clickTimeout="300"
+        data-test="clear-score"
         @click="clearAllMarksOfCurrentQuetion"
       >
         清除本题