Skip to content

Commit

Permalink
Beginning testcase cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Oct 19, 2022
1 parent ab68f4e commit 6ee6c39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 41 deletions.
39 changes: 5 additions & 34 deletions ui/tests/integration/components/job-editor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,59 +105,30 @@ module('Integration | Component | job-editor', function (hooks) {
};

const planJob = async (spec) => {
await this.pauseTest();

await Editor.editor.fillIn(spec);
await Editor.plan();
};

test('the default state is an editor with an explanation popup', async function (assert) {
assert.expect(3);
assert.expect(2);

const job = await this.store.createRecord('job');

await renderNewJob(this, job);
assert.ok(
Editor.editorHelp.isPresent,
'Editor explanation popup is present'
);
assert.ok(Editor.editor.isPresent, 'Editor is present');

await componentA11yAudit(this.element, assert);
});

test('the explanation popup can be dismissed', async function (assert) {
const job = await this.store.createRecord('job');

await renderNewJob(this, job);
await Editor.editorHelp.dismiss();
assert.notOk(
Editor.editorHelp.isPresent,
'Editor explanation popup is gone'
);
assert.equal(
window.localStorage.nomadMessageJobEditor,
'false',
'Dismissal is persisted in localStorage'
);
});

test('the explanation popup is not shown once the dismissal state is set in localStorage', async function (assert) {
window.localStorage.nomadMessageJobEditor = 'false';

const job = await this.store.createRecord('job');

await renderNewJob(this, job);
assert.notOk(
Editor.editorHelp.isPresent,
'Editor explanation popup is gone'
);
});

test('submitting a json job skips the parse endpoint', async function (assert) {
test.only('submitting a json job skips the parse endpoint', async function (assert) {
const spec = jsonJob();
const job = await this.store.createRecord('job');

await renderNewJob(this, job);
await planJob(spec);
console.log('wait');
const requests = this.server.pretender.handledRequests.mapBy('url');
assert.notOk(
requests.includes('/v1/jobs/parse'),
Expand Down
7 changes: 0 additions & 7 deletions ui/tests/pages/components/job-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ export default () => ({
dismiss: clickable('[data-test-plan-help-dismiss]'),
},

editorHelp: {
isPresent: isPresent('[data-test-editor-help-title]'),
title: text('[data-test-editor-help-title]'),
message: text('[data-test-editor-help-message]'),
dismiss: clickable('[data-test-editor-help-dismiss]'),
},

editor: {
isPresent: isPresent('[data-test-editor]'),
contents: code('[data-test-editor]'),
Expand Down

0 comments on commit 6ee6c39

Please sign in to comment.