Merge pull request #3340 from NoelDeMartin/MOBILE-4110
MOBILE-4110: Fix update behat plugin workflowmain
commit
2bbeb60c22
|
@ -32,11 +32,9 @@ jobs:
|
||||||
BEHAT_TAGS: ${{ github.event.inputs.behat_tags || '~@performance' }}
|
BEHAT_TAGS: ${{ github.event.inputs.behat_tags || '~@performance' }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- id: nvmrc
|
- uses: actions/setup-node@v3
|
||||||
uses: browniebroke/read-nvmrc-action@v1
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
with:
|
||||||
node-version: '${{ steps.nvmrc.outputs.node_version }}'
|
node-version-file: '.nvmrc'
|
||||||
- name: Additional checkouts
|
- name: Additional checkouts
|
||||||
run: |
|
run: |
|
||||||
git clone --branch $MOODLE_BRANCH --depth 1 $MOODLE_REPOSITORY $GITHUB_WORKSPACE/moodle
|
git clone --branch $MOODLE_BRANCH --depth 1 $MOODLE_REPOSITORY $GITHUB_WORKSPACE/moodle
|
||||||
|
|
|
@ -9,11 +9,10 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js
|
- uses: actions/setup-node@v3
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
with:
|
||||||
node-version: '14.x'
|
node-version-file: '.nvmrc'
|
||||||
- run: npm ci
|
- run: npm ci --no-audit
|
||||||
- run: result=$(find src -type f -iname '*.html' -exec sh -c 'cat {} | tr "\n" " " | grep -Eo "class=\"[^\"]+\"[^>]+class=\"" ' \; | wc -l); test $result -eq 0
|
- run: result=$(find src -type f -iname '*.html' -exec sh -c 'cat {} | tr "\n" " " | grep -Eo "class=\"[^\"]+\"[^>]+class=\"" ' \; | wc -l); test $result -eq 0
|
||||||
- run: npm install -D @ionic/v4-migration-tslint
|
- run: npm install -D @ionic/v4-migration-tslint
|
||||||
- run: npx tslint -c ionic-migration.json -p tsconfig.json
|
- run: npx tslint -c ionic-migration.json -p tsconfig.json
|
||||||
|
|
|
@ -11,11 +11,9 @@ jobs:
|
||||||
MOODLE_DOCKER_PHP_VERSION: 7.3
|
MOODLE_DOCKER_PHP_VERSION: 7.3
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- id: nvmrc
|
- uses: actions/setup-node@v3
|
||||||
uses: browniebroke/read-nvmrc-action@v1
|
|
||||||
- uses: actions/setup-node@v1
|
|
||||||
with:
|
with:
|
||||||
node-version: '${{ steps.nvmrc.outputs.node_version }}'
|
node-version-file: '.nvmrc'
|
||||||
- name: Additional checkouts
|
- name: Additional checkouts
|
||||||
run: |
|
run: |
|
||||||
git clone --branch master --depth 1 https://github.com/moodle/moodle $GITHUB_WORKSPACE/moodle
|
git clone --branch master --depth 1 https://github.com/moodle/moodle $GITHUB_WORKSPACE/moodle
|
||||||
|
|
|
@ -9,10 +9,9 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use Node.js
|
- uses: actions/setup-node@v3
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version-file: '.nvmrc'
|
||||||
- name: Install npm packages
|
- name: Install npm packages
|
||||||
run: npm ci --no-audit
|
run: npm ci --no-audit
|
||||||
- name: Check langindex
|
- name: Check langindex
|
||||||
|
|
|
@ -8,6 +8,8 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
- name: Install npm packages
|
- name: Install npm packages
|
||||||
run: npm ci --no-audit
|
run: npm ci --no-audit
|
||||||
- name: Update Behat plugin
|
- name: Update Behat plugin
|
||||||
|
@ -15,4 +17,5 @@ jobs:
|
||||||
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
||||||
BEHAT_PLUGIN_GITHUB_REPOSITORY: ${{ secrets.BEHAT_PLUGIN_GITHUB_REPOSITORY }}
|
BEHAT_PLUGIN_GITHUB_REPOSITORY: ${{ secrets.BEHAT_PLUGIN_GITHUB_REPOSITORY }}
|
||||||
BEHAT_PLUGIN_BRANCH: ${{ secrets.BEHAT_PLUGIN_BRANCH }}
|
BEHAT_PLUGIN_BRANCH: ${{ secrets.BEHAT_PLUGIN_BRANCH }}
|
||||||
|
BEHAT_PLUGIN_EXCLUDE_FEATURES: ${{ secrets.BEHAT_PLUGIN_EXCLUDE_FEATURES }}
|
||||||
run: ./.github/scripts/update_behat_plugin.sh
|
run: ./.github/scripts/update_behat_plugin.sh
|
||||||
|
|
|
@ -565,7 +565,7 @@ class behat_app extends behat_app_helper {
|
||||||
*/
|
*/
|
||||||
public function i_pull_to_refresh_in_the_app() {
|
public function i_pull_to_refresh_in_the_app() {
|
||||||
$this->spin(function() {
|
$this->spin(function() {
|
||||||
$result = $this->js('await window.behat.pullToRefresh();');
|
$result = $this->runtime_js('pullToRefresh()');
|
||||||
|
|
||||||
if ($result !== 'OK') {
|
if ($result !== 'OK') {
|
||||||
throw new DriverException('Error pulling to refresh - ' . $result);
|
throw new DriverException('Error pulling to refresh - ' . $result);
|
||||||
|
@ -824,7 +824,7 @@ class behat_app extends behat_app_helper {
|
||||||
$this->getSession()->switchToWindow($names[1]);
|
$this->getSession()->switchToWindow($names[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->js('window.close()');
|
$this->evaluate_script('window.close()');
|
||||||
$this->getSession()->switchToWindow($names[0]);
|
$this->getSession()->switchToWindow($names[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -433,51 +433,6 @@ class behat_app_helper extends behat_base {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Evaluate and execute scripts checking for promises if needed.
|
|
||||||
*
|
|
||||||
* @param string $script
|
|
||||||
* @return mixed Resolved promise result.
|
|
||||||
*/
|
|
||||||
protected function js(string $script) {
|
|
||||||
$scriptnoreturn = preg_replace('/^return\s+/', '', $script);
|
|
||||||
$scriptnoreturn = preg_replace('/;$/', '', $scriptnoreturn);
|
|
||||||
|
|
||||||
if (!preg_match('/^await\s+/', $scriptnoreturn)) {
|
|
||||||
// No async.
|
|
||||||
return $this->evaluate_script($script);
|
|
||||||
}
|
|
||||||
|
|
||||||
$script = preg_replace('/^await\s+/', '', $scriptnoreturn);
|
|
||||||
|
|
||||||
$start = microtime(true);
|
|
||||||
$promisevariable = 'PROMISE_RESULT_' . time();
|
|
||||||
$timeout = self::get_extended_timeout();
|
|
||||||
|
|
||||||
$res = $this->evaluate_script("Promise.resolve($script)
|
|
||||||
.then(result => window.$promisevariable = result)
|
|
||||||
.catch(error => window.$promisevariable = 'Async code rejected: ' + error?.message)");
|
|
||||||
|
|
||||||
do {
|
|
||||||
if (microtime(true) - $start > $timeout) {
|
|
||||||
throw new DriverException("Async script not resolved after $timeout seconds");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 0.1 seconds.
|
|
||||||
usleep(100000);
|
|
||||||
} while (!$this->evaluate_script("'$promisevariable' in window"));
|
|
||||||
|
|
||||||
$result = $this->evaluate_script("window.$promisevariable");
|
|
||||||
|
|
||||||
$this->evaluate_script("delete window.$promisevariable");
|
|
||||||
|
|
||||||
if (is_string($result) && strrpos($result, 'Async code rejected:') === 0) {
|
|
||||||
throw new DriverException($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluate and execute methods from the Behat runtime.
|
* Evaluate and execute methods from the Behat runtime.
|
||||||
*
|
*
|
||||||
|
@ -485,7 +440,7 @@ class behat_app_helper extends behat_base {
|
||||||
* @return mixed Result.
|
* @return mixed Result.
|
||||||
*/
|
*/
|
||||||
protected function runtime_js(string $script) {
|
protected function runtime_js(string $script) {
|
||||||
return $this->js("window.behat.$script");
|
return $this->evaluate_script("window.behat.$script");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue