Skip to content

Commit a1ed6a5

Browse files
committed
Home page create sketch modal improvement
1 parent 70583f8 commit a1ed6a5

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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 selenium.webdriver.support.ui import Select
6+
from codebender_testing import config
7+
from codebender_testing.config import STAGING_SITE_URL
8+
from selenium.webdriver.common.action_chains import ActionChains
9+
import os
10+
import time
11+
import pytest
12+
13+
class TestSketchesCounters(SeleniumTestCase):
14+
15+
def test_sketches_counters(self):
16+
self.driver.implicitly_wait(30)
17+
driver = self.driver
18+
self.open("/")
19+
#Login and visit the new home page.
20+
credentials = {
21+
'username': os.environ.get('CODEBENDER_TEST_USER'),
22+
'password': os.environ.get('CODEBENDER_TEST_PASS'),
23+
}
24+
driver.find_element_by_id("login_btn").click()
25+
driver.find_element_by_id("username").clear()
26+
driver.find_element_by_id("username").send_keys(credentials['username'])
27+
driver.find_element_by_id("password").clear()
28+
driver.find_element_by_id("password").send_keys(credentials['password'])
29+
driver.find_element_by_id("_submit").click()
30+
31+
assert driver.find_element_by_id("private-sketches-counter").text=="0"
32+
assert driver.find_element_by_id("public-sketches-counter").text=="0"
33+
34+
#Create 1 public sketch
35+
driver.find_element_by_id("create_sketch_btn").click()
36+
#Check that when the create sketch modal opens, the sketch name input has focus
37+
38+
driver.find_element_by_id("create-sketch-modal-action-button").click()
39+
self.get_element(By.ID, "save")
40+
driver.find_element_by_id("logo_small").click()
41+
42+
43+
#Check that when the input has focus and you press Enter,
44+
#the create sketch action is executed and the user is redirected into the new sketch in editor
45+
46+
47+
class TestDeleteAllSketches(SeleniumTestCase):
48+
49+
@pytest.mark.requires_url(STAGING_SITE_URL)
50+
def test_delete(self, tester_login):
51+
try:
52+
sketches = self.find_all('#project_list > li .sketch-block-title > a')
53+
projects = []
54+
for sketch in sketches:
55+
projects.append(sketch.text)
56+
for project in projects:
57+
self.delete_project(project)
58+
except:
59+
print 'No sketches found'
60+
61+
self.logout()

0 commit comments

Comments
 (0)