6
6
from selenium .webdriver .support import expected_conditions
7
7
from selenium .webdriver .support .ui import WebDriverWait
8
8
9
- from codebender_testing .config import VERIFY_TIMEOUT
10
9
from codebender_testing .utils import logged_in
11
10
from codebender_testing .utils import SeleniumTestCase
12
11
13
12
13
+ # How long to wait before we give up on the 'verify' command (in seconds)
14
+ VERIFY_TIMEOUT = 10
15
+
16
+ # How long to wait before we give up on finding an element on the page.
17
+ ELEMENT_FIND_TIMEOUT = 5
18
+
19
+
14
20
class TestSketch (SeleniumTestCase ):
15
21
16
22
@logged_in
17
23
def test_verify_code (self ):
18
- test_project_link = self .driver .find_element_by_link_text ('test_project' )
19
- test_project_link .send_keys (Keys .ENTER )
24
+ self .open_project ()
20
25
21
26
# I get a StaleElementReferenceException without
22
27
# this wait. TODO: figure out how to get around this.
@@ -25,11 +30,24 @@ def test_verify_code(self):
25
30
compile_button = self .driver .find_element_by_id ("compile" )
26
31
compile_button .click ()
27
32
28
- try :
29
- WebDriverWait (self .driver , VERIFY_TIMEOUT ).until (
30
- expected_conditions .text_to_be_present_in_element (
31
- (By .ID , "operation_output" ), "Verification Successful!" )
32
- )
33
- except :
34
- raise
33
+ WebDriverWait (self .driver , VERIFY_TIMEOUT ).until (
34
+ expected_conditions .text_to_be_present_in_element (
35
+ (By .ID , "operation_output" ), "Verification Successful!" )
36
+ )
37
+
38
+ @logged_in
39
+ def test_boards_dropdown (self ):
40
+ self .open_project ()
41
+
42
+ WebDriverWait (self .driver , ELEMENT_FIND_TIMEOUT ).until (
43
+ expected_conditions .presence_of_element_located (
44
+ (By .ID , "boards" ))
45
+ )
46
+
47
+ boards_dropdown = self .driver .find_element_by_id ("boards" )
48
+ options = boards_dropdown .find_elements_by_tag_name ("option" )
49
+
50
+ # Click something other than the first option
51
+ test_option = options [3 ]
52
+ test_option .click ()
35
53
0 commit comments