DEV: Load client site settings YML into JS tests (#18413)

Our method of loading a subset of client settings into tests via
tests/helpers/site-settings.js can be improved upon. Currently we have a
hardcoded subset of the client settings, which may get out of date and not have
the correct defaults. As well as this plugins do not get their settings into the
tests, so whenever you need a setting from a plugin, even if it has a default,
you have to do needs.setting({ ... }) which is inconvenient.

This commit introduces an ember CLI build step to take the site_settings.yml and
all the plugin settings.yml files, pull out the client settings, and dump them
into a variable in a single JS file we can load in our tests, so we have the
correct selection of settings and default values in our JS tests. It also fixes
many, many tests that were operating under incorrect assumptions or old
settings.

Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
This commit is contained in:
Martin Brennan
2022-11-08 09:17:43 +10:00
committed by GitHub
parent ff21651d64
commit ac7bf98ad1
45 changed files with 302 additions and 171 deletions

View File

@ -23,6 +23,9 @@ acceptance("Local Dates - composer", function (needs) {
await visit("/");
await click("#create-topic");
const categoryChooser = selectKit(".category-chooser");
await categoryChooser.expand();
await categoryChooser.selectRowByValue(2);
await fillIn(
".d-editor-input",
@ -73,6 +76,9 @@ acceptance("Local Dates - composer", function (needs) {
test("date modal", async function (assert) {
await visit("/");
await click("#create-topic");
const categoryChooser = selectKit(".category-chooser");
await categoryChooser.expand();
await categoryChooser.selectRowByValue(2);
await click(".d-editor-button-bar .local-dates");
const timezoneChooser = selectKit(".timezone-input");
@ -88,6 +94,9 @@ acceptance("Local Dates - composer", function (needs) {
test("date modal - controls", async function (assert) {
await visit("/");
await click("#create-topic");
const categoryChooser = selectKit(".category-chooser");
await categoryChooser.expand();
await categoryChooser.selectRowByValue(2);
await click(".d-editor-button-bar .local-dates");
await click('.pika-table td[data-day="5"] > .pika-button');

View File

@ -49,7 +49,7 @@ acceptance("Local Dates - quoting", function (needs) {
await click(".insert-quote");
assert.strictEqual(
query(".d-editor-input").value.trim(),
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
`[quote=\"uwe_keim, post:1, topic:280\"]
This is a test [date=2022-06-17 time=10:00:00 timezone="Australia/Brisbane" displayedTimezone="Australia/Perth"]
[/quote]`,
"converts the date to markdown with all options correctly"
@ -88,7 +88,7 @@ acceptance("Local Dates - quoting range", function (needs) {
await click(".insert-quote");
assert.strictEqual(
query(".d-editor-input").value.trim(),
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
`[quote=\"uwe_keim, post:1, topic:280\"]
Some text [date-range from=2022-06-17T09:30:00 to=2022-06-18T10:30:00 format="LL" timezone="Australia/Brisbane" timezones="Africa/Accra|Australia/Brisbane|Europe/Paris"]
[/quote]`,
"converts the date range to markdown with all options correctly"
@ -130,7 +130,7 @@ acceptance(
await click(".insert-quote");
assert.strictEqual(
query(".d-editor-input").value.trim(),
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
`[quote=\"uwe_keim, post:1, topic:280\"]
Testing countdown [date=2022-06-21 time=09:30:00 format="LL" timezone="Australia/Brisbane" countdown="true"]
Testing recurring [date=2022-06-22 timezone="Australia/Brisbane" recurring="2.weeks"]