Skip to content

Commit 4666e88

Browse files
committed
Merge pull request #31 from codebendercc/capabilities-update
Capabilities update
2 parents 279ced9 + de236bb commit 4666e88

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

bin/seleniumbender.py

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
class Tests:
1616
def __init__(self, url, environment):
17+
self.retval = 0
1718
self.url = url
1819
self.environment = os.path.abspath(environment)
1920
self.email = os.getenv('EMAIL', '[email protected]')
@@ -47,10 +48,16 @@ def run_command(self, command):
4748
return subprocess.call(command, shell=True, executable=SHELL)
4849

4950
def send_mail_no_logs(self, identifier):
51+
if self.url == 'local':
52+
return
53+
5054
command = ['mail', '-s', '"Selenium Tests: {identifier} Failed To Run" {email} <<< "Something went wrong with {identifier} tests. Please check the logs."'.format(identifier=identifier, email=self.email)]
5155
self.run_command(command)
5256

5357
def send_mail_with_logs(self, identifier):
58+
if self.url == 'local':
59+
return
60+
5461
default_tests_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
5562
root_dir = os.getenv('ROOTDIR', default_tests_dir)
5663

@@ -88,31 +95,41 @@ def common(self, test, identifier='common'):
8895
command = self.create_command(test_directory, '--plugin')
8996
retval = self.run_command(command)
9097
if retval != 0:
98+
self.retval = retval
9199
self.send_mail_no_logs(identifier)
92100

93101
def libraries(self, identifier='libraries_fetch'):
94102
command = self.create_command('libraries_fetch', '-F', '--plugin')
95-
self.run_command(command)
103+
retval = self.run_command(command)
104+
if retval != 0:
105+
self.retval = retval
96106
self.send_mail_with_logs(identifier)
97107

98108
def examples(self, identifier='libraries_test'):
99109
command = self.create_command('libraries', '-F', '--plugin')
100-
self.run_command(command)
110+
retval = self.run_command(command)
111+
if retval != 0:
112+
self.retval = retval
101113
self.send_mail_with_logs(identifier)
102114

103115
def sketches(self, identifier='cb_compile_tester'):
104116
command = self.create_command('compile_tester', '-F', '--plugin')
105-
self.run_command(command)
117+
retval = self.run_command(command)
118+
if retval != 0:
119+
self.retval = retval
106120
self.send_mail_with_logs(identifier)
107121

108122
def compile(self, libraries):
109123
command = self.create_command('target_libraries', '-F', '--plugin', '--libraries={}'.format(libraries))
110-
self.run_command(command)
124+
retval = self.run_command(command)
125+
if retval != 0:
126+
self.retval = retval
111127

112128
def noplugin(self, identifier = 'noplugin'):
113129
command = self.create_command('noplugin')
114130
retval = self.run_command(command)
115131
if retval != 0:
132+
self.retval = retval
116133
self.send_mail_no_logs(identifier)
117134

118135
def walkthrough(self, identifier='walkthrough'):
@@ -127,15 +144,20 @@ def walkthrough(self, identifier='walkthrough'):
127144

128145
retval = max(retvals)
129146
if retval != 0:
147+
self.retval = retval
130148
self.send_mail_no_logs(identifier)
131149

132150
def staging(self):
133151
command = self.create_command('compile_tester', '-F', '--plugin')
134-
self.run_command(command)
152+
retval = self.run_command(command)
153+
if retval != 0:
154+
self.retval = retval
135155

136156
def delete(self):
137157
command = self.create_command('delete_sketches')
138-
self.run_command(command)
158+
retval = self.run_command(command)
159+
if retval != 0:
160+
self.retval = retval
139161

140162
OPERATIONS = {
141163
'common':'\tTest site common functionality',
@@ -275,5 +297,8 @@ def main():
275297
tests = Tests(target, config)
276298
tests.run(operation, test=test, libraries=libraries)
277299

300+
print('Tests exit code:', tests.retval)
301+
sys.exit(tests.retval)
302+
278303
if __name__ == '__main__':
279304
main()

codebender_testing/capabilities.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# https://docs.saucelabs.com/reference/test-configuration
88

99
- browserName: "firefox"
10-
version: 43
10+
version: 45
1111
public: "public restricted"
1212
maxDuration: 10800
1313
- browserName: "chrome"

codebender_testing/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def jsondump(data):
7777
# Directory in which the local compile tester files are stored.
7878
COMPILE_TESTER_DIR = os.path.join(TEST_DATA_DIR, 'cb_compile_tester')
7979

80-
TEST_PROJECT_NAME = "test_project"
80+
TEST_PROJECT_NAME = "test_sketch"
8181

8282
TIMEOUT = {
8383
'LOCATE_ELEMENT': 30,

tests/common/sketch/test_sketch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class TestSketch(SeleniumTestCase):
2626
def create_test_project(self, tester_login):
2727
"""Makes sure we are logged in and have a project open before
2828
performing any of these tests."""
29-
self.create_sketch('private' , 'project', 'short description')
29+
self.create_sketch('private' , TEST_PROJECT_NAME + '_initial', 'short description')
3030

3131
def test_rename_project(self):
3232
self.change_name_editor(TEST_PROJECT_NAME)

0 commit comments

Comments
 (0)