Skip to content

Commit 61116b8

Browse files
author
Konstantinacc
committed
Merge branch 'tests_improvements' of https://github.com/codebendercc/seleniumTests into tests_improvements
2 parents 15f6fe0 + 6206aee commit 61116b8

File tree

6 files changed

+43
-15
lines changed

6 files changed

+43
-15
lines changed

bin/config.cfg.template

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ SAUCELABS_USER: ~
44
SAUCELABS_KEY: ~
55
SAUCELABS_HUB_URL: http://SAUCELABS_USER:[email protected]:80/wd/hub
66
LOCAL_HUB_URL: http://127.0.0.1:4444/wd/hub
7-
DISQUS_SSO_ID: ~
8-
DISQUS_SSO_USERNAME: ~
9-
DISQUS_SSO_EMAIL: ~
107
CODEBENDER_TEST_USER: ~
118
CODEBENDER_TEST_PASS: ~
129
EMAIL: ~
@@ -17,13 +14,19 @@ DISQUS_ACCESS_TOKEN: ~
1714
DISQUS_API_SECRET: ~
1815
DISQUS_API_PUBLIC: ~
1916
DISQUS_FORUM: ~
17+
DISQUS_SSO_ID: ~
18+
DISQUS_SSO_USERNAME: ~
19+
DISQUS_SSO_EMAIL: ~
2020
AUTHOR_URL: ~
2121

2222
[staging]
2323
DISQUS_ACCESS_TOKEN: ~
2424
DISQUS_API_SECRET: ~
2525
DISQUS_API_PUBLIC: ~
2626
DISQUS_FORUM: ~
27+
DISQUS_SSO_ID: ~
28+
DISQUS_SSO_USERNAME: ~
29+
DISQUS_SSO_EMAIL: ~
2730
AUTHOR_URL: ~
2831

2932
[local]

bin/seleniumbender.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def __init__(self, url, environment):
2121
'.gitignore'
2222
]
2323

24-
def run(self, operation, libraries=None):
24+
def run(self, operation, test=None, libraries=None):
2525
if operation == 'common':
26-
self.common()
26+
self.common(test)
2727
elif operation == 'libraries':
2828
self.libraries()
2929
elif operation == 'examples':
@@ -38,6 +38,8 @@ def run(self, operation, libraries=None):
3838
self.walkthrough()
3939
elif operation == 'staging':
4040
self.staging()
41+
elif operation == 'delete':
42+
self.delete()
4143

4244
def run_command(self, command):
4345
command = ' '.join(command)
@@ -79,8 +81,11 @@ def send_mail_with_logs(self, identifier):
7981
def create_command(self, test_directory, *extra_arguments):
8082
return ['tox', 'tests/' + test_directory, '--', '--url={}'.format(TARGETS[self.url])] + list(extra_arguments)
8183

82-
def common(self, identifier='common'):
83-
command = self.create_command('common', '--plugin')
84+
def common(self, test, identifier='common'):
85+
test_directory = 'common'
86+
if test:
87+
test_directory = os.path.join(test_directory, test)
88+
command = self.create_command(test_directory, '--plugin')
8489
retval = self.run_command(command)
8590
if retval != 0:
8691
self.send_mail_no_logs(identifier)
@@ -128,6 +133,10 @@ def staging(self):
128133
command = self.create_command('compile_tester', '-F', '--plugin')
129134
self.run_command(command)
130135

136+
def delete(self):
137+
command = self.create_command('delete_sketches')
138+
self.run_command(command)
139+
131140
OPERATIONS = {
132141
'common':'\tTest site common functionality',
133142
'libraries': 'Visit all libraries and their examples',
@@ -136,7 +145,8 @@ def staging(self):
136145
'compile': '\tCompile specific examples',
137146
'noplugin': 'Run tests without app/plugin installed',
138147
'walkthrough': 'Run tests for walkthrough',
139-
'staging': '\tRun tests for staging only'
148+
'staging': '\tRun tests for staging only',
149+
'delete': '\tDelete all sketches from test user'
140150
}
141151

142152
TARGETS = {
@@ -189,9 +199,12 @@ def main():
189199
parser.add_argument('--config',
190200
default='config.cfg',
191201
help='Configuration file to load (default: config.cfg).')
202+
parser.add_argument('--test',
203+
default=None,
204+
help='Common test to run when using operation: common (default: all)')
192205
parser.add_argument('--libraries',
193206
default=None,
194-
help='Libraries to test (comma separated machine names) when using option: target')
207+
help='Libraries to test (comma separated machine names) when using operation: target')
195208
parser.add_argument('--saucelabs',
196209
action='store_true',
197210
default=False,
@@ -214,6 +227,8 @@ def main():
214227
parser.print_help()
215228
sys.exit()
216229

230+
test = args.test
231+
217232
libraries = args.libraries
218233
if operation == 'target' and not libraries:
219234
print('No target libraries specified!\n')
@@ -258,7 +273,7 @@ def main():
258273

259274
# Run tests
260275
tests = Tests(target, config)
261-
tests.run(operation, libraries=libraries)
276+
tests.run(operation, test=test, libraries=libraries)
262277

263278
if __name__ == '__main__':
264279
main()

codebender_testing/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ def jsondump(data):
8181

8282
TIMEOUT = {
8383
'LOCATE_ELEMENT': 30,
84-
'FLASH_FAIL': 30
84+
'FLASH_FAIL': 30,
85+
'VERIFY': 30,
86+
'FLASH': 30,
8587
}
8688

8789
DEFAULT_USER_AGENT_FIREFOX = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0 codebender-selenium'

extensions/codebender.xpi

37 KB
Binary file not shown.

tests/common/home/test_home.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class TestHome(SeleniumTestCase):
88

99
def test_navigate_home(self, tester_logout):
10-
""" opens browser to codebender bachelor """
10+
""" opens browser to codebender """
1111
self.open("/")
1212
assert "codebender" in self.driver.title
1313

tests/common/sketch/test_sketch.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
from selenium.webdriver.support.ui import WebDriverWait
55
import pytest
66

7-
from codebender_testing.config import TEST_PROJECT_NAME
7+
from codebender_testing.config import TEST_PROJECT_NAME, TIMEOUT
88
from codebender_testing.utils import SeleniumTestCase
99
from codebender_testing.utils import SELECT_BOARD_SCRIPT
1010
from codebender_testing.utils import throttle_compile
1111

1212

1313
# How long to wait before we give up on trying to assess the result of commands
14-
VERIFY_TIMEOUT = 30
15-
FLASH_TIMEOUT = 30
14+
VERIFY_TIMEOUT = TIMEOUT['VERIFY']
15+
FLASH_TIMEOUT = TIMEOUT['FLASH']
1616

1717
# Board to test for the dropdown selector.
1818
TEST_BOARD = "Arduino Fio"
@@ -87,6 +87,14 @@ def test_serial_monitor_disables_fields(self):
8787
)
8888
)
8989

90+
def test_close_serial_monitor(self):
91+
self.get_element(By.ID, 'serial_monitor_toggle').click()
92+
WebDriverWait(self.driver, VERIFY_TIMEOUT).until(
93+
expected_conditions.invisibility_of_element_located(
94+
(By.ID, 'serial_monitor')
95+
)
96+
)
97+
9098
def test_clone_project(self):
9199
"""Tests that clicking the 'Clone Project' link brings us to a new
92100
sketch with the title 'test_project clone'."""

0 commit comments

Comments
 (0)