Skip to content

Commit a86f0c1

Browse files
committed
MOBILE-3294: Configure travis to run behat tests
1 parent 774b859 commit a86f0c1

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,21 @@ jobs:
105105
- DEBUG=electron-windows-store
106106
- BUILD_PLATFORM='windows'
107107
script: scripts/aot.sh
108+
- stage: test
109+
name: "End to end tests (mod_forum, mod_messages and mod_comments)"
110+
services:
111+
- docker
112+
if: env(TRAVIS_EVENT_TYPE) = cron
113+
script: scripts/test_e2e.sh "@app&&@mod_forum" "@app&&@mod_messages" "@app&&@mod_comments"
114+
- stage: test
115+
name: "End to end tests (mod_data, mod_survey, mod_course, core_course and mod_courses)"
116+
services:
117+
- docker
118+
if: env(TRAVIS_EVENT_TYPE) = cron
119+
script: scripts/test_e2e.sh "@app&&@mod_data" "@app&&@mod_survey" "@app&&@mod_course" "@app&&@core_course" "@app&&@mod_courses"
120+
- stage: test
121+
name: "End to end tests (others)"
122+
services:
123+
- docker
124+
if: env(TRAVIS_EVENT_TYPE) = cron
125+
script: scripts/test_e2e.sh "@app&&~@mod_forum&&~@mod_messages&&~@mod_comments&&~@mod_data&&~@mod_survey&&~@mod_course&&~@core_course&&~@mod_courses"

scripts/test_e2e.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# Prepare variables
4+
basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
5+
dockerscripts="$HOME/moodle-docker/bin/"
6+
dockercompose="$dockerscripts/moodle-docker-compose"
7+
8+
export MOODLE_DOCKER_DB=pgsql
9+
export MOODLE_DOCKER_BROWSER=chrome
10+
export MOODLE_DOCKER_WWWROOT="$HOME/moodle"
11+
export MOODLE_DOCKER_PHP_VERSION=7.3
12+
export MOODLE_DOCKER_APP_PATH=$basedir
13+
14+
# Prepare dependencies
15+
echo "Preparing dependencies"
16+
git clone --branch master --depth 1 git://github.com/moodle/moodle $HOME/moodle
17+
git clone --branch master --depth 1 git://github.com/moodlehq/moodle-local_moodlemobileapp $HOME/moodle/local/moodlemobileapp
18+
# git clone --branch master --depth 1 git://github.com/moodlehq/moodle-docker $HOME/moodle-docker
19+
20+
# TODO replace with commented line above once https://github.com/moodlehq/moodle-docker/pull/126 is merged
21+
mkdir $HOME/moodle-docker
22+
cd $HOME/moodle-docker
23+
git init
24+
git remote add origin git://github.com/moodlehq/moodle-docker
25+
git fetch --depth 1 origin c604d5f9792c72fb9d83f6fec1f4b1defd778e9a
26+
git checkout FETCH_HEAD
27+
cd -
28+
29+
cp $HOME/moodle-docker/config.docker-template.php $HOME/moodle/config.php
30+
31+
# Build app
32+
echo "Building app"
33+
npm install
34+
npm run setup
35+
36+
# Start containers
37+
echo "Starting containers"
38+
$dockercompose pull
39+
$dockercompose up -d
40+
$dockerscripts/moodle-docker-wait-for-db
41+
$dockerscripts/moodle-docker-wait-for-app
42+
$dockercompose exec -T webserver php admin/tool/behat/cli/init.php
43+
44+
# Run tests
45+
for tags in "$@"
46+
do
47+
echo "Running e2e tests ($tags)"
48+
49+
$dockercompose exec -T webserver php admin/tool/behat/cli/run.php --tags="$tags"
50+
done
51+
52+
# Clean up
53+
$dockercompose down

0 commit comments

Comments
 (0)