You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 7, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: runestone/unittest_base.py
+40-27Lines changed: 40 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,8 @@
35
35
# -------------
36
36
# None
37
37
38
+
# Globals
39
+
# =======
38
40
# Select an unused port for serving web pages to the test suite.
39
41
PORT="8081"
40
42
# Use the localhost for testing.
@@ -50,6 +52,8 @@
50
52
mf=None
51
53
52
54
55
+
# Code
56
+
# ====
53
57
# Define `module fixtures <https://docs.python.org/2/library/unittest.html#setupmodule-and-teardownmodule>`_ to build the test Runestone project, run the server, then shut it down when the tests complete.
54
58
classModuleFixture(unittest.TestCase):
55
59
def__init__(
@@ -75,19 +79,17 @@ def setUpModule(self):
75
79
# otherwise the runestone build may fail due to lack of a runestone.js file!
76
80
p=subprocess.run(
77
81
["npm.cmd"ifIS_WINDOWSelse"npm", "run", "build"],
78
-
stdout=subprocess.PIPE,
79
-
stderr=subprocess.PIPE,
80
-
universal_newlines=True,
82
+
capture_output=True,
83
+
text=True,
81
84
)
85
+
print(p.stdout+p.stderr)
82
86
self.assertFalse(p.returncode)
83
87
# Compile the docs. Save the stdout and stderr for examination.
# An expectation for Selenium, used for checking that an element has a particular css class. From the `Selenium docs <https://selenium-python.readthedocs.io/waits.html#explicit-waits>`_, under the "Custom wait conditions" subheading.
234
+
#
235
+
# locator - used to find the element
236
+
#
237
+
# returns the WebElement once it has the particular css class.
238
+
classelement_has_css_class:
239
+
def__init__(
240
+
self,
241
+
# The element to find; this is passed directly to `driver.find_element <https://selenium-python.readthedocs.io/api.html#selenium.webdriver.remote.webdriver.WebDriver.find_element>`_. See the `Selenium docs`_.
0 commit comments