From c97fad88f0c110b5c0daa9c98385dc91b1899ddb Mon Sep 17 00:00:00 2001
From: 阳洁 <2077506045@qq.com>
Date: 星期一, 17 七月 2023 17:08:04 +0800
Subject: [PATCH] 测评系统自动测试

---
 po/maq_answer_page.py |   14 +++++++++-----
 po/jaq_answer_page.py |   15 +++++++++------
 report/report.html    |   24 ++++++++++++------------
 3 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/po/jaq_answer_page.py b/po/jaq_answer_page.py
index c5a939c..310665a 100644
--- a/po/jaq_answer_page.py
+++ b/po/jaq_answer_page.py
@@ -42,7 +42,6 @@
             if self.submit_btn_is_display():
                 self.click(Answer.submit_btn)
                 # 鏁版嵁鏄惁涓婁紶瀹屾垚
-                time.sleep(15)
                 if self.upload_is_success():
                     return True
                 return False
@@ -52,11 +51,15 @@
         鍒ゆ柇鏁版嵁鏄惁涓婁紶瀹屾垚
         :return:
         """
-        try:
-            self.get_element_wait(Answer.upload_success_title)
-            return True
-        except TimeoutException:
-            return False
+        i = 0
+        while i < 60:
+            try:
+                self.get_element_wait(Answer.upload_success_title)
+                return True
+            except TimeoutException:
+                i += 1
+                time.sleep(1)
+        return False
 
     def submit_btn_is_display(self):
         """
diff --git a/po/maq_answer_page.py b/po/maq_answer_page.py
index 7c3afcd..f2e5bac 100644
--- a/po/maq_answer_page.py
+++ b/po/maq_answer_page.py
@@ -50,11 +50,15 @@
         鍒ゆ柇鏁版嵁鏄惁涓婁紶瀹屾垚
         :return:
         """
-        try:
-            self.get_element_wait(Answer.upload_success_title)
-            return True
-        except TimeoutException:
-            return False
+        i = 0
+        while i < 60:
+            try:
+                self.get_element_wait(Answer.upload_success_title)
+                return True
+            except TimeoutException:
+                i += 1
+                time.sleep(1)
+        return False
 
     def submit_btn_is_display(self):
         """
diff --git a/report/report.html b/report/report.html
index e770deb..4b70cf8 100644
--- a/report/report.html
+++ b/report/report.html
@@ -253,9 +253,9 @@
 }
 </script>
     <h1>report.html</h1>
-    <p>Report generated on 17-Jul-2023 at 16:13:07 by <a href="https://pypi.python.org/pypi/pytest-html">pytest-html</a> v3.2.0</p>
+    <p>Report generated on 17-Jul-2023 at 16:56:23 by <a href="https://pypi.python.org/pypi/pytest-html">pytest-html</a> v3.2.0</p>
     <h2>Summary</h2>
-    <p>10 tests ran in 388.23 seconds. </p>
+    <p>10 tests ran in 385.15 seconds. </p>
     <p class="filter" hidden="true">(Un)check the boxes to filter the results.</p><input checked="true" class="filter" data-test-result="passed" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="passed">10 passed</span>, <input checked="true" class="filter" data-test-result="skipped" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="skipped">0 skipped</span>, <input checked="true" class="filter" data-test-result="failed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="failed">0 failed</span>, <input checked="true" class="filter" data-test-result="error" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="error">0 errors</span>, <input checked="true" class="filter" data-test-result="xfailed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xfailed">0 expected failures</span>, <input checked="true" class="filter" data-test-result="xpassed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xpassed">0 unexpected passes</span>
     <h2>Results</h2>
     <table id="results-table">
@@ -271,7 +271,7 @@
         <tr>
           <td class="col-result">Passed</td>
           <td class="col-name">testcase/test_jaq.py::TestJAQ::test_login[login]</td>
-          <td class="col-duration">4.92</td>
+          <td class="col-duration">6.38</td>
           <td class="col-links"></td></tr>
         <tr>
           <td class="extra" colspan="4">
@@ -280,7 +280,7 @@
         <tr>
           <td class="col-result">Passed</td>
           <td class="col-name">testcase/test_jaq.py::TestJAQ::test_create_package[JAQ]</td>
-          <td class="col-duration">14.10</td>
+          <td class="col-duration">14.17</td>
           <td class="col-links"></td></tr>
         <tr>
           <td class="extra" colspan="4">
@@ -289,7 +289,7 @@
         <tr>
           <td class="col-result">Passed</td>
           <td class="col-name">testcase/test_jaq.py::TestJAQ::test_open_url[JAQ]</td>
-          <td class="col-duration">14.05</td>
+          <td class="col-duration">12.09</td>
           <td class="col-links"></td></tr>
         <tr>
           <td class="extra" colspan="4">
@@ -298,7 +298,7 @@
         <tr>
           <td class="col-result">Passed</td>
           <td class="col-name">testcase/test_jaq.py::TestJAQ::test_answer</td>
-          <td class="col-duration">93.40</td>
+          <td class="col-duration">78.51</td>
           <td class="col-links"></td></tr>
         <tr>
           <td class="extra" colspan="4">
@@ -307,7 +307,7 @@
         <tr>
           <td class="col-result">Passed</td>
           <td class="col-name">testcase/test_jaq.py::TestJAQ::test_delete_package</td>
-          <td class="col-duration">7.31</td>
+          <td class="col-duration">7.33</td>
           <td class="col-links"></td></tr>
         <tr>
           <td class="extra" colspan="4">
@@ -316,7 +316,7 @@
         <tr>
           <td class="col-result">Passed</td>
           <td class="col-name">testcase/test_maq.py::TestMAQ::test_login[login]</td>
-          <td class="col-duration">4.82</td>
+          <td class="col-duration">4.86</td>
           <td class="col-links"></td></tr>
         <tr>
           <td class="extra" colspan="4">
@@ -325,7 +325,7 @@
         <tr>
           <td class="col-result">Passed</td>
           <td class="col-name">testcase/test_maq.py::TestMAQ::test_create_package[MAQ]</td>
-          <td class="col-duration">14.45</td>
+          <td class="col-duration">14.06</td>
           <td class="col-links"></td></tr>
         <tr>
           <td class="extra" colspan="4">
@@ -334,7 +334,7 @@
         <tr>
           <td class="col-result">Passed</td>
           <td class="col-name">testcase/test_maq.py::TestMAQ::test_open_url[MAQ]</td>
-          <td class="col-duration">13.81</td>
+          <td class="col-duration">12.22</td>
           <td class="col-links"></td></tr>
         <tr>
           <td class="extra" colspan="4">
@@ -343,7 +343,7 @@
         <tr>
           <td class="col-result">Passed</td>
           <td class="col-name">testcase/test_maq.py::TestMAQ::test_answer</td>
-          <td class="col-duration">213.81</td>
+          <td class="col-duration">227.95</td>
           <td class="col-links"></td></tr>
         <tr>
           <td class="extra" colspan="4">
@@ -352,7 +352,7 @@
         <tr>
           <td class="col-result">Passed</td>
           <td class="col-name">testcase/test_maq.py::TestMAQ::test_delete_package</td>
-          <td class="col-duration">7.38</td>
+          <td class="col-duration">7.34</td>
           <td class="col-links"></td></tr>
         <tr>
           <td class="extra" colspan="4">

--
Gitblit v1.9.1