Skip to content

Commit 5bd2390

Browse files
author
Konstantinacc
committed
Updated delete_project function is utils.py file.
Deletion process has changed in homepage redesign, so delete_project function was modified. delete_projects locates a project by its name, clicks on Delete button, checks that deletion was successful and closes the delete sketch modal. If any of the above actions fails, test continues and a warning message is displayed on terminal.
1 parent 1e5c5d9 commit 5bd2390

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

codebender_testing/utils.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,22 @@ def delete_project(self, project_name):
409409
self.open('/')
410410
try:
411411
created_project = self.get_element(By.LINK_TEXT, project_name)
412-
delete_button_li = created_project.find_element_by_xpath('..')
413-
delete_button = delete_button_li.find_element_by_css_selector('.delete-sketch')
412+
delete_button_li = created_project.find_element_by_xpath('../..')
413+
delete_button = delete_button_li.find_element_by_css_selector('.sketch-block-controls :nth-child(3)')
414414
delete_button.click()
415-
popup_delete_button = self.get_element(By.ID, 'deleteProjectButton')
415+
popup_delete_button = self.get_element(By.CSS_SELECTOR, '#home-delete-sketch-modal :nth-child(4) :nth-child(2)')
416416
popup_delete_button.click()
417+
popup_delete_message = self.get_element(By.CSS_SELECTOR, '#home-delete-sketch-modal .modal-footer.delete-sketch-modal-footer .delete-sketch-modal-message.success')
418+
assert popup_delete_message.text == "Sketch was deleted!"
419+
popup_close_button = self.get_element(By.CSS_SELECTOR, '#home-delete-sketch-modal :nth-child(4) :nth-child(3)')
420+
popup_close_button.click()
421+
WebDriverWait(self.driver, VERIFY_TIMEOUT).until(
422+
expected_conditions.invisibility_of_element_located(
423+
(By.CSS_SELECTOR, "#home-delete-sketch-modal")
424+
)
425+
)
417426
except:
418-
pass
427+
print "An action failed during deletion process of project:", project_name
419428

420429
def resume_log (self, logfile, compile_type, sketches):
421430
"""Resume previous log, if any. Coves 3 cases:

0 commit comments

Comments
 (0)