File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change 1
1
""" This test fails on purpose to demonstrate the time-limit feature
2
- for tests that run longer than the time limit specified in seconds.
3
- Usage: (inside tests) -> self.set_time_limit(SECONDS) """
2
+ for tests that run longer than the time limit specified (seconds).
3
+ The time-limit clock starts after the browser has fully launched,
4
+ which is after pytest starts it's own internal clock for tests.
5
+ Usage: (inside tests) => self.set_time_limit(SECONDS)
6
+ Usage: (command-line) => --time-limit=SECONDS """
4
7
5
8
import pytest
6
9
from seleniumbase import BaseCase
@@ -10,6 +13,6 @@ class MyTestClass(BaseCase):
10
13
11
14
@pytest .mark .expected_failure
12
15
def test_time_limit_feature (self ):
13
- self .set_time_limit (6 ) # Test fails if run- time exceeds limit
16
+ self .set_time_limit (5 ) # Fail test if time exceeds 5 seconds
14
17
self .open ("https://xkcd.com/1658/" )
15
18
self .sleep (7 )
Original file line number Diff line number Diff line change
1
+ from seleniumbase import BaseCase
2
+
3
+
4
+ class MyTestClass (BaseCase ):
5
+
6
+ def test_example_1 (self ):
7
+ url = "https://store.xkcd.com/collections/everything"
8
+ self .open (url )
9
+ self .update_text ("input.search-input" , "xkcd book\n " )
10
+ self .assert_exact_text ("xkcd: volume 0" , "h3" )
11
+ self .click ("li.checkout-link" )
12
+ self .assert_text ("Shopping Cart" , "#page-title" )
13
+ self .assert_element ("div#umbrella" )
14
+ self .open ("https://xkcd.com/353/" )
15
+ self .assert_title ("xkcd: Python" )
16
+ self .assert_element ('img[alt="Python"]' )
17
+ self .click ('a[rel="license"]' )
18
+ self .assert_text ("back to this page" )
19
+ self .go_back ()
20
+ self .click ("link=About" )
21
+ self .assert_text ("xkcd.com" , "h2" )
You can’t perform that action at this time.
0 commit comments