ui: display mirage scenario in header label (#17649)

This information is useful when switching between different scenarios
for testing.
This commit is contained in:
Luiz Aoqui
2023-06-22 10:38:17 -04:00
committed by GitHub
parent 33ac5ed1df
commit 876117fadd
14 changed files with 23 additions and 25 deletions

View File

@@ -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: {

View File

@@ -30,7 +30,7 @@ export const allScenarios = {
...sysbatchScenarios,
};
const scenario =
export const scenario =
getScenarioQueryParameter() ||
getConfigValue('mirageScenario', 'emptyCluster');

View File

@@ -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(

View File

@@ -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,

View File

@@ -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,

View File

@@ -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) {

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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) {

View File

@@ -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}`)
);
});

View File

@@ -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) {

View File

@@ -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(