Skip to content

Commit 6c754fc

Browse files
author
Brandon Duffany
committed
Merge branch 'master' into bduffany-selenium1
Conflicts: tests/sketch/test_sketch.py Also, this commit fixes a minor issue with `tests/sketch/test_sketch.py`
2 parents 1cc3f4c + 8b8ab6a commit 6c754fc

File tree

2 files changed

+46
-10
lines changed

2 files changed

+46
-10
lines changed

tests/home/test_home.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_login(self):
6363

6464
# re-click on login button
6565
login_elem = driver.find_element_by_id("login_btn")
66-
login_elem.send_keys(Keys.RETURN)
66+
login_elem.send_keys(Keys.RETURN)
6767

6868
# re-define elements in login form
6969
username_elem = driver.find_element_by_id("username")
@@ -72,16 +72,12 @@ def test_login(self):
7272

7373
# log in to site using correct credentials
7474
username_elem.clear()
75+
password_elem.clear()
7576
username_elem.send_keys(TEST_CREDENTIALS['username'])
7677
password_elem.send_keys(TEST_CREDENTIALS['password'])
7778
submit_elem.click()
7879
assert "Logged in as" in driver.page_source
7980

80-
def test_quit(self):
81-
""" closes driver """
82-
driver = self.driver
83-
#driver.quit()
84-
8581

8682

8783

tests/sketch/test_sketch.py

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ def open_test_project(self, tester_login):
2828
"""Makes sure we are logged in and have a project open before
2929
performing any of these tests."""
3030
self.open_project()
31-
# I get a StaleElementReferenceException without
32-
# this wait. TODO: figure out how to get around this.
33-
time.sleep(3)
3431

3532
def test_verify_code(self):
3633
"""Ensures that we can compile code and see the success message."""
37-
compile_button = self.driver.find_element_by_id("compile")
34+
compile_button = self.get_element(By.ID, "compile")
3835
compile_button.click()
3936

37+
# test progress bar is visible
38+
progress_bar = self.get_element(By.ID, 'progress')
39+
assert progress_bar.is_displayed()
40+
4041
WebDriverWait(self.driver, VERIFY_TIMEOUT).until(
4142
expected_conditions.text_to_be_present_in_element(
4243
(By.ID, "operation_output"), "Verification Successful!")
@@ -95,3 +96,42 @@ def test_clone_project(self):
9596
# Cleanup: delete the project we just created.
9697
self.delete_project("%s copy" % TEST_PROJECT_NAME)
9798

99+
100+
def test_add_projectfile_direct(self):
101+
""" Tests that new file can be added to project using create-new-file
102+
field """
103+
self.open_project()
104+
105+
add_button = self.get_element(By.CLASS_NAME, 'icon-plus')
106+
add_button.click()
107+
create_field = self.get_element(By.ID, 'createfield')
108+
create_field.send_keys('test_file.txt')
109+
create_button = self.get_element(By.CLASS_NAME, 'btn')
110+
create_button.click()
111+
self.driver.refresh()
112+
assert 'test_file.txt' in self.driver.page_source
113+
114+
'''
115+
def test_add_projectfile_upload(self):
116+
""" Tests that new file can be added to project using upload dialog """
117+
add_button = self.get_element(By.CLASS_NAME, 'icon-plus')
118+
add_button.click()
119+
drop_zone = self.get_element(By.CLASS_NAME, 'dz-clickable')
120+
drop_zone.click()
121+
self.driver.get("http://localhost/js/dropzone/min.js")
122+
self.driver.execute_script("self.get_element(By.NAME,'uploadType').value = '/test.h'")
123+
#file_input_element = self.get_element(By.NAME, 'uploadType')'''
124+
125+
def test_delete_file(self):
126+
"""Tests file delete modal """
127+
delete_file_button = self.get_element(By.CLASS_NAME, 'icon-remove')
128+
delete_file_button.click()
129+
delete_modal = self.get_element(By.ID, 'filedeleteModal')
130+
assert delete_modal.is_displayed()
131+
132+
def test_verify_deletion(self):
133+
""" Verifies that file has been deleted """
134+
confirm_delete_button = self.get_element(By.ID, 'filedeleteButton')
135+
confirm_delete_button.click()
136+
self.driver.refresh()
137+
assert 'test_file.txt' not in self.driver.page_source

0 commit comments

Comments
 (0)