-
Notifications
You must be signed in to change notification settings - Fork 5
Frontend js unit tests #676 #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
dc9c4d6
8ab2bad
a9fdec2
8e68b45
e9560a4
c36d6bf
a331a1f
b04cdd2
ca761f9
5d85a87
f40629d
fdd54d9
04644d4
458eb85
1a058b5
2cca710
d84b4da
b3d143c
5f3db1d
e2491ec
8740785
0586f9d
0fa143b
b881a82
211cb29
9fec384
b5c8aaa
3f32f26
45e3c43
97eb8e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Pull Request: | ||
https://github.com/codebendercc/codebender.cc/pull/676 | ||
|
||
Selenium_Test_Script | ||
|
||
Homepage Test Caces: | ||
test_sketches_counters.py : Check that the counters of the sketches are correct. | ||
|
||
|
||
Login and visit the new home page. | ||
Create 2 public sketches | ||
Create 2 private sketches | ||
Check that when the page loads, the loading screen appears and message "Loading the Sketches, please wait" is displayed. | ||
Check that the counters: | ||
Public sketches (blue) have the correct value. | ||
Private sketches (purple) have the correct value. | ||
Check that the counter for private projects also appears at the Badges section and has the correct value. | ||
Check that if your account has private projects (e.g. 2) and all yor projects are public, counter for available private sketches should be 0/number of total private sketches(e.g. 0/2) and the link to the private sketches should be Add more. | ||
|
||
Check that the number of private projects available is updated each time that you make a change (e.g from private to public and vice versa). | ||
Change the privite sketch to public | ||
Change the public to private | ||
|
||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
from codebender_testing.utils import SeleniumTestCase | ||
from selenium import webdriver | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.common.keys import Keys | ||
from selenium.webdriver.support.ui import Select | ||
from selenium.common.exceptions import NoSuchElementException | ||
|
||
from selenium.common.exceptions import NoAlertPresentException | ||
|
||
import unittest, time, re | ||
|
||
|
||
class TestSketchesCounters(SeleniumTestCase): | ||
|
||
def test_sketches_counters(self): | ||
self.driver = webdriver.Firefox() | ||
|
||
self.driver.implicitly_wait(30) | ||
self.base_url = "https://staging.codebender.cc/" | ||
|
||
self.verificationErrors = [] | ||
|
||
self.accept_next_alert = True | ||
|
||
driver = self.driver | ||
driver.get(self.base_url + "/") | ||
|
||
driver.find_element_by_id("login_btn").click() | ||
driver.find_element_by_id("username").clear() | ||
driver.find_element_by_id("username").send_keys("demo_user") | ||
|
||
driver.find_element_by_id("password").clear() | ||
|
||
driver.find_element_by_id("password").send_keys("testerPASS") | ||
|
||
driver.find_element_by_id("_submit").click() | ||
driver.find_element_by_id("create_sketch_btn").click() | ||
|
||
|
||
driver.find_element_by_id("create-sketch-modal-action-button").click() | ||
time.sleep(5) | ||
|
||
driver.find_element_by_id("logo_small").click() | ||
driver.find_element_by_id("create_sketch_btn").click() | ||
driver.find_element_by_id("create-sketch-modal-action-button").click() | ||
time.sleep(5) | ||
driver.find_element_by_id("logo_small").click() | ||
driver.find_element_by_id("create_sketch_btn").click() | ||
driver.find_element_by_xpath("(//input[@name='create-sketch-modal-title'])[2]").click() | ||
driver.find_element_by_id("create-sketch-modal-action-button").click() | ||
time.sleep(5) | ||
driver.find_element_by_id("logo_small").click() | ||
driver.find_element_by_id("create_sketch_btn").click() | ||
driver.find_element_by_xpath("(//input[@name='create-sketch-modal-title'])[2]").click() | ||
driver.find_element_by_id("create-sketch-modal-action-button").click() | ||
time.sleep(5) | ||
driver.find_element_by_id("logo_small").click() | ||
assert driver.find_element_by_id("private-sketches-counter").text=="2" | ||
|
||
assert driver.find_element_by_id("public-sketches-counter").text=="2" | ||
assert driver.find_element_by_id("privateProjectAvailableNumber").text=="0" | ||
assert driver.find_element_by_id("available-private-projects-counter").text=="0/2" | ||
assert "Add more"==driver.find_element_by_link_text("Add more").text | ||
|
||
|
||
#Private-->Public | ||
driver.find_element_by_link_text("Edit Info").click() | ||
time.sleep(5) | ||
driver.find_element_by_name("edit-sketch-modal-title").click() | ||
driver.find_element_by_id("edit-sketch-modal-action-button").click() | ||
time.sleep(5) | ||
assert driver.find_element_by_id("private-sketches-counter").text=="1" | ||
assert driver.find_element_by_id("public-sketches-counter").text=="3" | ||
|
||
#Public-->Private | ||
driver.find_element_by_link_text("Edit Info").click() | ||
time.sleep(5) | ||
driver.find_element_by_xpath("(//input[@name='edit-sketch-modal-title'])[2]").click() | ||
driver.find_element_by_id("edit-sketch-modal-action-button").click() | ||
time.sleep(5) | ||
assert driver.find_element_by_id("private-sketches-counter").text=="2" | ||
|
||
assert driver.find_element_by_id("public-sketches-counter").text=="2" | ||
#for x in range(0, 3): | ||
|
||
# driver.find_element_by_css_selector("i.fa.fa-trash").click() | ||
# driver.find_element_by_css_selector("div.modal-footer.delete-sketch-modal-footer > button.btn.delete-sketch-modal-button").click() | ||
#driver.find_element_by_css_selector("div.modal-footer.delete-sketch-modal-footer > button.btn.btn-danger").click() | ||
|
||
|
||
|
||
driver.find_element_by_id("logout").click() | ||
|
||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can the use .md extension in the Readme (e.g. Readme.md) so we can write in markdown the documentation.