DEV: Run Ember CLI tests in random order

In browser this uses the `seed` config, in ember exam it adds `--random`
as a parameter.
This commit is contained in:
Robin Ward 2022-01-25 14:17:07 -05:00
parent 5fd13380d8
commit f43bba8d59
2 changed files with 10 additions and 3 deletions

View File

@ -232,15 +232,15 @@ jobs:
- name: Core QUnit 1
working-directory: ./app/assets/javascripts/discourse
run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=1 --launch "${{ matrix.browser }}"
run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=1 --launch "${{ matrix.browser }}" --random
timeout-minutes: 20
- name: Core QUnit 2
working-directory: ./app/assets/javascripts/discourse
run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=2 --launch "${{ matrix.browser }}"
run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=2 --launch "${{ matrix.browser }}" --random
timeout-minutes: 20
- name: Core QUnit 3
working-directory: ./app/assets/javascripts/discourse
run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=3 --launch "${{ matrix.browser }}"
run: sudo -E -u discourse -H yarn ember exam --path /tmp/emberbuild --split=3 --partition=3 --launch "${{ matrix.browser }}" --random
timeout-minutes: 20

View File

@ -34,6 +34,13 @@ document.addEventListener("discourse-booted", () => {
setup(QUnit.assert);
setupTests(config.APP);
let loader = loadEmberExam();
if (loader.urlParams.size === 0 && !QUnit.config.seed) {
// If we're running in browser, default to random order. Otherwise, let Ember Exam
// handle randomization.
QUnit.config.seed = true;
}
loader.loadModules();
start({
setupTestContainer: false,