|
4 | 4 | from selenium.webdriver import chrome
|
5 | 5 | from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
6 | 6 | import yaml
|
| 7 | +import simplejson |
7 | 8 |
|
8 | 9 |
|
9 | 10 | def _rel_path(*args):
|
10 | 11 | """Forms a path relative to this file's directory."""
|
11 | 12 | return os.path.join(os.path.dirname(__file__), *args)
|
12 | 13 |
|
| 14 | +def get_path(directory, filename=None): |
| 15 | + path = os.path.join(os.path.dirname( __file__ ), '..', directory) |
| 16 | + if filename: |
| 17 | + path = os.path.join(os.path.dirname( __file__ ), '..', directory, filename) |
| 18 | + return os.path.abspath(path) |
| 19 | + |
| 20 | +def jsondump(data): |
| 21 | + return simplejson.dumps(data, sort_keys=True, indent=4 * ' ') |
| 22 | + |
13 | 23 | # URL of the default site to be used for testing
|
14 | 24 | BASE_URL = "http://localhost"
|
15 | 25 | # URL of the actual Codebender website
|
16 |
| -LIVE_SITE_URL = "http://codebender.cc" |
| 26 | +LIVE_SITE_URL = "https://codebender.cc" |
17 | 27 |
|
18 | 28 | # Names of sources (i.e. repositories) used to generate the codebender site.
|
19 | 29 | SOURCE_BACHELOR = 'bachelor'
|
@@ -47,12 +57,23 @@ def _rel_path(*args):
|
47 | 57 |
|
48 | 58 | # Files used for testing
|
49 | 59 | TEST_DATA_DIR = _rel_path('..', 'test_data')
|
50 |
| -TEST_DATA_BLANK_PROJECT = os.path.join(TEST_DATA_DIR, 'blank_project.ino') |
51 |
| -TEST_DATA_BLANK_PROJECT_ZIP = os.path.join(TEST_DATA_DIR, 'blank_project.zip') |
| 60 | +TEST_DATA_INO = os.path.join(TEST_DATA_DIR, 'upload_ino.ino') |
| 61 | +TEST_DATA_ZIP = os.path.join(TEST_DATA_DIR, 'upload_zip.zip') |
52 | 62 |
|
53 | 63 | # Directory in which the local compile tester files are stored.
|
54 | 64 | COMPILE_TESTER_DIR = os.path.join(TEST_DATA_DIR, 'cb_compile_tester')
|
55 | 65 |
|
| 66 | +# Credentials to use when logging into the bachelor site |
| 67 | +TEST_CREDENTIALS = { |
| 68 | + "username": "tester", |
| 69 | + "password": "testerPASS" |
| 70 | +} |
| 71 | + |
| 72 | +TEST_PROJECT_NAME = "test_project" |
| 73 | + |
| 74 | +TIMEOUT = { |
| 75 | + 'LOCATE_ELEMENT': 30 |
| 76 | +} |
56 | 77 |
|
57 | 78 | # Set up Selenium Webdrivers to be used for selenium tests
|
58 | 79 | def _get_firefox_profile():
|
@@ -129,15 +150,3 @@ def create_webdriver(command_executor, desired_capabilities):
|
129 | 150 | desired_capabilities=desired_capabilities,
|
130 | 151 | browser_profile=browser_profile,
|
131 | 152 | )
|
132 |
| - |
133 |
| - |
134 |
| -# Credentials to use when logging into the bachelor site |
135 |
| -TEST_CREDENTIALS = { |
136 |
| - "username": "tester", |
137 |
| - "password": "testerPASS" |
138 |
| -} |
139 |
| - |
140 |
| -TEST_PROJECT_NAME = "test_project" |
141 |
| - |
142 |
| -# How long we wait until giving up on trying to locate an element |
143 |
| -ELEMENT_FIND_TIMEOUT = 10 |
|
0 commit comments