Skip to content

Commit 38aae70

Browse files
author
Konstantina Kastanara
authored
Merge pull request #39 from codebendercc/modal_improvement
User's home page Create Modal improvement tests.
2 parents 6555ef4 + 7894935 commit 38aae70

File tree

3 files changed

+64
-9
lines changed

3 files changed

+64
-9
lines changed

bin/seleniumbender

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ done
6363

6464
cd ..
6565

66-
URL="https://codebender.cc"
66+
URL="https://staging.codebender.cc"
6767

6868
email_date=$(date +"%Y-%m-%d %H:%M:%S")
6969

logs/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
from codebender_testing.utils import SeleniumTestCase
2+
from selenium import webdriver
3+
from selenium.webdriver.common.by import By
4+
from selenium.webdriver.common.keys import Keys
5+
from codebender_testing import config
6+
from selenium.webdriver.common.action_chains import ActionChains
7+
from selenium.webdriver.support import expected_conditions
8+
from codebender_testing.config import TIMEOUT
9+
from selenium.webdriver.support.ui import WebDriverWait
10+
import pytest
11+
12+
class TestSketchesCounters(SeleniumTestCase):
13+
14+
@pytest.fixture(scope="class", autouse=True)
15+
def open_user_home(self, tester_login):
16+
"""Makes sure we are logged in and are at the user home page
17+
performing any of these tests."""
18+
pass
19+
20+
def test_create_sketch_modal(self):
21+
# Create a public project.
22+
createSketchBtn = self.get_element(By.ID, 'create_sketch_btn')
23+
createSketchBtn.click()
24+
WebDriverWait(self.driver, TIMEOUT['LOCATE_ELEMENT']).until(
25+
expected_conditions.visibility_of_element_located(
26+
(By.CSS_SELECTOR, "#create-sketch-modal")
27+
)
28+
)
29+
createBtn = self.get_element(
30+
By.ID, 'create-sketch-modal-action-button')
31+
32+
createdProject = self.get_element(
33+
By.ID, 'create-sketch-name').get_attribute('value')
34+
35+
# Check that when the create sketch modal opens,
36+
# the sketch name input has focus.
37+
assert self.get_element(By.ID, 'create-sketch-name') == \
38+
self.driver.switch_to.active_element
39+
40+
# Check that when the input has focus and you press Enter,
41+
# the create sketch action is executed.
42+
self.get_element(By.ID, 'create-sketch-name').send_keys(Keys.ENTER)
43+
44+
self.get_element(By.CSS_SELECTOR, '#create-sketch-modal-action-button .fa-spinner')
45+
46+
# Check that during the sketch creation,
47+
# the sketch privacy radio buttons are disabled.
48+
publicRadioButton = self.get_element(By.CSS_SELECTOR,
49+
'#create-sketch-modal-type-controls [value="public"]')
50+
privateRadioButton = self.get_element(By.CSS_SELECTOR,
51+
'#create-sketch-modal-type-controls [value="private"]')
52+
assert publicRadioButton.get_attribute('disabled')
53+
assert privateRadioButton.get_attribute('disabled')
54+
55+
WebDriverWait(self.driver, TIMEOUT['LOCATE_ELEMENT']).until(
56+
expected_conditions.element_to_be_clickable(
57+
(By.CSS_SELECTOR, "#editor_heading_project_name")
58+
)
59+
)
60+
61+
# Delete the created project.
62+
self.open("/")
63+
self.delete_project(createdProject)

0 commit comments

Comments
 (0)