fix: 🐛 default to light theme for acceptance tests (#2587)

* fix: 🐛 default to light theme for acceptance tests

* refactor: 💡 add async/await to authenticateSession
This commit is contained in:
Cameron Perera authored and GitHub committed 2024-12-02 12:51:24 -06:00
1 parent 8c6b1aa69a
commit b24e5a2c22
104 files changed
+127 -114

No files matched your search

@@ -12,7 +12,7 @@ import {
findAll,
getRootElement,
} from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
@@ -336,23 +336,33 @@ module('Acceptance | authentication', function (hooks) {
authenticateSession({
scope: { id: globalScope.id, type: globalScope.type },
});
// system default
await visit(orgsURL);
assert.notOk(currentSession().get('data.theme'));
assert.notOk(getRootElement().classList.contains('rose-theme-light'));
assert.notOk(getRootElement().classList.contains('rose-theme-dark'));
// toggle light mode
await click('[name="theme"][value="light"]');
// light mode
assert.strictEqual(currentSession().get('data.theme'), 'light');
assert.ok(getRootElement().classList.contains('rose-theme-light'));
assert.notOk(getRootElement().classList.contains('rose-theme-dark'));
// toggle system default
await click('[name="theme"][value="system-default-theme"]');
assert.strictEqual(
currentSession().get('data.theme'),
'system-default-theme',
);
assert.notOk(getRootElement().classList.contains('rose-theme-light'));
assert.notOk(getRootElement().classList.contains('rose-theme-dark'));
// toggle dark mode
await click('[name="theme"][value="dark"]');
assert.strictEqual(currentSession().get('data.theme'), 'dark');
assert.notOk(getRootElement().classList.contains('rose-theme-light'));
assert.ok(getRootElement().classList.contains('rose-theme-dark'));
// toggle system default
await click('[name="theme"][value="system-default-theme"]');
assert.strictEqual(
currentSession().get('data.theme'),
'system-default-theme',