You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+46-1Lines changed: 46 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -99,6 +99,50 @@ Notes:
99
99
* Mailhog is listening on `http://localhost:8000/_/mail` to view emails which Moodle has sent out.
100
100
* The admin `username` you need to use for logging in is `admin` by default. You can customize it by passing `--adminuser='myusername'`
101
101
102
+
## Use containers for running behat tests for the mobile app
103
+
104
+
In order to run Behat tests for the mobile app, you need to install the [local_moodlemobileapp](https://github.com/moodlehq/moodle-local_moodlemobileapp) plugin in your Moodle site. Everything else should be the same as running standard Behat tests for Moodle. Make sure to filter tests using the `@app` tag.
105
+
106
+
The Behat tests will be run against a container serving the mobile application, you have two options here:
107
+
108
+
1. Use a docker image that includes the application code. You need to specify the `MOODLE_APP_VERSION` env variable and the [moodlehq/moodleapp](https://hub.docker.com/r/moodlehq/moodleapp) image will be downloaded from docker hub.
109
+
110
+
2. Use a local copy of the application code and serve it through docker, similar to how the Moodle site is being served. Set the `MOODLE_DOCKER_APP_PATH` env variable to the codebase in you file system. This will assume that you've already initialized the app calling `npm install` and `npm run setup` locally.
111
+
112
+
For both options, you also need to set `MOODLE_DOCKER_BROWSER` to "chrome".
If you are going with the second option, this *can* be used for local development of the mobile app, given that the `moodleapp` container serves the app on the local 8100 port. However, this is intended to run Behat tests that require interacting with a local Moodle environment. Normal development should be easier calling `npm start` in the host system.
138
+
139
+
By all means, if you don't want to have npm installed locally you can go full docker executing the following commands before starting the containers:
140
+
141
+
```
142
+
docker run --volume $MOODLE_DOCKER_APP_PATH:/app --workdir /app node:11 npm install
143
+
docker run --volume $MOODLE_DOCKER_APP_PATH:/app --workdir /app node:11 npm run setup
144
+
```
145
+
102
146
## Using VNC to view behat tests
103
147
104
148
If `MOODLE_DOCKER_SELENIUM_VNC_PORT` is defined, selenium will expose a VNC session on the port specified so behat tests can be viewed in progress.
@@ -134,7 +178,8 @@ You can change the configuration of the docker images by setting various environ
134
178
|`MOODLE_DOCKER_WEB_HOST`| no | any valid hostname | localhost | The hostname for web |
135
179
|`MOODLE_DOCKER_WEB_PORT`| no | any integer value (or bind_ip:integer)| 127.0.0.1:8000| The port number for web. If set to 0, no port is used.<br/>If you want to bind to any host IP different from the default 127.0.0.1, you can specify it with the bind_ip:port format (0.0.0.0 means bind to all) |
136
180
|`MOODLE_DOCKER_SELENIUM_VNC_PORT`| no | any integer value (or bind_ip:integer)| not set | If set, the selenium node will expose a vnc session on the port specified. Similar to MOODLE_DOCKER_WEB_PORT, you can optionally define the host IP to bind to. If you just set the port, VNC binds to 127.0.0.1 |
137
-
|`MOODLE_APP_VERSION`| no | next, latest, or an app version number| not set | If set will start an instance of the Mmodle app if the chrome browser is selected |
181
+
|`MOODLE_DOCKER_APP_PATH`| no | path on your file system | not set | If set and the chrome browser is selected, it will start an instance of the Moodle app from your local codebase |
182
+
|`MOODLE_APP_VERSION`| no | next, latest, or an app version number| not set | If set will start an instance of the Moodle app if the chrome browser is selected |
0 commit comments