Skip to content

Commit 51eb5aa

Browse files
author
Konstantinacc
committed
Removed code used in bachelor site.
seleniumbender: Removed argument "--source" from tox commands. config.py: Removed TEST_CREDENTIALS used when logging into the bachelor site. Removed names of sources used to generate the codebender site. utils.py: Removed reference to TEST_CREDENTIALS in function login. Updated comment related to bachelor site in function compile_sketch. conftest.py: Removed fixture requires_source since we have only codebender_cc source used to generate codebender site. Removed fixture source used to specify the source repository from which the site was derived (e.g. bachelor or codebender_cc). Removed Removed parser.addoption "--source" used to indicate the source used to generate the site. Removed TEST_CREDENTIALS used as default value in testing_credentials function. test_home.py: Removed TEST_CREDENTIALS used for bachelor site from test_login function. test_user_home.py: Removed functions test_create_project_blank_name, test_create_project_invalid_name, test_create_project_valid_name since the way that a project is created when Create sketch button is clicked has changed. Removed @pytest.mark.requires_source(SOURCE_CODEBENDER_CC).
1 parent d09ecbe commit 51eb5aa

File tree

6 files changed

+16
-109
lines changed

6 files changed

+16
-109
lines changed

bin/seleniumbender

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,24 +73,24 @@ NO_LOGS=0 # flag for tests that do not send any logs on their email
7373

7474
if [ "${target}" -eq 1 ]; then
7575
IDENTIFIER="test_target_libraries"
76-
tox tests/target_libraries -- --url=${URL} --source=${SOURCE} -F --plugin --libraries=${TARGETS}
76+
tox tests/target_libraries -- --url=${URL} -F --plugin --libraries=${TARGETS}
7777
elif [ "${examples}" -eq 1 ]; then
7878
IDENTIFIER="libraries_test"
79-
tox tests/libraries -- --url=${URL} --source=${SOURCE} -F --plugin
79+
tox tests/libraries -- --url=${URL} -F --plugin
8080
elif [ "${libraries}" -eq 1 ]; then
8181
IDENTIFIER="libraries_fetch"
82-
tox tests/libraries_fetch -- --url=${URL} --source=${SOURCE} -F --plugin
82+
tox tests/libraries_fetch -- --url=${URL} -F --plugin
8383
elif [ "${sketches}" -eq 1 ]; then
8484
IDENTIFIER="cb_compile_tester"
85-
tox tests/compile_tester -- --url=${URL} --source=${SOURCE} -F --plugin
85+
tox tests/compile_tester -- --url=${URL} -F --plugin
8686
elif [ "${common}" -eq 1 ]; then
8787
IDENTIFIER="common"
88-
tox tests/common -- --url=${URL} --source=${SOURCE} --plugin
88+
tox tests/common -- --url=${URL} --plugin
8989
RETVAL=$?
9090
NO_LOGS=1
9191
elif [ "${noplugin}" -eq 1 ]; then
9292
IDENTIFIER="noplugin"
93-
tox tests/noplugin -- --url=${URL} --source=${SOURCE}
93+
tox tests/noplugin -- --url=${URL}
9494
RETVAL=$?
9595
NO_LOGS=1
9696
elif [ "${walkthrough}" -eq 1 ]; then
@@ -99,17 +99,17 @@ elif [ "${walkthrough}" -eq 1 ]; then
9999
# Linux
100100
export SELENIUM_USER_AGENT_CHROME='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36'
101101
export SELENIUM_USER_AGENT='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 codebender-selenium'
102-
tox tests/walkthrough -- --url=${URL} --source=${SOURCE} --plugin
102+
tox tests/walkthrough -- --url=${URL} --plugin
103103
RETVALS+=($?)
104104
# Windows
105105
export SELENIUM_USER_AGENT_CHROME='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36'
106106
export SELENIUM_USER_AGENT='Mozilla/5.0 (Windows NT 6.1; rv:43.0) Gecko/20100101 Firefox/43.0 codebender-selenium'
107-
tox tests/walkthrough -- --url=${URL} --source=${SOURCE} --plugin
107+
tox tests/walkthrough -- --url=${URL} --plugin
108108
RETVALS+=($?)
109109
# MacOSX
110110
export SELENIUM_USER_AGENT_CHROME='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36'
111111
export SELENIUM_USER_AGENT='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1; rv:43.0) Gecko/20100101 Firefox/43.0 codebender-selenium'
112-
tox tests/walkthrough -- --url=${URL} --source=${SOURCE} --plugin
112+
tox tests/walkthrough -- --url=${URL} --plugin
113113
RETVALS+=($?)
114114

115115
for i in "${RETVALS[@]}"
@@ -122,7 +122,7 @@ elif [ "${walkthrough}" -eq 1 ]; then
122122
elif [ "${staging}" -eq 1 ]; then
123123
IDENTIFIER="cb_compile_tester_staging"
124124
URL="https://staging.codebender.cc"
125-
tox tests/compile_tester -- --url=${URL} --source=${SOURCE} -F --plugin
125+
tox tests/compile_tester -- --url=${URL} -F --plugin
126126
# No need to send email for tests in staging
127127
exit $?
128128
fi

