File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 1
1
from unittest import TestCase
2
2
3
+ from applitools .common import MatchLevel
4
+ from applitools .selenium import Eyes
3
5
from selenium import webdriver
4
6
7
+ from automation .config .base import APPLITOOLS_API_KEY
8
+
5
9
6
10
class BaseTest (TestCase ):
7
- def setUp (self ):
11
+ def setup (self , test_name ):
8
12
self .driver = webdriver .Chrome ()
9
13
self .driver .get ('https://applitools.com/helloworld' )
14
+ self .eyes = self .open_eyes (test_name )
10
15
11
- def tearDown (self ):
16
+ def teardown (self ):
12
17
self .driver .quit ()
18
+ self .close_eyes ()
19
+
20
+ def open_eyes (self , test_name ):
21
+ self .eyes = Eyes ()
22
+ self .eyes .api_key = APPLITOOLS_API_KEY
23
+
24
+ self .eyes .match_level = MatchLevel .STRICT
25
+ self .eyes .open (self .driver , app_name = 'hello_world' ,
26
+ test_name = test_name )
27
+
28
+ return self .eyes
29
+
30
+ def close_eyes (self ):
31
+ self .eyes .close ()
32
+
33
+ def validate_window (self , tag ):
34
+ self .eyes .check_window (tag )
Original file line number Diff line number Diff line change 4
4
class HelloWorldTest (BaseTest ):
5
5
6
6
def test_hello_world (self ):
7
- pass
7
+ self .setup (test_name = self ._testMethodName )
8
+
9
+ self .validate_window (tag = 'hello_world' )
10
+ self .driver .find_element_by_css_selector ('button' ).click ()
11
+ self .validate_window ('click_me' )
12
+
13
+ self .teardown ()
You can’t perform that action at this time.
0 commit comments