diff --git a/ui/mirage/factories/agent.js b/ui/mirage/factories/agent.js index d232c82a9..734d99e77 100644 --- a/ui/mirage/factories/agent.js +++ b/ui/mirage/factories/agent.js @@ -7,6 +7,7 @@ import { Factory, trait } from 'ember-cli-mirage'; import faker from 'nomad-ui/mirage/faker'; import { provide } from '../utils'; import { DATACENTERS } from '../common'; +import { scenario } from '../scenarios/default'; const UUIDS = provide(100, faker.random.uuid.bind(faker.random)); const AGENT_STATUSES = ['alive', 'leaving', 'left', 'failed']; @@ -27,7 +28,7 @@ export default Factory.extend({ Label: { TextColor: 'white', BackgroundColor: 'hotpink', - Text: 'Mirage', + Text: `Mirage - ${scenario}`, }, }, ACL: { diff --git a/ui/mirage/scenarios/default.js b/ui/mirage/scenarios/default.js index cf7cc024b..5216e9274 100644 --- a/ui/mirage/scenarios/default.js +++ b/ui/mirage/scenarios/default.js @@ -30,7 +30,7 @@ export const allScenarios = { ...sysbatchScenarios, }; -const scenario = +export const scenario = getScenarioQueryParameter() || getConfigValue('mirageScenario', 'emptyCluster'); diff --git a/ui/tests/acceptance/allocation-detail-test.js b/ui/tests/acceptance/allocation-detail-test.js index 0e277f30f..49aea669f 100644 --- a/ui/tests/acceptance/allocation-detail-test.js +++ b/ui/tests/acceptance/allocation-detail-test.js @@ -83,10 +83,7 @@ module('Acceptance | allocation detail', function (hooks) { ); assert.ok(Allocation.execButton.isPresent); - assert.equal( - document.title, - `Allocation ${allocation.name} - Mirage - Nomad` - ); + assert.ok(document.title.includes(`Allocation ${allocation.name} `)); await Allocation.details.visitJob(); assert.equal( diff --git a/ui/tests/acceptance/behaviors/fs.js b/ui/tests/acceptance/behaviors/fs.js index b30ff8d5f..febc08859 100644 --- a/ui/tests/acceptance/behaviors/fs.js +++ b/ui/tests/acceptance/behaviors/fs.js @@ -87,12 +87,13 @@ export default function browseFilesystem({ })}${encodeURIComponent(filePath)}`, 'No redirect' ); - assert.equal( - document.title, - `${pathWithLeadingSlash} - ${getTitleComponent({ - allocation: this.allocation, - task: this.task, - })} - Mirage - Nomad` + assert.ok( + document.title.includes( + `${pathWithLeadingSlash} - ${getTitleComponent({ + allocation: this.allocation, + task: this.task, + })}` + ) ); assert.equal( FS.breadcrumbsText, diff --git a/ui/tests/acceptance/client-detail-test.js b/ui/tests/acceptance/client-detail-test.js index cd1bdb298..5d657b112 100644 --- a/ui/tests/acceptance/client-detail-test.js +++ b/ui/tests/acceptance/client-detail-test.js @@ -75,7 +75,7 @@ module('Acceptance | client detail', function (hooks) { test('/clients/:id should have a breadcrumb trail linking back to clients', async function (assert) { await ClientDetail.visit({ id: node.id }); - assert.equal(document.title, `Client ${node.name} - Mirage - Nomad`); + assert.ok(document.title.includes(`Client ${node.name}`)); assert.equal( Layout.breadcrumbFor('clients.index').text, diff --git a/ui/tests/acceptance/clients-list-test.js b/ui/tests/acceptance/clients-list-test.js index 17fa6441c..5479a7e09 100644 --- a/ui/tests/acceptance/clients-list-test.js +++ b/ui/tests/acceptance/clients-list-test.js @@ -56,7 +56,7 @@ module('Acceptance | clients list', function (hooks) { ); }); - assert.equal(document.title, 'Clients - Mirage - Nomad'); + assert.ok(document.title.includes('Clients')); }); test('each client record should show high-level info of the client', async function (assert) { diff --git a/ui/tests/acceptance/exec-test.js b/ui/tests/acceptance/exec-test.js index 06cd97fc2..fbf182283 100644 --- a/ui/tests/acceptance/exec-test.js +++ b/ui/tests/acceptance/exec-test.js @@ -72,7 +72,7 @@ module('Acceptance | exec', function (hooks) { region: 'region-2', }); - assert.equal(document.title, 'Exec - region-2 - Mirage - Nomad'); + assert.ok(document.title.includes('Exec - region-2')); assert.equal(Exec.header.region.text, this.job.region); assert.equal(Exec.header.namespace.text, this.job.namespace); diff --git a/ui/tests/acceptance/regions-test.js b/ui/tests/acceptance/regions-test.js index f05c9a05d..717375f5a 100644 --- a/ui/tests/acceptance/regions-test.js +++ b/ui/tests/acceptance/regions-test.js @@ -40,7 +40,7 @@ module('Acceptance | regions (only one)', function (hooks) { await JobsList.visit(); assert.notOk(Layout.navbar.regionSwitcher.isPresent, 'No region switcher'); - assert.equal(document.title, 'Jobs - Mirage - Nomad'); + assert.ok(document.title.includes('Jobs')); }); test('when the only region is not named "global", the region switcher still is not shown', async function (assert) { @@ -105,7 +105,7 @@ module('Acceptance | regions (many)', function (hooks) { Layout.navbar.regionSwitcher.isPresent, 'Region switcher is shown' ); - assert.equal(document.title, 'Jobs - global - Mirage - Nomad'); + assert.ok(document.title.includes('Jobs - global')); }); test('when on the default region, pages do not include the region query param', async function (assert) { diff --git a/ui/tests/acceptance/server-detail-test.js b/ui/tests/acceptance/server-detail-test.js index e31bb362c..b481889d7 100644 --- a/ui/tests/acceptance/server-detail-test.js +++ b/ui/tests/acceptance/server-detail-test.js @@ -30,7 +30,7 @@ module('Acceptance | server detail', function (hooks) { test('visiting /servers/:server_name', async function (assert) { assert.equal(currentURL(), `/servers/${encodeURIComponent(agent.name)}`); - assert.equal(document.title, `Server ${agent.name} - Mirage - Nomad`); + assert.ok(document.title.includes(`Server ${agent.name}`)); }); test('when the server is the leader, the title shows a leader badge', async function (assert) { diff --git a/ui/tests/acceptance/servers-list-test.js b/ui/tests/acceptance/servers-list-test.js index 9d1f9a073..3217f90cf 100644 --- a/ui/tests/acceptance/servers-list-test.js +++ b/ui/tests/acceptance/servers-list-test.js @@ -66,7 +66,7 @@ module('Acceptance | servers list', function (hooks) { ); }); - assert.equal(document.title, 'Servers - Mirage - Nomad'); + assert.ok(document.title.includes('Servers')); }); test('each server should show high-level info of the server', async function (assert) { diff --git a/ui/tests/acceptance/task-detail-test.js b/ui/tests/acceptance/task-detail-test.js index f4272b098..b40cebc04 100644 --- a/ui/tests/acceptance/task-detail-test.js +++ b/ui/tests/acceptance/task-detail-test.js @@ -70,7 +70,7 @@ module('Acceptance | task detail', function (hooks) { assert.equal(Task.lifecycle, lifecycleName); - assert.equal(document.title, `Task ${task.name} - Mirage - Nomad`); + assert.ok(document.title.includes(`Task ${task.name}`)); }); test('breadcrumbs match jobs / job / task group / allocation / task', async function (assert) { diff --git a/ui/tests/acceptance/task-group-detail-test.js b/ui/tests/acceptance/task-group-detail-test.js index 504491206..74e82762c 100644 --- a/ui/tests/acceptance/task-group-detail-test.js +++ b/ui/tests/acceptance/task-group-detail-test.js @@ -126,9 +126,8 @@ module('Acceptance | task group detail', function (hooks) { 'Aggregated Disk reservation for all tasks' ); - assert.equal( - document.title, - `Task group ${taskGroup.name} - Job ${job.name} - Mirage - Nomad` + assert.ok( + document.title.includes(`Task group ${taskGroup.name} - Job ${job.name}`) ); }); diff --git a/ui/tests/acceptance/task-logs-test.js b/ui/tests/acceptance/task-logs-test.js index 2f6b74aa9..e6f2b6f42 100644 --- a/ui/tests/acceptance/task-logs-test.js +++ b/ui/tests/acceptance/task-logs-test.js @@ -51,7 +51,7 @@ module('Acceptance | task logs', function (hooks) { 'No redirect' ); assert.ok(TaskLogs.hasTaskLog, 'Task log component found'); - assert.equal(document.title, `Task ${task.name} logs - Mirage - Nomad`); + assert.ok(document.title.includes(`Task ${task.name}`)); }); test('the stdout log immediately starts streaming', async function (assert) { diff --git a/ui/tests/acceptance/token-test.js b/ui/tests/acceptance/token-test.js index 0698f4ddc..152b96d90 100644 --- a/ui/tests/acceptance/token-test.js +++ b/ui/tests/acceptance/token-test.js @@ -60,7 +60,7 @@ module('Acceptance | tokens', function (hooks) { null, 'No token secret set' ); - assert.equal(document.title, 'Authorization - Mirage - Nomad'); + assert.ok(document.title.includes('Authorization')); await Tokens.secret(secretId).submit(); assert.equal(