Skip to content

Commit

Permalink
ci: fix some flaky UI tests (#17648)
Browse files Browse the repository at this point in the history
These tests would fail depending on the value of the seed used.
  • Loading branch information
lgfa29 committed Jun 22, 2023
1 parent 78899c6 commit c5ee272
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions ui/tests/acceptance/allocation-detail-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable qunit/require-expect */
/* Mirage fixtures are random so we can't expect a set number of assertions */
import { run } from '@ember/runloop';
import { currentURL, click, visit, triggerEvent } from '@ember/test-helpers';
import { currentURL, click, triggerEvent } from '@ember/test-helpers';
import { assign } from '@ember/polyfills';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
Expand Down Expand Up @@ -634,8 +634,10 @@ module('Acceptance | allocation detail (services)', function (hooks) {
id: 'service-haver',
namespaceId: 'default',
});

const currentAlloc = server.db.allocations.findBy({ jobId: job.id });
const runningAlloc = server.create('allocation', {
jobId: job.id,
forceRunningClientStatus: true,
});
const otherAlloc = server.db.allocations.reject((j) => j.jobId !== job.id);

server.db.serviceFragments.update({
Expand All @@ -644,7 +646,7 @@ module('Acceptance | allocation detail (services)', function (hooks) {
Status: 'success',
Check: 'check1',
Timestamp: 99,
Alloc: currentAlloc.id,
Alloc: runningAlloc.id,
},
{
Status: 'failure',
Expand All @@ -653,21 +655,21 @@ module('Acceptance | allocation detail (services)', function (hooks) {
propThatDoesntMatter:
'this object will be ignored, since it shared a Check name with a later one.',
Timestamp: 98,
Alloc: currentAlloc.id,
Alloc: runningAlloc.id,
},
{
Status: 'success',
Check: 'check2',
Output: 'Two',
Timestamp: 99,
Alloc: currentAlloc.id,
Alloc: runningAlloc.id,
},
{
Status: 'failure',
Check: 'check3',
Output: 'Oh no!',
Timestamp: 99,
Alloc: currentAlloc.id,
Alloc: runningAlloc.id,
},
{
Status: 'success',
Expand All @@ -683,14 +685,18 @@ module('Acceptance | allocation detail (services)', function (hooks) {
});

test('Allocation has a list of services with active checks', async function (assert) {
await visit('jobs/service-haver@default');
await click('.allocation-row');
const runningAlloc = server.db.allocations.findBy({
jobId: 'service-haver',
clientStatus: 'running',
});
await Allocation.visit({ id: runningAlloc.id });
assert.dom('[data-test-service]').exists();
assert.dom('.service-sidebar').exists();
assert.dom('.service-sidebar').doesNotHaveClass('open');
assert
.dom('[data-test-service-status-bar]')
.exists('At least one allocation has service health');

await click('[data-test-service-status-bar]');
assert.dom('.service-sidebar').hasClass('open');
assert
Expand Down

0 comments on commit c5ee272

Please sign in to comment.