mirror of
https://github.com/nasa/openmct.git
synced 2025-01-30 16:13:53 +00:00
test(visual): add theme to notification banner test name (#6450)
* test(visual): add theme to notification banner test name * test: rename file * test: switch to small example plan * test: snapshot object-view only * test: fix selectors * refactor: chain locators together
This commit is contained in:
parent
e3ab085dd5
commit
a9a98380f2
@ -58,8 +58,14 @@ async function navigateToFaultManagementWithoutExample(page) {
|
|||||||
async function navigateToFaultItemInTree(page) {
|
async function navigateToFaultItemInTree(page) {
|
||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'networkidle' });
|
||||||
|
|
||||||
// Click text=Fault Management
|
const faultManagementTreeItem = page.getByRole('tree', {
|
||||||
await page.click('text=Fault Management'); // this verifies the plugin has been added
|
name: "Main Tree"
|
||||||
|
}).getByRole('treeitem', {
|
||||||
|
name: "Fault Management"
|
||||||
|
});
|
||||||
|
|
||||||
|
// Navigate to "Fault Management" from the tree
|
||||||
|
await faultManagementTreeItem.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,8 +147,7 @@ async function clearSearch(page) {
|
|||||||
* @param {import('@playwright/test').Page} page
|
* @param {import('@playwright/test').Page} page
|
||||||
*/
|
*/
|
||||||
async function selectFaultItem(page, rowNumber) {
|
async function selectFaultItem(page, rowNumber) {
|
||||||
// eslint-disable-next-line playwright/no-force-option
|
await page.locator(`.c-fault-mgmt-item > input >> nth=${rowNumber - 1}`).check();
|
||||||
await page.check(`.c-fault-mgmt-item > input >> nth=${rowNumber - 1}`, { force: true }); // this will not work without force true, saw this may be a pw bug
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,7 +34,7 @@ test.describe('Visual - Check Notification Info Banner of \'Save successful\'',
|
|||||||
await page.goto('./', { waitUntil: 'networkidle' });
|
await page.goto('./', { waitUntil: 'networkidle' });
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Create a clock, click on \'Save successful\' banner and dismiss it', async ({ page }) => {
|
test('Create a clock, click on \'Save successful\' banner and dismiss it', async ({ page, theme }) => {
|
||||||
// Create a clock domain object
|
// Create a clock domain object
|
||||||
await createDomainObjectWithDefaults(page, { type: 'Clock' });
|
await createDomainObjectWithDefaults(page, { type: 'Clock' });
|
||||||
// Verify there is a button with aria-label="Review 1 Notification"
|
// Verify there is a button with aria-label="Review 1 Notification"
|
||||||
@ -47,7 +47,7 @@ test.describe('Visual - Check Notification Info Banner of \'Save successful\'',
|
|||||||
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(true);
|
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(true);
|
||||||
// Verify the div with role="dialog" contains text "Save successful"
|
// Verify the div with role="dialog" contains text "Save successful"
|
||||||
expect(await page.locator('div[role="dialog"]').innerText()).toContain('Save successful');
|
expect(await page.locator('div[role="dialog"]').innerText()).toContain('Save successful');
|
||||||
await percySnapshot(page, 'Notification banner');
|
await percySnapshot(page, `Notification banner - ${theme}`);
|
||||||
// Verify there is a button with text "Dismiss"
|
// Verify there is a button with text "Dismiss"
|
||||||
expect(await page.locator('button:has-text("Dismiss")').isVisible()).toBe(true);
|
expect(await page.locator('button:has-text("Dismiss")').isVisible()).toBe(true);
|
||||||
// Click on button with text "Dismiss"
|
// Click on button with text "Dismiss"
|
||||||
|
@ -24,7 +24,9 @@ const { test } = require('../../pluginFixtures');
|
|||||||
const { setBoundsToSpanAllActivities } = require('../../helper/planningUtils');
|
const { setBoundsToSpanAllActivities } = require('../../helper/planningUtils');
|
||||||
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../appActions');
|
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../appActions');
|
||||||
const percySnapshot = require('@percy/playwright');
|
const percySnapshot = require('@percy/playwright');
|
||||||
const examplePlanLarge = require('../../test-data/examplePlans/ExamplePlan_Large.json');
|
const examplePlanSmall = require('../../test-data/examplePlans/ExamplePlan_Small2.json');
|
||||||
|
|
||||||
|
const snapshotScope = '.c-object-view';
|
||||||
|
|
||||||
test.describe('Visual - Planning', () => {
|
test.describe('Visual - Planning', () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
@ -32,21 +34,25 @@ test.describe('Visual - Planning', () => {
|
|||||||
});
|
});
|
||||||
test('Plan View', async ({ page, theme }) => {
|
test('Plan View', async ({ page, theme }) => {
|
||||||
const plan = await createPlanFromJSON(page, {
|
const plan = await createPlanFromJSON(page, {
|
||||||
json: examplePlanLarge
|
json: examplePlanSmall
|
||||||
});
|
});
|
||||||
|
|
||||||
await setBoundsToSpanAllActivities(page, examplePlanLarge, plan.url);
|
await setBoundsToSpanAllActivities(page, examplePlanSmall, plan.url);
|
||||||
await percySnapshot(page, `Plan View (theme: ${theme})`);
|
await percySnapshot(page, `Plan View (theme: ${theme})`, {
|
||||||
|
scope: snapshotScope
|
||||||
|
});
|
||||||
});
|
});
|
||||||
test('Gantt Chart View', async ({ page, theme }) => {
|
test('Gantt Chart View', async ({ page, theme }) => {
|
||||||
const ganttChart = await createDomainObjectWithDefaults(page, {
|
const ganttChart = await createDomainObjectWithDefaults(page, {
|
||||||
type: 'Gantt Chart'
|
type: 'Gantt Chart'
|
||||||
});
|
});
|
||||||
await createPlanFromJSON(page, {
|
await createPlanFromJSON(page, {
|
||||||
json: examplePlanLarge,
|
json: examplePlanSmall,
|
||||||
parent: ganttChart.uuid
|
parent: ganttChart.uuid
|
||||||
});
|
});
|
||||||
await setBoundsToSpanAllActivities(page, examplePlanLarge, ganttChart.url);
|
await setBoundsToSpanAllActivities(page, examplePlanSmall, ganttChart.url);
|
||||||
await percySnapshot(page, `Gantt Chart View (theme: ${theme})`);
|
await percySnapshot(page, `Gantt Chart View (theme: ${theme})`, {
|
||||||
|
scope: snapshotScope
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user