-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_browserstack.robot
More file actions
42 lines (34 loc) · 2.72 KB
/
run_browserstack.robot
File metadata and controls
42 lines (34 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
*** Settings ***
Library Process
*** Variables ***
${PYTHON_CMD} %{PYTHON_CMD=python}
${TARGET_SUITE_REL} tests${/}browserstack_open_url.robot
${BROWSERSTACK_USERNAME} %{BROWSERSTACK_USERNAME=}
${BROWSERSTACK_ACCESS_KEY} %{BROWSERSTACK_ACCESS_KEY=}
*** Test Cases ***
Run BrowserStack SDK Suite
Should Not Be Empty ${BROWSERSTACK_USERNAME} msg=BROWSERSTACK_USERNAME is empty in runtime environment.
Should Not Be Empty ${BROWSERSTACK_ACCESS_KEY} msg=BROWSERSTACK_ACCESS_KEY is empty in runtime environment.
${project_root}= Resolve Project Root
${requirements_file}= Resolve Requirements File
${target_suite}= Resolve Target Suite
${target_suite_rel}= Evaluate os.path.relpath(r'''${target_suite}''', r'''${project_root}''') os
${install}= Run Process ${PYTHON_CMD} -m pip install -r ${requirements_file} cwd=${project_root}
Should Be Equal As Integers ${install.rc} 0 msg=Dependency install failed. STDOUT: ${install.stdout} STDERR: ${install.stderr}
${result}= Run Process browserstack-sdk robot ${target_suite_rel} cwd=${project_root} env:BROWSERSTACK_USERNAME=${BROWSERSTACK_USERNAME} env:BROWSERSTACK_ACCESS_KEY=${BROWSERSTACK_ACCESS_KEY}
Should Be Equal As Integers ${result.rc} 0 msg=BrowserStack SDK run failed. STDOUT: ${result.stdout} STDERR: ${result.stderr}
Log ${result.stdout}
*** Keywords ***
Resolve Project Root
${config_path}= Evaluate next((p for p in [r'''${CURDIR}${/}browserstack.yml''', r'''${CURDIR}${/}..${/}browserstack.yml''', r'''${EXECDIR}${/}browserstack.yml''', r'''${EXECDIR}${/}..${/}browserstack.yml'''] if os.path.isfile(p)), None) os
Should Not Be Equal ${config_path} ${None} msg=browserstack.yml not found in expected locations from CURDIR/EXECDIR.
${root}= Evaluate os.path.dirname(r'''${config_path}''') os
RETURN ${root}
Resolve Requirements File
${path}= Evaluate next((p for p in [r'''${CURDIR}${/}requirements.txt''', r'''${CURDIR}${/}..${/}requirements.txt''', r'''${EXECDIR}${/}requirements.txt''', r'''${EXECDIR}${/}..${/}requirements.txt'''] if os.path.isfile(p)), None) os
Should Not Be Equal ${path} ${None} msg=requirements.txt not found in expected locations from CURDIR/EXECDIR.
RETURN ${path}
Resolve Target Suite
${path}= Evaluate next((p for p in [r'''${CURDIR}${/}${TARGET_SUITE_REL}''', r'''${CURDIR}${/}..${/}${TARGET_SUITE_REL}''', r'''${EXECDIR}${/}${TARGET_SUITE_REL}''', r'''${EXECDIR}${/}..${/}${TARGET_SUITE_REL}'''] if os.path.isfile(p)), None) os
Should Not Be Equal ${path} ${None} msg=Target suite not found: ${TARGET_SUITE_REL}
RETURN ${path}