chore: add percy tests (#17157)

This commit is contained in:
Jai 2023-05-12 09:57:22 -04:00 committed by GitHub
parent 27f0d104e5
commit e55edf58ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,7 @@
*/ */
import { click, currentURL } from '@ember/test-helpers'; import { click, currentURL } from '@ember/test-helpers';
import percySnapshot from '@percy/ember';
import { module, test } from 'qunit'; import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit'; import { setupApplicationTest } from 'ember-qunit';
import { setupMirage } from 'ember-cli-mirage/test-support'; import { setupMirage } from 'ember-cli-mirage/test-support';
@ -76,6 +77,8 @@ module('Acceptance | job definition', function (hooks) {
}); });
test('when in editing mode, the editor is prepopulated with the job definition', async function (assert) { test('when in editing mode, the editor is prepopulated with the job definition', async function (assert) {
assert.expect(1);
const requests = server.pretender.handledRequests; const requests = server.pretender.handledRequests;
const jobSubmission = requests.findBy( const jobSubmission = requests.findBy(
'url', 'url',
@ -84,6 +87,7 @@ module('Acceptance | job definition', function (hooks) {
const formattedJobDefinition = JSON.parse(jobSubmission).Source; const formattedJobDefinition = JSON.parse(jobSubmission).Source;
await Definition.edit(); await Definition.edit();
await percySnapshot(assert);
assert.equal( assert.equal(
Definition.editor.editor.contents, Definition.editor.editor.contents,
@ -108,7 +112,9 @@ module('Acceptance | job definition', function (hooks) {
}); });
test('when the job for the definition is not found, an error message is shown, but the URL persists', async function (assert) { test('when the job for the definition is not found, an error message is shown, but the URL persists', async function (assert) {
assert.expect(4);
await Definition.visit({ id: 'not-a-real-job' }); await Definition.visit({ id: 'not-a-real-job' });
await percySnapshot(assert);
assert.equal( assert.equal(
server.pretender.handledRequests server.pretender.handledRequests
@ -159,6 +165,7 @@ module('display and edit using full specification', function (hooks) {
server.get('/job/:id/submission', () => specification_response); server.get('/job/:id/submission', () => specification_response);
await Definition.visit({ id: job.id }); await Definition.visit({ id: job.id });
await percySnapshot(assert);
assert assert
.dom('[data-test-select="job-spec"]') .dom('[data-test-select="job-spec"]')