2021-05-06 09:06:24 +08:00
|
|
|
""" This test suite contains 2 passing tests and 2 failing tests. """
|
2016-05-10 12:10:16 +08:00
|
|
|
|
2018-12-11 15:01:57 +08:00
|
|
|
import pytest
|
2016-05-09 05:38:12 +08:00
|
|
|
from seleniumbase import BaseCase
|
|
|
|
|
|
|
|
|
|
|
|
class MyTestSuite(BaseCase):
|
|
|
|
def test_1(self):
|
2020-08-08 13:21:28 +08:00
|
|
|
self.open("https://xkcd.com/1664/")
|
|
|
|
self.assert_text("Mycology", "div#ctitle", timeout=4)
|
|
|
|
for p in range(3):
|
2016-05-09 05:38:12 +08:00
|
|
|
self.click('a[rel="next"]')
|
2020-08-08 13:21:28 +08:00
|
|
|
self.assert_text("Algorithms", "div#ctitle", timeout=4)
|
2016-05-09 05:38:12 +08:00
|
|
|
|
2018-12-11 15:01:57 +08:00
|
|
|
@pytest.mark.expected_failure
|
2016-05-09 05:38:12 +08:00
|
|
|
def test_2(self):
|
2021-03-07 12:42:08 +08:00
|
|
|
print("\n(This test should fail)")
|
2018-10-08 12:38:43 +08:00
|
|
|
self.open("https://xkcd.com/1675/")
|
2016-05-09 05:38:12 +08:00
|
|
|
raise Exception("FAKE EXCEPTION: This test fails on purpose.")
|
|
|
|
|
|
|
|
def test_3(self):
|
2018-10-08 12:38:43 +08:00
|
|
|
self.open("https://xkcd.com/1406/")
|
2020-08-08 13:21:28 +08:00
|
|
|
self.assert_text("Universal Converter Box", "div#ctitle", timeout=4)
|
2018-10-08 12:38:43 +08:00
|
|
|
self.open("https://xkcd.com/608/")
|
2020-08-08 13:21:28 +08:00
|
|
|
self.assert_text("Form", "div#ctitle", timeout=4)
|
2016-05-09 05:38:12 +08:00
|
|
|
|
2018-12-11 15:01:57 +08:00
|
|
|
@pytest.mark.expected_failure
|
2016-05-09 05:38:12 +08:00
|
|
|
def test_4(self):
|
2021-03-07 12:42:08 +08:00
|
|
|
print("\n(This test should fail)")
|
2018-10-08 12:38:43 +08:00
|
|
|
self.open("https://xkcd.com/1670/")
|
2018-12-11 15:01:57 +08:00
|
|
|
self.assert_element("FakeElement.DoesNotExist", timeout=0.5)
|