File tree Expand file tree Collapse file tree 5 files changed +36
-16
lines changed Expand file tree Collapse file tree 5 files changed +36
-16
lines changed Original file line number Diff line number Diff line change @@ -63,11 +63,11 @@ def __init__(self, master):
63
63
fg = "red" ).pack ()
64
64
self .title7 = Label (
65
65
frame ,
66
- text = "Run a Failing Test with Delayed Asserts:" ,
66
+ text = "Run a Failing Test with Deferred Asserts:" ,
67
67
fg = "blue" ).pack ()
68
68
self .run7 = Button (
69
69
frame , command = self .run_7 ,
70
- text = ("pytest test_delayed_asserts .py --browser=chrome" ),
70
+ text = ("pytest test_deferred_asserts .py --browser=chrome" ),
71
71
fg = "red" ).pack ()
72
72
self .end_title = Label (frame , text = "" , fg = "black" ).pack ()
73
73
self .quit = Button (frame , text = "QUIT" , command = frame .quit ).pack ()
@@ -98,7 +98,7 @@ def run_6(self):
98
98
99
99
def run_7 (self ):
100
100
os .system (
101
- 'pytest test_delayed_asserts .py --browser=chrome' )
101
+ 'pytest test_deferred_asserts .py --browser=chrome' )
102
102
103
103
104
104
if __name__ == "__main__" :
Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ class MyTestClass(BaseCase):
6
6
def test_alerts (self ):
7
7
self .open ("about:blank" )
8
8
self .execute_script ('window.alert("ALERT!!!")' )
9
- self .sleep (1.2 ) # Not needed (Lets you see the alert pop up)
10
- self .wait_for_and_accept_alert ()
11
- self .sleep (0.8 ) # Not needed (Lets you see the alert go away)
9
+ self .sleep (1 ) # Not needed (Lets you see the alert pop up)
10
+ self .accept_alert ()
11
+ self .sleep (1 ) # Not needed (Lets you see the alert go away)
12
12
self .execute_script ('window.prompt("My Prompt","defaultText");' )
13
- self .sleep (1.2 ) # Not needed (Lets you see the alert pop up)
14
- alert = self .wait_for_and_switch_to_alert ( timeout = 2 )
15
- self .assert_equal (alert .text , "My Prompt" ) # Not the input field
16
- self .wait_for_and_dismiss_alert ()
17
- self .sleep (0.8 ) # Not needed (Lets you see the alert go away)
13
+ self .sleep (1 ) # Not needed (Lets you see the alert pop up)
14
+ alert = self .switch_to_alert ( )
15
+ self .assert_equal (alert .text , "My Prompt" ) # Not input field
16
+ self .dismiss_alert ()
17
+ self .sleep (1 ) # Not needed (Lets you see the alert go away)
Original file line number Diff line number Diff line change
1
+ import pytest
2
+ from seleniumbase import BaseCase
3
+
4
+
5
+ @pytest .mark .offline # Can be run with: "pytest -m offline"
6
+ class OfflineTestClass (BaseCase ):
7
+
8
+ def test_alerts (self ):
9
+ self .open ("data:," )
10
+ self .execute_script ('window.alert("ALERT!!!")' )
11
+ self .sleep (1 ) # Not needed (Lets you see the alert pop up)
12
+ self .accept_alert ()
13
+ self .sleep (1 ) # Not needed (Lets you see the alert go away)
14
+ self .execute_script ('window.prompt("My Prompt","defaultText");' )
15
+ self .sleep (1 ) # Not needed (Lets you see the alert pop up)
16
+ alert = self .switch_to_alert ()
17
+ self .assert_equal (alert .text , "My Prompt" ) # Not input field
18
+ self .dismiss_alert ()
19
+ self .sleep (1 ) # Not needed (Lets you see the alert go away)
Original file line number Diff line number Diff line change 7
7
class OfflineTestClass (BaseCase ):
8
8
9
9
def test_demo_page (self ):
10
- # Load a local html file into the browser
11
- dir_name = os .path .dirname (os .path .abspath (__file__ ))
12
- self .load_html_file (dir_name + "/demo_page.html" )
10
+ # Load a local html file into the web browser
11
+ dir_path = os .path .dirname (os .path .abspath (__file__ ))
12
+ file_path = dir_path + "/demo_page.html"
13
+ self .load_html_file (file_path )
13
14
14
15
# Assert the title of the current web page
15
16
self .assert_title ("Web Testing Page" )
Original file line number Diff line number Diff line change @@ -9,11 +9,11 @@ def test_exemple_1(self):
9
9
self .vérifier_texte ("Wikipédia" ) # noqa
10
10
self .vérifier_élément ('[title="Visiter la page d’accueil"]' )
11
11
self .modifier_texte ("#searchInput" , "Crème brûlée" )
12
- self .cliquez_sur ("#searchButton" )
12
+ self .cliquer ("#searchButton" )
13
13
self .vérifier_texte ("Crème brûlée" , "#firstHeading" )
14
14
self .vérifier_élément ('img[alt*="Crème brûlée"]' )
15
15
self .modifier_texte ("#searchInput" , "Jardin des Tuileries" )
16
- self .cliquez_sur ("#searchButton" )
16
+ self .cliquer ("#searchButton" )
17
17
self .vérifier_texte ("Jardin des Tuileries" , "#firstHeading" )
18
18
self .vérifier_élément ('img[alt*="Jardin des Tuileries"]' )
19
19
self .retour ()
You can’t perform that action at this time.
0 commit comments