Skip to content

Commit 6bf32bc

Browse files
authored
Merge pull request moodlehq#274 from NoelDeMartin/app-ionic7
Update App config defaults
2 parents 30f6347 + 0f5aebe commit 6bf32bc

File tree

6 files changed

+31
-10
lines changed

6 files changed

+31
-10
lines changed

.github/workflows/test.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,19 @@ jobs:
7777
include:
7878
- php: '8.3'
7979
moodle-branch: 'main'
80+
moodle-app: 'true'
8081
- php: '8.3'
8182
moodle-branch: 'MOODLE_404_STABLE'
83+
moodle-app: 'true'
8284
- php: '8.2'
8385
moodle-branch: 'MOODLE_403_STABLE'
86+
moodle-app: 'true'
8487
- php: '8.2'
8588
moodle-branch: 'MOODLE_402_STABLE'
89+
moodle-app: 'true'
8690
- php: '8.1'
8791
moodle-branch: 'MOODLE_401_STABLE'
92+
moodle-app: 'true'
8893
- php: '8.0'
8994
moodle-branch: 'MOODLE_400_STABLE'
9095
- php: '8.0'
@@ -126,7 +131,7 @@ jobs:
126131
IGNORE_PATHS: 'ignore'
127132
IGNORE_NAMES: 'ignore_name.php'
128133
MUSTACHE_IGNORE_NAMES: 'broken.mustache'
129-
MOODLE_APP: 'true'
134+
MOODLE_APP: ${{ matrix.moodle-app }}
130135

131136
- name: Run Integration tests
132137
env:
@@ -196,14 +201,19 @@ jobs:
196201
# Each supported PHP version once. That's enough.
197202
- php: '8.3'
198203
moodle-branch: 'main'
204+
moodle-app: 'true'
199205
- php: '8.3'
200206
moodle-branch: 'MOODLE_404_STABLE'
207+
moodle-app: 'true'
201208
- php: '8.2'
202209
moodle-branch: 'MOODLE_403_STABLE'
210+
moodle-app: 'true'
203211
- php: '8.1'
204212
moodle-branch: 'MOODLE_402_STABLE'
213+
moodle-app: 'true'
205214
- php: '8.0'
206215
moodle-branch: 'MOODLE_401_STABLE'
216+
moodle-app: 'true'
207217
- php: '7.4'
208218
moodle-branch: 'MOODLE_400_STABLE'
209219

@@ -245,7 +255,7 @@ jobs:
245255
IGNORE_PATHS: 'ignore'
246256
IGNORE_NAMES: 'ignore_name.php'
247257
MUSTACHE_IGNORE_NAMES: 'broken.mustache'
248-
MOODLE_APP: 'true'
258+
MOODLE_APP: ${{ matrix.moodle-app }}
249259

250260
- name: Run Integration tests (PHAR)
251261
env:

.travis.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ before_install:
4646
fi
4747
4848
install:
49-
- MOODLE_APP=true moodle-plugin-ci install -vvv
49+
- moodle-plugin-ci install -vvv
5050

5151
script:
5252
# This is basically "integration" testing.
@@ -91,10 +91,14 @@ jobs:
9191
if: env(MOODLE_BRANCH) IS present
9292
# Only main with highest supported PHP version.
9393
- php: 8.3
94-
env: MOODLE_BRANCH=main
94+
env:
95+
- MOODLE_BRANCH=main
96+
- MOODLE_APP=true
9597
# Last stable with highest supported PHP version.
9698
- php: 8.3
97-
env: MOODLE_BRANCH=MOODLE_404_STABLE
99+
env:
100+
- MOODLE_BRANCH=MOODLE_404_STABLE
101+
- MOODLE_APP=true
98102
# And older stable supported (with lowest supported PHP version).
99103
- php: 7.4
100104
env: MOODLE_BRANCH=MOODLE_39_STABLE

docs/MoodleApp.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ In practice, you only need to set the `MOODLE_APP` env variable to `true`, and a
1111
- `MOODLE_APP_BEHAT_PLUGIN_PROJECT`: Project in github to use for installing the plugin with Behat steps specific to the Moodle App. The default value is `moodlehq/moodle-local_moodleappbehat`. This variable will be ignored if `MOODLE_APP_BEHAT_PLUGIN_REPOSITORY` is set.
1212
- `MOODLE_APP_BEHAT_PLUGIN_REPOSITORY`: Repository url to use for installing the plugin with Behat steps specific to the Moodle App. By default, the github repository defined in `MOODLE_APP_BEHAT_PLUGIN_PROJECT` will be used.
1313
- `MOODLE_APP_BEHAT_PLUGIN_BRANCH`: Branch of the repository to use for installing the plugin with Behat steps specific to the Moodle App. The default value is `latest`.
14-
- `MOODLE_BEHAT_IONIC_WWWROOT`: Value to use in `$CFG->behat_ionic_wwwroot`. The default value is `http://localhost:8100`. This value should only be used if `MOODLE_APP` is not set, and the Moodle App dependencies are configured manually.
14+
- `MOODLE_APP_PORT`: Port to listen in the Docker image. The default value is `443`, but you may need to set it to `80` for older versions of the app.
15+
- `MOODLE_APP_PROTOCOL`: Protocol to use when interaction with the app. The default value is `https`, but you may need to set it to `http` for older versions of the app.
16+
- `MOODLE_BEHAT_IONIC_WWWROOT`: Value to use in `$CFG->behat_ionic_wwwroot`. The default value is `https://localhost:8100` (or `http://localhost:8100` if `MOODLE_APP_PROTOCOL` is set to `http`). This value should only be used if `MOODLE_APP` is not set, and the Moodle App dependencies are configured manually.
1517

