Skip to content

Commit

Permalink
chore: add percy tests (#17157)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaiWithJai authored May 12, 2023
1 parent c47c2c9 commit 17633d8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ui/tests/acceptance/job-definition-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import { click, currentURL } from '@ember/test-helpers';
import percySnapshot from '@percy/ember';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { setupMirage } from 'ember-cli-mirage/test-support';
Expand Down Expand Up @@ -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) {
assert.expect(1);

const requests = server.pretender.handledRequests;
const jobSubmission = requests.findBy(
'url',
Expand All @@ -84,6 +87,7 @@ module('Acceptance | job definition', function (hooks) {
const formattedJobDefinition = JSON.parse(jobSubmission).Source;

await Definition.edit();
await percySnapshot(assert);

assert.equal(
Definition.editor.editor.contents,
Expand All @@ -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) {
assert.expect(4);
await Definition.visit({ id: 'not-a-real-job' });
await percySnapshot(assert);

assert.equal(
server.pretender.handledRequests
Expand Down Expand Up @@ -159,6 +165,7 @@ module('display and edit using full specification', function (hooks) {
server.get('/job/:id/submission', () => specification_response);

await Definition.visit({ id: job.id });
await percySnapshot(assert);

assert
.dom('[data-test-select="job-spec"]')
Expand Down

0 comments on commit 17633d8

Please sign in to comment.