forked from openedx-unsupported/edx-app-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrigger_aws.yml
92 lines (85 loc) · 5.71 KB
/
trigger_aws.yml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
version: 0.1
# Phases are collection of commands that get executed on Device Farm.
phases:
# The install phase includes commands that install dependencies that your tests use.
# Default dependencies for testing frameworks supported on Device Farm are already installed.
install:
commands:
# Device Farm support two major versions of Python, each with one minor version: 2 (minor version 2.7), and 3 (minor version 3.7.4).
# The default Python version is 2, but you can switch to 3 by setting the following variable to 3:
- export PYTHON_VERSION=3
# Move into the project directory
- cd $DEVICEFARM_TEST_PACKAGE_PATH
# Activate the virtual environment
- . bin/activate
# Install dependencies (required to execute the tests and supported by automation codebase) that
# specified in requirements.txt file, as Device Farm is preconfigured that are not supported by
# automation codebase.
- pip install -r requirements.txt
# This test execution environment uses Appium version 1.9.1 by default, however we enable you to change it using the Appium version manager (avm). An
# example "avm" command below changes the version to 1.14.2.
# For your convenience, we have preinstalled the following versions: 1.9.1, 1.10.1, 1.11.1, 1.12.1, 1.13.0, 1.14.1, 1.14.2, 1.15.1 or 1.16.0.
# To use one of these Appium versions, change the version number in the "avm" command below to your desired version:
- export APPIUM_VERSION=1.18.0
- avm $APPIUM_VERSION
- ln -s /usr/local/avm/versions/$APPIUM_VERSION/node_modules/.bin/appium /usr/local/avm/versions/$APPIUM_VERSION/node_modules/appium/bin/appium.js
# The pre-test phase includes commands that setup your test environment.
pre_test:
commands:
# We recommend starting appium server process in the background using the command below.
# Appium server log will go to $DEVICEFARM_LOG_DIR directory.
# The environment variables below will be auto-populated during run time.
- echo "Start appium server"
# appium --log-timestamp --device-name $DEVICEFARM_DEVICE_NAME
# --platform-name $DEVICEFARM_DEVICE_PLATFORM_NAME --app $DEVICEFARM_APP_PATH
# --udid $DEVICEFARM_DEVICE_UDID --chromedriver-executable $DEVICEFARM_CHROMEDRIVER_EXECUTABLE >> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &
# - killall -KILL node
- appium --log-timestamp --device-name $DEVICEFARM_DEVICE_NAME --platform-name $DEVICEFARM_DEVICE_PLATFORM_NAME --app $DEVICEFARM_APP_PATH
--app-pkg org.edx.mobile --app-activity .view.SplashActivity
--app-wait-activity .view.DiscoveryLaunchActivity >> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 &
- start_appium_timeout=0;
- while [ true ];
do
if [ $start_appium_timeout -gt 60 ];
then
echo "appium server never started in 60 seconds. Exiting";
exit 1;
fi;
grep -i "Appium REST http interface listener started on 0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1;
if [ $? -eq 0 ];
then
echo "Appium REST http interface listener started on 0.0.0.0:4723 - good";
break;
else
echo "Waiting for appium server to start. Sleeping for 1 second";
sleep 1;
start_appium_timeout=$((start_appium_timeout+1));
fi;
done;
# The test phase includes commands that run your test suite execution.
test:
commands:
# Your test package is downloaded in $DEVICEFARM_TEST_PACKAGE_PATH so we first change directory to that path.
# We already setup python virtual environment on $DEVICEFARM_TEST_PACKAGE_PATH
# and installed required libraries. You can run your test under $DEVICEFARM_TEST_PACKAGE_PATH
- echo "Navigate to test package directory"
- cd $DEVICEFARM_TEST_PACKAGE_PATH
- echo "Start Appium Python test"
# These commands will collect those android test files which are given in the command.
- bin/py.test --collect-only tests/android/tests/test_android_new_landing.py tests/android/tests/test_android_login.py tests/android/tests/test_android_main_dashboard.py tests/android/tests/test_android_my_courses_list.py tests/android/tests/test_android_course_discovery.py tests/android/tests/test_android_register.py
# By default, the following command is used by Device Farm to run your Appium Python test.
# The goal is to run all your tests files in the test package.
# Alternatively, You may specify your customized command.
# Note: For most use cases, the default command works fine.
# Please refer "https://docs.pytest.org/en/latest/usage.html" for more options on running pytests from command line.
# It will run these test cases and create html report in $DEVICEFARM_LOG_DIR
- bin/py.test -v tests/android/tests/test_android_new_landing.py tests/android/tests/test_android_login.py tests/android/tests/test_android_main_dashboard.py tests/android/tests/test_android_my_courses_list.py tests/android/tests/test_android_course_discovery.py tests/android/tests/test_android_register.py --html=$DEVICEFARM_LOG_DIR/report.html
# The post test phase includes are commands that are run after your tests are executed.
post_test:
commands:
# The artifacts phase lets you specify the location where your tests logs, device logs will be stored.
# And also let you specify the location of your test logs and artifacts which you want to be collected by Device Farm.
# These logs and artifacts will be available through ListArtifacts API in Device Farm.
artifacts:
# By default, Device Farm will collect your artifacts from following directories
- $DEVICEFARM_LOG_DIR