Skip to content

Commit

Permalink
Merge pull request #7420 from jrjohnson/percy-fixes
Browse files Browse the repository at this point in the history
Percy Improvements
  • Loading branch information
stopfstedt committed Sep 22, 2023
2 parents e0e8523 + 8c258ea commit c9b6659
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
15 changes: 8 additions & 7 deletions tests/acceptance/api-version-notice-test.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { visit, waitFor } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupAuthentication } from 'ilios-common';

const url = '/';

import { setupAuthentication, freezeDateAt, unfreezeDate } from 'ilios-common';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { component } from 'ilios-common/page-objects/components/api-version-notice';
Expand All @@ -14,9 +11,14 @@ module('Acceptance | API Version Check', function (hooks) {
setupMirage(hooks);
hooks.beforeEach(async function () {
const school = this.server.create('school');
freezeDateAt(new Date('9/19/2019'));
await setupAuthentication({ school });
});

hooks.afterEach(() => {
unfreezeDate();
});

test('No warning shows up when api versions match', async function (assert) {
assert.expect(3);
const { apiVersion } = this.owner.resolveRegistration('config:environment');
Expand All @@ -31,9 +33,8 @@ module('Acceptance | API Version Check', function (hooks) {
};
});

await visit(url);
await visit('/');
await waitFor('[data-test-load-finished]');
await percySnapshot(assert);
assert.ok(component.notMismatched);
});

Expand All @@ -49,7 +50,7 @@ module('Acceptance | API Version Check', function (hooks) {
};
});

await visit(url);
await visit('/');
await waitFor('[data-test-load-finished]');
await percySnapshot(assert);
assert.ok(component.mismatched);
Expand Down
2 changes: 0 additions & 2 deletions tests/acceptance/dashboard/accessibility-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import a11yAudit from 'ember-a11y-testing/test-support/audit';
import { setupAuthentication } from 'ilios-common';
import percySnapshot from '@percy/ember';

module('Acceptance | dashboard accessibility', function (hooks) {
setupApplicationTest(hooks);
Expand All @@ -18,7 +17,6 @@ module('Acceptance | dashboard accessibility', function (hooks) {
test('meets a11y standards in default view', async function (assert) {
assert.expect(2);
await visit('/dashboard/week');
await percySnapshot(assert);
assert.strictEqual(currentURL(), '/dashboard/week');
await a11yAudit();
assert.ok(true);
Expand Down
10 changes: 9 additions & 1 deletion tests/acceptance/header-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ import { module, test } from 'qunit';
import { visit } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupAuthentication } from 'ilios-common';
import { setupAuthentication, freezeDateAt, unfreezeDate } from 'ilios-common';
import percySnapshot from '@percy/ember';

module('Acceptance | header', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);

hooks.beforeEach(async function () {
freezeDateAt(new Date('9/19/2029'));
});

hooks.afterEach(() => {
unfreezeDate();
});

test('privileged users can view search', async function (assert) {
assert.expect(1);
this.server.get('application/config', function () {
Expand Down
7 changes: 6 additions & 1 deletion tests/acceptance/user-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { click, fillIn, currentURL, triggerEvent, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupAuthentication } from 'ilios-common';
import { setupAuthentication, freezeDateAt, unfreezeDate } from 'ilios-common';

import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
Expand All @@ -12,6 +12,7 @@ module('Acceptance | User', function (hooks) {
setupMirage(hooks);

hooks.beforeEach(async function () {
freezeDateAt(new Date('10/31/2002'));
this.school = this.server.create('school');
const userObject = {
id: 100,
Expand All @@ -33,6 +34,10 @@ module('Acceptance | User', function (hooks) {
await setupAuthentication(userObject);
});

hooks.afterEach(() => {
unfreezeDate();
});

test('can search for users', async function (assert) {
assert.expect(4);
this.server.createList('user', 20, { email: '[email protected]', school: this.school });
Expand Down

0 comments on commit c9b6659

Please sign in to comment.