File tree Expand file tree Collapse file tree 4 files changed +29
-3
lines changed Expand file tree Collapse file tree 4 files changed +29
-3
lines changed Original file line number Diff line number Diff line change
1
+ from selenium import webdriver
2
+
3
+
4
+ WEBDRIVERS = {
5
+ "firefox" : webdriver .Firefox ,
6
+ "chrome" : webdriver .Chrome
7
+ }
Original file line number Diff line number Diff line change
1
+ import sys
2
+
3
+ from selenium import webdriver
4
+ import pytest
5
+
6
+ from codebender_testing .config import WEBDRIVERS
7
+
8
+
9
+ class SeleniumTestCase (object ):
10
+ """Base class for all Selenium tests."""
11
+
12
+ @classmethod
13
+ @pytest .fixture (scope = "class" , autouse = True , params = WEBDRIVERS .keys ())
14
+ def setup (self , request ):
15
+ """Sets up attributes that should be accessible to all test cases."""
16
+
17
+ # We repeat each test for each webdriver configuration
18
+ webdriver_cls = WEBDRIVERS [request .param ]
19
+ self .driver = webdriver_cls ()
20
+
Original file line number Diff line number Diff line change 1
- from selenium import webdriver
1
+ from codebender_testing . utils import SeleniumTestCase
2
2
3
- class TestHome :
4
3
5
- driver = webdriver . Firefox ()
4
+ class TestHome ( SeleniumTestCase ):
6
5
7
6
def test_navigate_home (self ):
8
7
self .driver .get ("http://localhost" )
You can’t perform that action at this time.
0 commit comments