From aa51b6213424e42e1843f9c9c2ea481a908daa7e Mon Sep 17 00:00:00 2001 From: dharini Date: Wed, 2 Feb 2022 17:39:22 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20host=20catalog=20creation?= =?UTF-8?q?=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../acceptance/host-catalogs/create-test.js | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/ui/admin/tests/acceptance/host-catalogs/create-test.js b/ui/admin/tests/acceptance/host-catalogs/create-test.js index b47b3b4ea..1cfafabe7 100644 --- a/ui/admin/tests/acceptance/host-catalogs/create-test.js +++ b/ui/admin/tests/acceptance/host-catalogs/create-test.js @@ -31,6 +31,8 @@ module('Acceptance | host-catalogs | create', function (hooks) { hostCatalogs: null, hostCatalog: null, newHostCatalog: null, + newStaticHostCatalog: null, + newDynamicHostCatalog: null, }; hooks.beforeEach(function () { @@ -64,6 +66,8 @@ module('Acceptance | host-catalogs | create', function (hooks) { urls.hostCatalog = `${urls.hostCatalogs}/${instances.hostCatalog.id}`; urls.newHostCatalog = `${urls.hostCatalogs}/new`; + urls.newStaticHostCatalog = `${urls.newHostCatalog}?type=static`; + urls.newDynamicHostCatalog = `${urls.newHostCatalog}?type=aws`; // Generate resource couner gethostCatalogCount = () => this.server.schema.hostCatalogs.all().models.length; @@ -71,11 +75,29 @@ module('Acceptance | host-catalogs | create', function (hooks) { authenticateSession({}); }); - test('Users can create new host catalogs', async function (assert) { + test('Users can create new static host catalogs', async function (assert) { assert.expect(1); const count = gethostCatalogCount(); - await visit(urls.newHostCatalog); + await visit(urls.newStaticHostCatalog); + console.log( + urls.newStaticHostCatalog, + 'NEW HOST CATALOGG', + gethostCatalogCount() + ); await fillIn('[name="name"]', 'random string'); + await fillIn('[name="description"]', 'random string'); + await fillIn('[name="types"]', 'static'); + await click('[type="submit"]'); + assert.equal(gethostCatalogCount(), count + 1); + }); + + test('Users can create new dynamic host catalogs', async function (assert) { + assert.expect(1); + const count = gethostCatalogCount(); + await visit(urls.newDynamicHostCatalog); + await fillIn('[name="name"]', 'random string'); + await fillIn('[name="description"]', 'random string'); + await fillIn('[name="types"]', 'aws'); await click('[type="submit"]'); assert.equal(gethostCatalogCount(), count + 1); }); @@ -83,7 +105,7 @@ module('Acceptance | host-catalogs | create', function (hooks) { test('Users can cancel create new host catalogs', async function (assert) { assert.expect(2); const count = gethostCatalogCount(); - await visit(urls.newHostCatalog); + await visit(urls.newStaticHostCatalog); await fillIn('[name="name"]', 'random string'); await click('.rose-form-actions [type="button"]'); assert.equal(currentURL(), urls.hostCatalogs); @@ -111,7 +133,7 @@ module('Acceptance | host-catalogs | create', function (hooks) { 'host-catalogs' ].includes('create') ); - assert.notOk(find(`[href="${urls.newHostCatalog}"]`)); + assert.notOk(find(`[href="${urls.newStaticHostCatalog}"]`)); }); test('saving a new host catalog with invalid fields displays error messages', async function (assert) { @@ -135,7 +157,7 @@ module('Acceptance | host-catalogs | create', function (hooks) { } ); }); - await visit(urls.newHostCatalog); + await visit(urls.newStaticHostCatalog); await click('[type="submit"]'); assert.ok( find('[role="alert"]').textContent.trim(),