Skip to content

Commit 1cc3f4c

Browse files
author
Brandon Duffany
committed
Add sketch test
1 parent 24af966 commit 1cc3f4c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

tests/sketch/test_sketch.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def open_test_project(self, tester_login):
3131
# I get a StaleElementReferenceException without
3232
# this wait. TODO: figure out how to get around this.
3333
time.sleep(3)
34-
34+
3535
def test_verify_code(self):
3636
"""Ensures that we can compile code and see the success message."""
3737
compile_button = self.driver.find_element_by_id("compile")
@@ -69,10 +69,29 @@ def test_speeds_dropdown(self):
6969
"""Tests that the speeds dropdown exists."""
7070
self.get_element(By.ID, "baudrates")
7171

72+
def test_serial_monitor_disables_fields(self):
73+
"""Tests that opening the serial monitor disables the port and baudrate
74+
fields."""
75+
open_serial_monitor_button = self.get_element(By.ID, 'toggle_connect_serial')
76+
open_serial_monitor_button.click()
77+
78+
baudrate_field = self.get_element(By.ID, 'baudrates_placeholder')
79+
assert baudrate_field.get_attribute('disabled') == 'true'
80+
81+
ports_field = self.get_element(By.ID, 'ports_placeholder')
82+
assert ports_field.get_attribute('disabled') == 'true'
83+
84+
7285
def test_clone_project(self):
7386
"""Tests that clicking the 'Clone Project' link brings us to a new
7487
sketch with the title 'test_project clone'."""
7588
clone_link = self.get_element(By.LINK_TEXT, 'Clone Project')
7689
clone_link.click()
7790
project_name = self.get_element(By.ID, 'editor_heading_project_name')
91+
# Here, I use `startswith` in case the user has a bunch of
92+
# projects like "test_project copy copy copy" ...
7893
assert project_name.text.startswith("%s copy" % TEST_PROJECT_NAME)
94+
95+
# Cleanup: delete the project we just created.
96+
self.delete_project("%s copy" % TEST_PROJECT_NAME)
97+

0 commit comments

Comments
 (0)