File tree Expand file tree Collapse file tree 5 files changed +40
-1
lines changed Expand file tree Collapse file tree 5 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 1
1
from selenium import webdriver
2
2
3
3
4
+ # URL of the site to be used for testing
4
5
BASE_URL = "http://localhost"
5
6
7
+ # Selenium Webdrivers to be used for selenium tests
6
8
WEBDRIVERS = {
7
9
"firefox" : webdriver .Firefox ,
8
10
"chrome" : webdriver .Chrome
9
11
}
10
12
13
+ # Credentials to use when logging into the site via selenium
11
14
TEST_CREDENTIALS = {
12
15
"username" : "tester" ,
13
16
"password" : "testerPASS"
14
17
}
18
+
19
+ # How long to wait before we give up on the 'verify' command (in seconds)
20
+ VERIFY_TIMEOUT = 10
21
+
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ def open(self, url=None):
35
35
# url specifies an absolute path.
36
36
return self .driver .get (url )
37
37
else :
38
+ url = url .lstrip ('/' )
38
39
return self .driver .get ("%s/%s" % (BASE_URL , url ))
39
40
40
41
Original file line number Diff line number Diff line change @@ -7,8 +7,8 @@ def test_navigate_home(self):
7
7
self .open ("/" )
8
8
assert "Codebender" in self .driver .title
9
9
10
- #tests login features
11
10
def test_login (self ):
11
+ """Test to ensure the login box is displayed"""
12
12
driver = self .driver
13
13
self .open ("/" )
14
14
login_elem = driver .find_element_by_id ("login_btn" ) #finds login button
Original file line number Diff line number Diff line change
1
+ from selenium .webdriver .common .by import By
2
+ from selenium .webdriver .common .keys import Keys
3
+ from selenium .webdriver .support import expected_conditions
4
+ from selenium .webdriver .support .ui import WebDriverWait
5
+
6
+ from codebender_testing .config import VERIFY_TIMEOUT
7
+ from codebender_testing .utils import logged_in
8
+ from codebender_testing .utils import SeleniumTestCase
9
+
10
+
11
+ class TestSketch (SeleniumTestCase ):
12
+
13
+ @logged_in
14
+ def test_verify_code (self ):
15
+ test_project_link = self .driver .find_element_by_link_text ('test_project' )
16
+ test_project_link .send_keys (Keys .ENTER )
17
+
18
+ compile_button = self .driver .find_element_by_id ("compile" )
19
+ compile_button .click ()
20
+
21
+ try :
22
+ WebDriverWait (self .driver , VERIFY_TIMEOUT ).until (
23
+ expected_conditions .text_to_be_present_in_element (
24
+ (By .ID , "operation_output" ), "Verification Successful!" )
25
+ )
26
+ except :
27
+ raise
28
+ # assert False, "Test timed out"
29
+
30
+ assert output .text == "Verification Successful!"
31
+
You can’t perform that action at this time.
0 commit comments