Skip to content

Commit

Permalink
refactor host catalogs, hosts and sets update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenolivia committed Dec 17, 2024
1 parent 7fc0f58 commit d719c1e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';

module('Acceptance | host-catalogs | host sets | update', function (hooks) {
setupApplicationTest(hooks);
Expand Down Expand Up @@ -307,8 +308,8 @@ module('Acceptance | host-catalogs | host sets | update', function (hooks) {
try {
await visit(urls.hostSets);
} catch (e) {
assert.ok(find('.rose-dialog'));
await click('.rose-dialog-footer button:first-child');
assert.ok(find(commonSelectors.MODAL_WARNING));
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.hostSets);
assert.notEqual(
this.server.schema.hostSets.first().name,
Expand Down
8 changes: 4 additions & 4 deletions ui/admin/tests/acceptance/host-catalogs/hosts/update-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ module('Acceptance | host-catalogs | hosts | update', function (hooks) {
try {
await visit(urls.hosts);
} catch (e) {
assert.dom(commonSelectors.DIALOG_UNSAVED_CHANGES).exists();
await click(commonSelectors.DIALOG_UNSAVED_CHANGES_DISCARD);
assert.dom(commonSelectors.MODAL_WARNING).exists();
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);
assert.strictEqual(currentURL(), urls.hosts);
assert.notEqual(name, commonSelectors.FIELD_NAME_VALUE);
assert.notEqual(description, commonSelectors.FIELD_DESCRIPTION_VALUE);
Expand Down Expand Up @@ -195,8 +195,8 @@ module('Acceptance | host-catalogs | hosts | update', function (hooks) {
try {
await visit(urls.hosts);
} catch (e) {
assert.dom(commonSelectors.DIALOG_UNSAVED_CHANGES).exists();
await click(commonSelectors.DIALOG_UNSAVED_CHANGES_CANCEL);
assert.dom(commonSelectors.MODAL_WARNING).exists();
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);

assert.strictEqual(currentURL(), urls.host);
assert.notEqual(name, commonSelectors.FIELD_NAME_VALUE);
Expand Down
5 changes: 3 additions & 2 deletions ui/admin/tests/acceptance/targets/delete-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
import { Response } from 'miragejs';
import { authenticateSession } from 'ember-simple-auth/test-support';
import * as commonSelectors from 'admin/tests/helpers/selectors';

module('Acceptance | targets | delete', function (hooks) {
setupApplicationTest(hooks);
Expand Down Expand Up @@ -82,7 +83,7 @@ module('Acceptance | targets | delete', function (hooks) {
await click(`[href="${urls.target}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click('.rose-dialog .rose-button-primary');
await click(commonSelectors.MODAL_WARNING_CONFIRM_BTN);

assert
.dom('[data-test-toast-notification] .hds-alert__description')
Expand All @@ -100,7 +101,7 @@ module('Acceptance | targets | delete', function (hooks) {
await click(`[href="${urls.target}"]`);
await click(MANAGE_DROPDOWN_SELECTOR);
await click(DELETE_ACTION_SELECTOR);
await click('.rose-dialog .rose-button-secondary');
await click(commonSelectors.MODAL_WARNING_CANCEL_BTN);

assert.strictEqual(getTargetCount(), targetCount);
assert.strictEqual(currentURL(), urls.target);
Expand Down

0 comments on commit d719c1e

Please sign in to comment.