fix: 🐛 host catalog creation tests
This commit is contained in:
1 parent
aed6efe565
commit
aa51b62134
1 file changed
+27
-5
@@ -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(),
|
||||
|
||||
Reference in new issue
Block a user