This commit is contained in:
Jesse Mazzella 2023-11-06 17:29:52 -08:00
parent d2df694c40
commit dafe89a5fa
3 changed files with 45 additions and 15 deletions

View File

@ -11,8 +11,9 @@ export const MISSION_TIME = 1732413600000; // Saturday, November 23, 2024 6:00:0
/**
* URL Constants
* - This is the URL that the browser will be directed to when running visual tests. This URL
* - This is the URL that the browser will be directed to when running visual tests. This URL
* - hides the tree and inspector to prevent visual noise
* - sets the time bounds to a fixed range
*/
export const VISUAL_URL = './#/browse/mine?tc.mode=fixed&tc.startBound=1693592063607&tc.endBound=1693593893607&tc.timeSystem=utc&view=grid&hideInspector=true&hideTree=true';
export const VISUAL_FIXED_URL =
'./#/browse/mine?tc.mode=fixed&tc.startBound=1693592063607&tc.endBound=1693593893607&tc.timeSystem=utc&view=grid&hideInspector=true&hideTree=true';

View File

@ -69,6 +69,7 @@ const testPlan = {
};
test.describe('Time List', () => {
// the first time modifying test -- watch Terminator
test('Create a Time List, add a single Plan to it and verify all the activities are displayed with no milliseconds', async ({
page
}) => {
@ -84,22 +85,17 @@ test.describe('Time List', () => {
});
await test.step('Create a Plan and add it to the timelist', async () => {
const createdPlan = await createPlanFromJSON(page, {
await createPlanFromJSON(page, {
name: 'Test Plan',
json: testPlan
json: testPlan,
parent: timelist.uuid
});
await page.goto(timelist.url);
// Expand the tree to show the plan
await page.click("button[title='Show selected item in tree']");
await page.dragAndDrop(`role=treeitem[name=/${createdPlan.name}/]`, '.c-object-view');
await page.click("button[title='Save']");
await page.click("li[title='Save and Finish Editing']");
const startBound = testPlan.TEST_GROUP[0].start;
const endBound = testPlan.TEST_GROUP[testPlan.TEST_GROUP.length - 1].end;
await page.goto(timelist.url);
// Switch to fixed time mode with all plan events within the bounds
await page.goto(
`${timelist.url}?tc.mode=fixed&tc.startBound=${startBound}&tc.endBound=${endBound}&tc.timeSystem=utc&view=timelist.view`

View File

@ -27,14 +27,15 @@ const {
} = require('../../helper/planningUtils');
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../appActions');
const percySnapshot = require('@percy/playwright');
const VISUAL_URL = require('../../constants').VISUAL_URL;
const VISUAL_FIXED_URL = require('../../constants').VISUAL_FIXED_URL;
const examplePlanSmall = require('../../test-data/examplePlans/ExamplePlan_Small2.json');
const { MISSION_TIME } = require('../../constants');
const snapshotScope = '.l-shell__pane-main .l-pane__contents';
test.describe('Visual - Planning', () => {
test.beforeEach(async ({ page }) => {
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
});
test('Plan View', async ({ page, theme }) => {
@ -54,7 +55,7 @@ test.describe('Visual - Planning', () => {
name: 'Plan Visual Test (Draft)',
json: examplePlanSmall
});
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
await setDraftStatusForPlan(page, plan);
await setBoundsToSpanAllActivities(page, examplePlanSmall, plan.url);
@ -90,7 +91,7 @@ test.describe('Visual - Planning', () => {
await setDraftStatusForPlan(page, plan);
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
await page.goto(VISUAL_FIXED_URL, { waitUntil: 'domcontentloaded' });
await setBoundsToSpanAllActivities(page, examplePlanSmall, ganttChart.url);
await percySnapshot(page, `Gantt Chart View w/ draft status (theme: ${theme})`, {
@ -98,3 +99,35 @@ test.describe('Visual - Planning', () => {
});
});
});
test.describe('Timelist', () => {
test.use({
overrideClock: true,
clockOptions: {
now: MISSION_TIME,
shouldAdvanceTime: true
}
});
test.beforeEach(async ({ page }) => {
await page.goto('./', { waitUntil: 'domcontentloaded' });
});
test('Timelist', async ({ page, theme }) => {
const timelist = await createDomainObjectWithDefaults(page, {
type: 'Time List',
name: 'Time List Visual Test'
});
const plan = await createPlanFromJSON(page, {
json: examplePlanSmall,
parent: timelist.uuid
});
await setBoundsToSpanAllActivities(page, examplePlanSmall, plan.url);
await page.goto(timelist.url);
await percySnapshot(page, `Timelist Countdown 1 (theme: ${theme})`, {
scope: snapshotScope
});
await page.waitForTimeout(1000);
await percySnapshot(page, `Timelist Countdown 2 (theme: ${theme})`, {
scope: snapshotScope
});
});
});