codebender_testing/config.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ def jsondump(data):
3030
LIVE_SITE_URL = "https://codebender.cc"
3131
STAGING_SITE_URL = "https://staging.codebender.cc"
3232

33-
# Names of sources (i.e. repositories) used to generate the codebender site.
34-
SOURCE_BACHELOR = 'bachelor'
35-
SOURCE_CODEBENDER_CC = 'codebender_cc'
36-
3733
# User whose projects we'd like to compile in our compile_tester
3834
# test case(s).
3935
COMPILE_TESTER_URL = "/user/cb_compile_tester"
@@ -80,12 +76,6 @@ def jsondump(data):
8076
# Directory in which the local compile tester files are stored.
8177
COMPILE_TESTER_DIR = os.path.join(TEST_DATA_DIR, 'cb_compile_tester')
8278

83-
# Credentials to use when logging into the bachelor site.
84-
TEST_CREDENTIALS = {
85-
"username": "tester",
86-
"password": "testerPASS"
87-
}
88-
8979
TEST_PROJECT_NAME = "test_project"
9080

9181
TIMEOUT = {

codebender_testing/utils.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
from codebender_testing.config import BASE_URL
2525
from codebender_testing.config import TIMEOUT
26-
from codebender_testing.config import TEST_CREDENTIALS
2726
from codebender_testing.config import TEST_PROJECT_NAME
2827
from codebender_testing.config import get_path
2928
from codebender_testing.config import jsondump
@@ -312,8 +311,6 @@ def login(self, credentials=None):
312311
unspecified location when calling this function.
313312
`credentials` should be a dict with keys 'username' and 'password',
314313
mapped to the appropriate values."""
315-
if credentials is None:
316-
credentials = TEST_CREDENTIALS
317314
try:
318315
self.open()
319316
login_button = self.driver.find_element_by_id('login_btn')
@@ -495,9 +492,7 @@ def compile_sketch(self, url, boards, iframe=False, project_view=False):
495492
try:
496493
self.execute_script(SELECT_BOARD_SCRIPT(board), '$', 'compilerflasher.pluginHandler.plugin_found')
497494
self.execute_script(_VERIFY_SCRIPT, 'compilerflasher')
498-
# In the BACHELOR site the id is 'operation_output', but in the live
499-
# site the id is 'cb_cf_operation_output'. The [id$=operation_output]
500-
# here selects an id that _ends_ with 'operation_output'.
495+
# The [id$=operation_output] here selects an id that _ends_ with 'operation_output'.
501496
compile_result = WebDriverWait(self.driver, VERIFY_TIMEOUT).until(
502497
any_text_to_be_present_in_element(
503498
(By.CSS_SELECTOR, "[id$=operation_output]"),

tests/common/home/test_home.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def test_navigate_home(self, tester_logout):
1313

1414
def test_login(self, tester_logout):
1515
credentials = {
16-
'username': os.environ.get('CODEBENDER_TEST_USER', config.TEST_CREDENTIALS['username']),
17-
'password': os.environ.get('CODEBENDER_TEST_PASS', config.TEST_CREDENTIALS['password']),
16+
'username': os.environ.get('CODEBENDER_TEST_USER'),
17+
'password': os.environ.get('CODEBENDER_TEST_PASS'),
1818
}
1919
driver = self.driver
2020
self.open("/")

tests/common/user_home/test_user_home.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
from codebender_testing.config import TEST_DATA_INO
55
from codebender_testing.config import TEST_DATA_ZIP
6-
from codebender_testing.config import SOURCE_BACHELOR
7-
from codebender_testing.config import SOURCE_CODEBENDER_CC
86
from codebender_testing.utils import SeleniumTestCase
97

108

@@ -19,45 +17,6 @@ def open_user_home(self, tester_login):
1917
performing any of these tests."""
2018
pass
2119

22-
@pytest.mark.requires_source(SOURCE_BACHELOR)
23-
def test_create_project_blank_name(self):
24-
"""Test that we get an error when creating a project with no name."""
25-
create_button = self.get_element(By.CSS_SELECTOR, '.form-search button')
26-
create_button.click()
27-
error_heading = self.get_element(By.CSS_SELECTOR, '.alert h4')
28-
assert error_heading.text.startswith('Error')
29-
30-
@pytest.mark.requires_source(SOURCE_BACHELOR)
31-
def test_create_project_invalid_name(self):
32-
"""Test that we get an error when creating a project with an
33-
invalid name (e.g., a name containing a backslash).
34-
"""
35-
project_name_input = self.get_element(By.CSS_SELECTOR,
36-
'.form-search input[type=text]')
37-
project_name_input.clear()
38-
project_name_input.send_keys('foo\\bar')
39-
create_button = self.get_element(By.CSS_SELECTOR, '.form-search button')
40-
create_button.click()
41-
42-
error_heading = self.get_element(By.CSS_SELECTOR, '.alert h4')
43-
assert error_heading.text.startswith('Error')
44-
45-
@pytest.mark.requires_source(SOURCE_BACHELOR)
46-
def test_create_project_valid_name(self):
47-
"""Test that we can successfully create a project with a valid name."""
48-
project_name_input = self.get_element(By.CSS_SELECTOR,
49-
'.form-search input[type=text]')
50-
project_name_input.clear()
51-
project_name_input.send_keys(NEW_PROJECT_NAME)
52-
create_button = self.get_element(By.CSS_SELECTOR, '.form-search button')
53-
create_button.click()
54-
55-
project_heading = self.get_element(By.ID, 'editor_heading_project_name')
56-
assert project_heading.text == NEW_PROJECT_NAME
57-
58-
# Cleanup: delete the project we just created.
59-
self.delete_project(NEW_PROJECT_NAME)
60-
6120
def _upload_test(self, dropzone_selector, test_fname, sketch_name=None):
6221
"""Tests that we can successfully upload `test_fname`.
6322
`project_name` is the expected name of the project; by
@@ -72,12 +31,10 @@ def _upload_test(self, dropzone_selector, test_fname, sketch_name=None):
7231
finally:
7332
self.delete_project(upload_name)
7433

75-
@pytest.mark.requires_source(SOURCE_CODEBENDER_CC)
7634
def test_upload_project_ino(self):
7735
"""Tests that we can upload a .ino file."""
7836
self._upload_test('#uploadInoModal form', TEST_DATA_INO)
7937

80-
@pytest.mark.requires_source(SOURCE_CODEBENDER_CC)
8138
def test_upload_project_zip(self):
8239
"""Tests that we can successfully upload a zipped project."""
8340
# TODO: how is the project name inferred from the zip file?

tests/conftest.py

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ def pytest_addoption(parser):
2424
help="Run the complete set of compile tests "
2525
"(a minimal set of tests is run by default).")
2626

27-
parser.addoption("-S", "--source", action="store", default=config.SOURCE_BACHELOR,
28-
help="Indicate the source used to generate the repo. "
29-
"By default, we assume `bachelor`. "
30-
"You can instead use `codebender_cc` for the live site.")
31-
3227
parser.addoption("-C", "--capabilities", action="store",
3328
default=config.DEFAULT_CAPABILITIES_FILE_PATH,
3429
help="Custom path to a YAML file containing a capability list.")
@@ -85,24 +80,14 @@ def testing_url(request):
8580
"""A fixture to get the --url parameter."""
8681
return request.config.getoption("--url")
8782

88-
89-
@pytest.fixture(scope="class")
90-
def source(request):
91-
"""A fixture to specify the source repository from which the site was
92-
derived (e.g. bachelor or codebender_cc)
93-
"""
94-
return request.config.getoption("--source")
95-
96-
9783
@pytest.fixture(scope="class")
9884
def testing_credentials(request):
9985
"""A fixture to get testing credentials specified via the environment
100-
variables CODEBENDER_TEST_USER and CODEBENDER_TEST_PASS. Defaults to the
101-
credentials specified in config.TEST_CREDENTIALS.
86+
variables CODEBENDER_TEST_USER and CODEBENDER_TEST_PASS.
10287
"""
10388
return {
104-
'username': os.environ.get('CODEBENDER_TEST_USER', config.TEST_CREDENTIALS['username']),
105-
'password': os.environ.get('CODEBENDER_TEST_PASS', config.TEST_CREDENTIALS['password']),
89+
'username': os.environ.get('CODEBENDER_TEST_USER'),
90+
'password': os.environ.get('CODEBENDER_TEST_PASS'),
10691
}
10792

10893

@@ -111,26 +96,6 @@ def testing_full(request):
11196
"""A fixture to get the --full parameter."""
11297
return request.config.getoption("--full")
11398

114-
115-
@pytest.fixture(autouse=True)
116-
def requires_source(request, source):
117-
"""Skips tests that require a certain source version (e.g. bachelor or
118-
codebender_cc) in order to run properly.
119-
120-
This functionality should be invoked as a pytest marker, e.g.:
121-
122-
```
123-
@pytest.mark.requires_source("bachelor")
124-
def test_some_feature():
125-
...
126-
```
127-
"""
128-
if request.node.get_marker('requires_source'):
129-
required_source = request.node.get_marker('requires_source').args[0]
130-
if required_source != source:
131-
pytest.skip('skipped test that requires --source=' + source)
132-
133-
13499
@pytest.fixture(autouse=True)
135100
def requires_url(request, testing_url):
136101
"""Skips tests that require a certain site URL in order to run properly.

0 commit comments

Comments
 (0)