11
11
from codebender_testing .utils import SeleniumTestCase
12
12
13
13
14
- # How long to wait before we give up on the 'verify' command (in seconds)
14
+ # How long to wait before we give up on trying to assess the result of commands
15
15
VERIFY_TIMEOUT = 10
16
-
17
- # How long to wait before we give up on finding an element on the page.
18
- ELEMENT_FIND_TIMEOUT = 5
16
+ FLASH_TIMEOUT = 2
19
17
20
18
# Board to test for the dropdown selector.
21
19
TEST_BOARD = "Arduino Fio"
@@ -32,7 +30,7 @@ def open_test_project(self, tester_login):
32
30
# I get a StaleElementReferenceException without
33
31
# this wait. TODO: figure out how to get around this.
34
32
time .sleep (3 )
35
-
33
+
36
34
def test_verify_code (self ):
37
35
"""Ensures that we can compile code and see the success message."""
38
36
compile_button = self .driver .find_element_by_id ("compile" )
@@ -46,15 +44,22 @@ def test_verify_code(self):
46
44
def test_boards_dropdown (self ):
47
45
"""Tests that the boards dropdown is present, and that we can change
48
46
the board successfully."""
49
- WebDriverWait (self .driver , ELEMENT_FIND_TIMEOUT ).until (
50
- expected_conditions .presence_of_element_located (
51
- (By .ID , "boards" ))
52
- )
53
-
54
- boards_dropdown = Select (self .driver .find_element_by_id ("boards" ))
47
+ boards_dropdown = Select (self .get_element (By .ID , "boards" ))
55
48
56
49
# Click something other than the first option
57
50
boards_dropdown .select_by_visible_text (TEST_BOARD )
58
51
59
52
assert boards_dropdown .first_selected_option .text == TEST_BOARD
60
53
54
+ def test_ports_dropdown (self ):
55
+ """Ensures that the ports dropdown exists."""
56
+ self .get_element (By .ID , "ports" )
57
+
58
+ def test_run_with_no_port (self ):
59
+ """Makes sure that there is an error when we attempt to run with no
60
+ port selected."""
61
+ flash_button = self .get_element (By .ID , "usbflash" )
62
+ flash_button .click ()
63
+ WebDriverWait (self .driver , FLASH_TIMEOUT ).until (
64
+ expected_condiditons .text_to_be_present_in_element (
65
+ (By .ID , "operation_output" ), "Please select a valid port or enable the plugin!!" ))
0 commit comments