Skip to content

Commit 296a7aa

Browse files
author
konstantina
committed
Updated create_project function and related tests.
When a project is created we now check that we can change the privacy property, the name and the short description. Also added tests to check that we can change name and short description when on editor.
1 parent f75cd14 commit 296a7aa

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

codebender_testing/utils.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -857,17 +857,24 @@ def execute_script(self, script, *deps):
857857
)
858858
return self.driver.execute_script(script)
859859

860-
def create_sketch(self, name):
860+
def create_sketch(self, privacy, name, description):
861861
"""Creates a sketch with a given name"""
862862
createSketchBtn = self.driver.find_element_by_id('create_sketch_btn')
863863
createSketchBtn.click()
864-
createBtn = self.get_element(By.ID, 'create-sketch-modal-action-button')
865-
createBtn.click()
866864
WebDriverWait(self.driver, VERIFY_TIMEOUT).until(
867865
expected_conditions.visibility_of_element_located(
868-
(By.CSS_SELECTOR, "#editor-loading-screen")
866+
(By.CSS_SELECTOR, "#create-sketch-modal")
869867
)
870868
)
869+
870+
self.change_privacy(privacy)
871+
872+
self.change_name(name)
873+
874+
self.change_short_description(description)
875+
876+
createBtn = self.get_element(By.ID, 'create-sketch-modal-action-button')
877+
createBtn.click()
871878
WebDriverWait(self.driver, VERIFY_TIMEOUT).until(
872879
expected_conditions.invisibility_of_element_located(
873880
(By.CSS_SELECTOR, "#editor-loading-screen")

tests/common/sketch/test_sketch.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from codebender_testing.utils import SeleniumTestCase
99
from codebender_testing.utils import SELECT_BOARD_SCRIPT
1010
from codebender_testing.utils import throttle_compile
11+
from selenium.webdriver.common.keys import Keys
1112

1213

1314
# How long to wait before we give up on trying to assess the result of commands
@@ -25,7 +26,13 @@ class TestSketch(SeleniumTestCase):
2526
def create_test_project(self, tester_login):
2627
"""Makes sure we are logged in and have a project open before
2728
performing any of these tests."""
28-
self.create_sketch(TEST_PROJECT_NAME)
29+
self.create_sketch('private' , 'project', 'short description')
30+
31+
def test_rename_project(self):
32+
self.change_name_editor(TEST_PROJECT_NAME)
33+
34+
def test_change_short_description(self):
35+
self.change_short_description_editor('decription')
2936

3037
def test_verify_code(self):
3138
"""Ensures that we can compile code and see the success message."""
@@ -102,7 +109,7 @@ def test_clone_project(self):
102109
clone_link.click()
103110
project_name = self.get_element(By.ID, 'editor_heading_project_name')
104111
# Here, I use `startswith` in case the user has a bunch of
105-
# projects like "test_project copy copy copy" ...
112+
# projects like "test_project copy copy copy"
106113
assert project_name.text.startswith("%s copy" % TEST_PROJECT_NAME)
107114

108115
# Cleanup: delete the project we just created.

tests/noplugin/alerts/test_alerts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TestAlerts(SeleniumTestCase):
1414
def create_test_project(self, tester_login):
1515
"""Makes sure we are logged in and have a project open before
1616
performing any of these tests."""
17-
self.create_sketch(TEST_PROJECT_NAME)
17+
self.create_sketch('private' , TEST_PROJECT_NAME, 'short description')
1818

1919
@pytest.mark.does_not_require_extension
2020
def test_alert(self):

0 commit comments

Comments
 (0)