1618
Finally, keep in mind that mobile tests only run on Chrome, so make sure that you're using the correct browser. If you're setting the `MOODLE_APP` variable, the default browser should already be Chrome; but you can set it explicitly using the `--profile` flag otherwise.
1719

src/Bridge/MoodleConfig.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ class MoodleConfig
3232
*/
3333
public function createContents(AbstractDatabase $database, string $dataDir): string
3434
{
35+
$chromeinsecureargs = "['--ignore-certificate-errors', '--allow-running-insecure-content']";
36+
$chromeinsecurecapabilities = "['extra_capabilities' => ['chromeOptions' => ['args' => $chromeinsecureargs]]]";
37+
3538
$template = file_get_contents(__DIR__ . '/../../res/template/config.php.txt');
3639
$behatdefaultbrowser = getenv('MOODLE_BEHAT_DEFAULT_BROWSER') ?: (getenv('MOODLE_APP') ? 'chrome' : 'firefox');
37-
$behatchromecapabilities = getenv('MOODLE_BEHAT_CHROME_CAPABILITIES') ?: '[]';
40+
$behatchromecapabilities = getenv('MOODLE_BEHAT_CHROME_CAPABILITIES') ?: (getenv('MOODLE_APP') ? $chromeinsecurecapabilities : '[]');
3841
$behatfirefoxcapabilities = getenv('MOODLE_BEHAT_FIREFOX_CAPABILITIES') ?: '[]';
42+
$appprotocol = getenv('MOODLE_APP_PROTOCOL') ?: 'https';
3943
$variables = [
4044
'{{DBTYPE}}' => $database->type,
4145
'{{DBLIBRARY}}' => $database->library,
@@ -52,7 +56,7 @@ public function createContents(AbstractDatabase $database, string $dataDir): str
5256
'{{BEHATWWWROOT}}' => getenv('MOODLE_BEHAT_WWWROOT') ?: 'http://localhost:8000',
5357
'{{BEHATWDHOST}}' => getenv('MOODLE_BEHAT_WDHOST') ?: 'http://localhost:4444/wd/hub',
5458
'{{BEHATDEFAULTBROWSER}}' => $behatdefaultbrowser,
55-
'{{BEHATIONICWWWROOT}}' => getenv('MOODLE_APP') ? 'http://localhost:8100' : (getenv('MOODLE_BEHAT_IONIC_WWWROOT') ?: ''),
59+
'{{BEHATIONICWWWROOT}}' => getenv('MOODLE_APP') ? "$appprotocol://localhost:8100" : (getenv('MOODLE_BEHAT_IONIC_WWWROOT') ?: ''),
5660
'{{BEHATDEFAULTCAPABILITIES}}' => $behatdefaultbrowser === 'chrome' ? $behatchromecapabilities : $behatfirefoxcapabilities,
5761
'{{BEHATCHROMECAPABILITIES}}' => $behatchromecapabilities,
5862
'{{BEHATFIREFOXCAPABILITIES}}' => $behatfirefoxcapabilities,

src/Command/BehatCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ private function getSeleniumImage(InputInterface $input, string $profile): strin
212212
}
213213

214214
if ($profile === 'chrome') {
215-
return 'selenium/standalone-chrome:3';
215+
return getenv('MOODLE_APP') ? 'selenium/standalone-chrome:120.0' : 'selenium/standalone-chrome:3';
216216
}
217217

218218
if ($this->usesLegacyPhpWebdriver()) {

src/Installer/MoodleAppInstaller.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function install(): void
3939
$this->getOutput()->step('Launch Moodle App docker image');
4040

4141
$image = getenv('MOODLE_APP_DOCKER_IMAGE') ?: 'moodlehq/moodleapp:latest-test';
42+
$port = getenv('MOODLE_APP_PORT') ?: '443';
4243

4344
$this->execute->mustRun([
4445
'docker',
@@ -47,7 +48,7 @@ public function install(): void
4748
'--rm',
4849
'--name=moodleapp',
4950
'-p',
50-
'8100:80',
51+
"8100:$port",
5152
$image,
5253
]);
5354

0 commit comments

Comments
 (0)