diff --git a/ui/desktop/tests/acceptance/projects/targets/hosts-test.js b/ui/desktop/tests/acceptance/projects/targets/hosts-test.js index 3b6fda1ea..f54c33d2b 100644 --- a/ui/desktop/tests/acceptance/projects/targets/hosts-test.js +++ b/ui/desktop/tests/acceptance/projects/targets/hosts-test.js @@ -173,7 +173,14 @@ module('Acceptance | projects | targets | hosts', function (hooks) { test('visiting index', async function (assert) { assert.expect(2); - const hostsCount = this.server.schema.hosts.all().models.length; + // Because we are generating host with different types but just showing on the list + // the type = static, we have to apply a filter here + const rawHostsList = this.server.schema.hosts.all(); + const filteredHostsList = rawHostsList.filter((host) => { + if (host.type === 'static') { + return host; + } + }).length; // This later/cancelTimers technique allows us to test a page with // active polling. Normally an acceptance test waits for all runloop timers // to stop before returning from an awaited test, but polling means that @@ -183,7 +190,7 @@ module('Acceptance | projects | targets | hosts', function (hooks) { run.cancelTimers(); // await a11yAudit(); assert.equal(currentURL(), urls.hosts); - assert.equal(findAll('tbody tr').length, hostsCount); + assert.equal(findAll('tbody tr').length, filteredHostsList); }, 750); await visit(urls.hosts); });