[CI] Add a11y checks to our visual testing suite (#7047)
* Add a VISUAL_URL constant and remove all vestiges of hide inspector and tree * hide timer and add concurrency * turn off concurrency * factor out old appAction * Add expand button to panes * remove old slow annotations * fix fault * update domcontentloaded * missed refactor * driveby: setTimeBounds private * add comments to the percyCSS * suggest MISSION_TIME * more notes * regen * clean up test * driveby: clean up order * restructure * add new suite now that i'ts hidden * use mission time everywhere possible * driveby * rerun generatedata * comments * lint fix * add inital pass of a11y tests * first pass for fixing a11y problems * update build * add copyright * check for slashes * rename files * update testcases * update to latest * updates * section 508 * final version * remove leftover * comments * documentation * bad merge * comment * use current ruleset * typo * feedback * remove time conductor due to false positives * default to closed tabs * add some more accessiblity checking * change to a condition widget and update search * lint fix * turns this into a single function * update doc to match single function * update to single function * update to new function * lint * update locator for search input * fix extra page * why * comments * comments * refacotr * wrong paths and fixes
This commit is contained in:
33
e2e/tests/visual-a11y/a11y.visual.spec.js
Normal file
33
e2e/tests/visual-a11y/a11y.visual.spec.js
Normal file
@@ -0,0 +1,33 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
const { test, scanForA11yViolations } = require('../../avpFixtures');
|
||||
const VISUAL_URL = require('../../constants').VISUAL_URL;
|
||||
|
||||
test.describe('a11y - Default @a11y', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
test('main view @a11y', async ({ page }, testInfo) => {
|
||||
await scanForA11yViolations(page, testInfo.title);
|
||||
});
|
||||
});
|
||||
53
e2e/tests/visual-a11y/components/about.visual.spec.js
Normal file
53
e2e/tests/visual-a11y/components/about.visual.spec.js
Normal file
@@ -0,0 +1,53 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
Tests the branding associated with the default deployment. At least the about modal for now
|
||||
*/
|
||||
|
||||
const { test, expect } = require('../../../pluginFixtures');
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
const VISUAL_URL = require('../../../constants').VISUAL_URL;
|
||||
|
||||
test.describe('Visual - Branding', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
//Go to baseURL and Hide Tree
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
test('Visual - About Modal', async ({ page, theme }) => {
|
||||
// Click About button
|
||||
await page.click('.l-shell__app-logo');
|
||||
|
||||
// Modify the Build information in 'about' to be consistent run-over-run
|
||||
const versionInformationLocator = page.locator('ul.t-info.l-info.s-info').first();
|
||||
await expect(versionInformationLocator).toBeEnabled();
|
||||
await versionInformationLocator.evaluate(
|
||||
(node) =>
|
||||
(node.innerHTML =
|
||||
'<li>Version: visual-snapshot</li> <li>Build Date: Mon Nov 15 2021 08:07:51 GMT-0800 (Pacific Standard Time)</li> <li>Revision: 93049cdbc6c047697ca204893db9603b864b8c9f</li> <li>Branch: master</li>')
|
||||
);
|
||||
|
||||
// Take a snapshot of the About modal
|
||||
await percySnapshot(page, `About (theme: '${theme}')`);
|
||||
});
|
||||
});
|
||||
56
e2e/tests/visual-a11y/components/inspector.visual.spec.js
Normal file
56
e2e/tests/visual-a11y/components/inspector.visual.spec.js
Normal file
@@ -0,0 +1,56 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
const { test } = require('../../../pluginFixtures.js');
|
||||
const { VISUAL_URL, MISSION_TIME } = require('../../../constants.js');
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
|
||||
//Declare the scope of the visual test
|
||||
const inspectorPane = '.l-shell__pane-inspector';
|
||||
|
||||
test.describe('Visual - Controlled Clock', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
test.use({
|
||||
storageState: './e2e/test-data/overlay_plot_with_delay_storage.json',
|
||||
clockOptions: {
|
||||
now: MISSION_TIME,
|
||||
shouldAdvanceTime: true
|
||||
}
|
||||
});
|
||||
|
||||
test('Inspector from overlay_plot_with_delay_storage @localStorage', async ({ page, theme }) => {
|
||||
//Expand the Inspector Pane
|
||||
await page.getByRole('button', { name: 'Inspect' }).click();
|
||||
|
||||
await percySnapshot(page, `Inspector view of overlayPlot (theme: ${theme})`, {
|
||||
scope: inspectorPane
|
||||
});
|
||||
//Open Annotations Tab
|
||||
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||
|
||||
await percySnapshot(page, `Inspector view of Annotations Tab (theme: ${theme})`, {
|
||||
scope: inspectorPane
|
||||
});
|
||||
});
|
||||
});
|
||||
98
e2e/tests/visual-a11y/components/tree.visual.spec.js
Normal file
98
e2e/tests/visual-a11y/components/tree.visual.spec.js
Normal file
@@ -0,0 +1,98 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
const { test } = require('../../../pluginFixtures.js');
|
||||
const {
|
||||
expandTreePaneItemByName,
|
||||
createDomainObjectWithDefaults
|
||||
} = require('../../../appActions.js');
|
||||
const VISUAL_URL = require('../../../constants.js').VISUAL_URL;
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
|
||||
//Declare the scope of the visual test
|
||||
const treePane = "[role=tree][aria-label='Main Tree']";
|
||||
|
||||
test.describe('Visual - Tree Pane', () => {
|
||||
test('Tree pane in various states', async ({ page, theme, openmctConfig }) => {
|
||||
const { myItemsFolderName } = openmctConfig;
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
//Open Tree
|
||||
await page.getByRole('button', { name: 'Browse' }).click();
|
||||
|
||||
//Create a Folder Structure
|
||||
const foo = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Foo Folder'
|
||||
});
|
||||
|
||||
const bar = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Bar Folder',
|
||||
parent: foo.uuid
|
||||
});
|
||||
|
||||
const baz = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Folder',
|
||||
name: 'Baz Folder',
|
||||
parent: bar.uuid
|
||||
});
|
||||
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Clock',
|
||||
name: 'A Clock'
|
||||
});
|
||||
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Clock',
|
||||
name: 'Z Clock'
|
||||
});
|
||||
|
||||
await percySnapshot(page, `Tree Pane w/ collapsed tree (theme: ${theme})`, {
|
||||
scope: treePane
|
||||
});
|
||||
|
||||
await expandTreePaneItemByName(page, myItemsFolderName);
|
||||
|
||||
await page.goto(foo.url);
|
||||
await page.dragAndDrop('role=treeitem[name=/A Clock/]', '.c-object-view');
|
||||
await page.dragAndDrop('role=treeitem[name=/Z Clock/]', '.c-object-view');
|
||||
await page.goto(bar.url);
|
||||
await page.dragAndDrop('role=treeitem[name=/A Clock/]', '.c-object-view');
|
||||
await page.dragAndDrop('role=treeitem[name=/Z Clock/]', '.c-object-view');
|
||||
await page.goto(baz.url);
|
||||
await page.dragAndDrop('role=treeitem[name=/A Clock/]', '.c-object-view');
|
||||
await page.dragAndDrop('role=treeitem[name=/Z Clock/]', '.c-object-view');
|
||||
|
||||
await percySnapshot(page, `Tree Pane w/ single level expanded (theme: ${theme})`, {
|
||||
scope: treePane
|
||||
});
|
||||
|
||||
await expandTreePaneItemByName(page, foo.name);
|
||||
await expandTreePaneItemByName(page, bar.name);
|
||||
await expandTreePaneItemByName(page, baz.name);
|
||||
|
||||
await percySnapshot(page, `Tree Pane w/ multiple levels expanded (theme: ${theme})`, {
|
||||
scope: treePane
|
||||
});
|
||||
});
|
||||
});
|
||||
58
e2e/tests/visual-a11y/controlledClock.visual.spec.js
Normal file
58
e2e/tests/visual-a11y/controlledClock.visual.spec.js
Normal file
@@ -0,0 +1,58 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
Collection of Visual Tests set to run with browser clock manipulate made possible with the
|
||||
clockOptions plugin fixture.
|
||||
*/
|
||||
|
||||
const { VISUAL_URL, MISSION_TIME } = require('../../constants');
|
||||
const { test, expect } = require('../../pluginFixtures');
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
|
||||
test.describe('Visual - Controlled Clock', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
test.use({
|
||||
storageState: './e2e/test-data/overlay_plot_with_delay_storage.json',
|
||||
clockOptions: {
|
||||
now: MISSION_TIME,
|
||||
shouldAdvanceTime: false //Don't advance the clock
|
||||
}
|
||||
});
|
||||
|
||||
test('Overlay Plot Loading Indicator @localStorage', async ({ page, theme }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await page.locator('a').filter({ hasText: 'Overlay Plot with 5s Delay' }).click();
|
||||
//Ensure that we're on the Unnamed Overlay Plot object
|
||||
await expect(page.locator('.l-browse-bar__object-name')).toContainText(
|
||||
'Overlay Plot with 5s Delay'
|
||||
);
|
||||
|
||||
//Wait for canvas to be rendered and stop animating, but plot should not be loaded. Cannot use waitForPlotsToRender
|
||||
await page.locator('canvas >> nth=1').hover({ trial: true });
|
||||
|
||||
//Take snapshot of Sine Wave Generator within Overlay Plot
|
||||
await percySnapshot(page, `SineWaveInOverlayPlot (theme: '${theme}')`);
|
||||
});
|
||||
});
|
||||
105
e2e/tests/visual-a11y/defaultPlugins.visual.spec.js
Normal file
105
e2e/tests/visual-a11y/defaultPlugins.visual.spec.js
Normal file
@@ -0,0 +1,105 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
Collection of Visual Tests set to run in a default context with default Plugins. The tests within this suite
|
||||
are only meant to run against openmct's app.js started by `npm run start` within the
|
||||
`./e2e/playwright-visual.config.js` file.
|
||||
*/
|
||||
|
||||
const { test, expect, scanForA11yViolations } = require('../../avpFixtures');
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||
const { VISUAL_URL } = require('../../constants');
|
||||
|
||||
test.describe('Visual - Default @a11y', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
test('Visual - Default Dashboard', async ({ page, theme }) => {
|
||||
// Verify that Create button is actionable
|
||||
await expect(page.locator('button:has-text("Create")')).toBeEnabled();
|
||||
|
||||
// Take a snapshot of the Dashboard
|
||||
await percySnapshot(page, `Default Dashboard (theme: '${theme}')`);
|
||||
});
|
||||
|
||||
test('Visual - Default Condition Set', async ({ page, theme }) => {
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Condition Set',
|
||||
name: 'Default Condition Set'
|
||||
});
|
||||
|
||||
// Take a snapshot of the newly created Condition Set object
|
||||
await percySnapshot(page, `Default Condition Set (theme: '${theme}')`);
|
||||
});
|
||||
|
||||
test('Visual - Default Condition Widget', async ({ page, theme }) => {
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Condition Widget',
|
||||
name: 'Default Condition Widget'
|
||||
});
|
||||
|
||||
// Take a snapshot of the newly created Condition Widget object
|
||||
await percySnapshot(page, `Default Condition Widget (theme: '${theme}')`);
|
||||
});
|
||||
|
||||
test('Visual - Sine Wave Generator Form', async ({ page, theme }) => {
|
||||
//Click the Create button
|
||||
await page.click('button:has-text("Create")');
|
||||
|
||||
// Click text=Sine Wave Generator
|
||||
await page.click('text=Sine Wave Generator');
|
||||
|
||||
await percySnapshot(page, `Default Sine Wave Generator Form (theme: '${theme}')`);
|
||||
|
||||
await page.locator('.field.control.l-input-sm input').first().click();
|
||||
await page.locator('.field.control.l-input-sm input').first().fill('');
|
||||
|
||||
// Validate red x mark
|
||||
await percySnapshot(page, `removed amplitude property value (theme: '${theme}')`);
|
||||
});
|
||||
|
||||
test('Visual - Display Layout Icon is correct in Create Menu', async ({ page, theme }) => {
|
||||
// Click the Create button
|
||||
await page.click('button:has-text("Create")');
|
||||
|
||||
// Hover on Display Layout option.
|
||||
await page.locator('text=Display Layout').hover();
|
||||
await percySnapshot(page, `Display Layout Create Menu (theme: '${theme}')`);
|
||||
});
|
||||
|
||||
test('Visual - Default Gauge', async ({ page, theme }) => {
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Gauge',
|
||||
name: 'Default Gauge'
|
||||
});
|
||||
|
||||
// Take a snapshot of the newly created Gauge object
|
||||
await percySnapshot(page, `Default Gauge (theme: '${theme}')`);
|
||||
});
|
||||
|
||||
test.afterEach(async ({ page }, testInfo) => {
|
||||
await scanForA11yViolations(page, testInfo.title);
|
||||
});
|
||||
});
|
||||
156
e2e/tests/visual-a11y/displayLayout.visual.spec.js
Normal file
156
e2e/tests/visual-a11y/displayLayout.visual.spec.js
Normal file
@@ -0,0 +1,156 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Defines playwright locators that can be used in tests.
|
||||
* @typedef {Object} LayoutLocators
|
||||
* @property {Object<string, import('@playwright/test').Locator>} LayoutLocator
|
||||
*/
|
||||
|
||||
const { test } = require('../../pluginFixtures');
|
||||
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||
const VISUAL_URL = require('../../constants').VISUAL_URL;
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
const snapshotScope = '.l-shell__pane-main .l-pane__contents';
|
||||
|
||||
test.describe('Visual - Display Layout', () => {
|
||||
test('Resize Marquee surrounds selection', async ({ page, theme }) => {
|
||||
const baseline = await setupBaseline(page);
|
||||
const { child1LayoutLocator, child1LayoutObjectLocator } = baseline;
|
||||
|
||||
await percySnapshot(page, `Resize nested layout selected (theme: '${theme}')`, {
|
||||
scope: snapshotScope
|
||||
});
|
||||
|
||||
await child1LayoutLocator.click();
|
||||
await percySnapshot(page, `Resize new nested layout selected (theme: '${theme}')`, {
|
||||
scope: snapshotScope
|
||||
});
|
||||
|
||||
await child1LayoutObjectLocator.click();
|
||||
await percySnapshot(page, `Resize Object in nested layout selected (theme: '${theme}')`, {
|
||||
scope: snapshotScope
|
||||
});
|
||||
});
|
||||
|
||||
test('Parent layout of selection displays grid', async ({ page, theme }) => {
|
||||
const baseline = await setupBaseline(page);
|
||||
const { parentLayoutLocator, child1LayoutObjectLocator } = baseline;
|
||||
|
||||
await percySnapshot(page, `Parent nested layout selected (theme: '${theme}')`, {
|
||||
scope: snapshotScope
|
||||
});
|
||||
|
||||
await parentLayoutLocator.click();
|
||||
await percySnapshot(page, `Parent outer layout selected (theme: '${theme}')`, {
|
||||
scope: snapshotScope
|
||||
});
|
||||
|
||||
await child1LayoutObjectLocator.click();
|
||||
await percySnapshot(page, `Parent Object in nested layout selected (theme: '${theme}')`, {
|
||||
scope: snapshotScope
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Sets up a complex layout with nested layouts and provides the playwright locators
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @returns {LayoutLocators} locators of baseline complex display to be used in tests
|
||||
*/
|
||||
async function setupBaseline(page) {
|
||||
// Load Open MCT visual test baseline
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
// Open Tree
|
||||
await page.getByRole('button', { name: 'Browse' }).click();
|
||||
|
||||
const treePane = page.getByRole('tree', {
|
||||
name: 'Main Tree'
|
||||
});
|
||||
|
||||
const objectViewLocator = page.locator('.c-object-view');
|
||||
const parentLayoutLocator = objectViewLocator.first();
|
||||
const child1LayoutLocator = parentLayoutLocator.locator(objectViewLocator).first();
|
||||
const child1LayoutObjectLocator = child1LayoutLocator.locator('.l-layout__frame');
|
||||
const parentLayout = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Display Layout',
|
||||
name: 'Parent Layout'
|
||||
});
|
||||
const child1Layout = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Display Layout',
|
||||
name: 'Child 1 Layout'
|
||||
});
|
||||
const child2Layout = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Display Layout',
|
||||
name: 'Child 2 Layout'
|
||||
});
|
||||
const swg1 = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator',
|
||||
name: 'SWG 1'
|
||||
});
|
||||
const swg2 = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator',
|
||||
name: 'SWG 2'
|
||||
});
|
||||
const child1LayoutTreeItem = treePane.getByRole('treeitem', {
|
||||
name: new RegExp(child1Layout.name)
|
||||
});
|
||||
const child2LayoutTreeItem = treePane.getByRole('treeitem', {
|
||||
name: new RegExp(child2Layout.name)
|
||||
});
|
||||
const swg1TreeItem = treePane.getByRole('treeitem', {
|
||||
name: new RegExp(swg1.name)
|
||||
});
|
||||
const swg2TreeItem = treePane.getByRole('treeitem', {
|
||||
name: new RegExp(swg2.name)
|
||||
});
|
||||
|
||||
// Expand folder containing created objects
|
||||
await page.goto(parentLayout.url);
|
||||
await page.getByTitle('Show selected item in tree').click();
|
||||
|
||||
// Add swg1 to child1Layout
|
||||
await page.goto(child1Layout.url);
|
||||
await page.getByRole('button', { name: 'Edit' }).click();
|
||||
await swg1TreeItem.dragTo(parentLayoutLocator, { targetPosition: { x: 0, y: 0 } });
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||
|
||||
// Add swg1 to child1Layout
|
||||
await page.goto(child2Layout.url);
|
||||
await page.getByRole('button', { name: 'Edit' }).click();
|
||||
await swg2TreeItem.dragTo(parentLayoutLocator, { targetPosition: { x: 0, y: 0 } });
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||
|
||||
// Add child1Layout and child2Layout to parentLayout
|
||||
await page.goto(parentLayout.url);
|
||||
await page.getByRole('button', { name: 'Edit' }).click();
|
||||
await child1LayoutTreeItem.dragTo(parentLayoutLocator, { targetPosition: { x: 350, y: 0 } });
|
||||
await child2LayoutTreeItem.dragTo(parentLayoutLocator, { targetPosition: { x: 0, y: 0 } });
|
||||
|
||||
return {
|
||||
parentLayoutLocator,
|
||||
child1LayoutLocator,
|
||||
child1LayoutObjectLocator
|
||||
};
|
||||
}
|
||||
90
e2e/tests/visual-a11y/faultManagement.visual.spec.js
Normal file
90
e2e/tests/visual-a11y/faultManagement.visual.spec.js
Normal file
@@ -0,0 +1,90 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/* global __dirname */
|
||||
const path = require('path');
|
||||
const { test } = require('../../pluginFixtures');
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
|
||||
const utils = require('../../helper/faultUtils');
|
||||
|
||||
test.describe('Fault Management Visual Tests', () => {
|
||||
test('icon test', async ({ page, theme }) => {
|
||||
await page.addInitScript({
|
||||
path: path.join(__dirname, '../../helper/', 'addInitFaultManagementPlugin.js')
|
||||
});
|
||||
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await percySnapshot(page, `Fault Management icon appears in tree (theme: '${theme}')`);
|
||||
});
|
||||
|
||||
test('fault list and acknowledged faults', async ({ page, theme }) => {
|
||||
await utils.navigateToFaultManagementWithStaticExample(page);
|
||||
|
||||
await percySnapshot(page, `Shows a list of faults in the standard view (theme: '${theme}')`);
|
||||
|
||||
await utils.acknowledgeFault(page, 1);
|
||||
await utils.changeViewTo(page, 'acknowledged');
|
||||
|
||||
await percySnapshot(
|
||||
page,
|
||||
`Acknowledged faults, have a checkmark on the fault icon and appear in the acknowledged view (theme: '${theme}')`
|
||||
);
|
||||
});
|
||||
|
||||
test('shelved faults', async ({ page, theme }) => {
|
||||
await utils.navigateToFaultManagementWithStaticExample(page);
|
||||
|
||||
await utils.shelveFault(page, 1);
|
||||
await utils.changeViewTo(page, 'shelved');
|
||||
|
||||
await percySnapshot(page, `Shelved faults appear in the shelved view (theme: '${theme}')`);
|
||||
|
||||
await utils.openFaultRowMenu(page, 1);
|
||||
|
||||
await percySnapshot(
|
||||
page,
|
||||
`Shelved faults have a 3-dot menu with Unshelve option enabled (theme: '${theme}')`
|
||||
);
|
||||
});
|
||||
|
||||
test('3-dot menu for fault', async ({ page, theme }) => {
|
||||
await utils.navigateToFaultManagementWithStaticExample(page);
|
||||
|
||||
await utils.openFaultRowMenu(page, 1);
|
||||
|
||||
await percySnapshot(
|
||||
page,
|
||||
`Faults have a 3-dot menu with Acknowledge, Shelve and Unshelve (Unshelve is disabled) options (theme: '${theme}')`
|
||||
);
|
||||
});
|
||||
|
||||
test('ability to acknowledge or shelve', async ({ page, theme }) => {
|
||||
await utils.navigateToFaultManagementWithStaticExample(page);
|
||||
|
||||
await utils.selectFaultItem(page, 1);
|
||||
|
||||
await percySnapshot(
|
||||
page,
|
||||
`Selected faults highlight the ability to Acknowledge or Shelve above the fault list (theme: '${theme}')`
|
||||
);
|
||||
});
|
||||
});
|
||||
77
e2e/tests/visual-a11y/ladTable.visual.spec.js
Normal file
77
e2e/tests/visual-a11y/ladTable.visual.spec.js
Normal file
@@ -0,0 +1,77 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
const { expect, test } = require('../../pluginFixtures');
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||
const VISUAL_URL = require('../../constants').VISUAL_URL;
|
||||
|
||||
test.describe('Visual - LAD Table', () => {
|
||||
/** @type {import('@playwright/test').Locator} */
|
||||
let ladTable;
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
// Create LAD Table
|
||||
ladTable = await createDomainObjectWithDefaults(page, {
|
||||
type: 'LAD Table',
|
||||
name: 'LAD Table Test'
|
||||
});
|
||||
// Create SWG inside of LAD Table
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Sine Wave Generator',
|
||||
name: 'SWG4LAD Table Test',
|
||||
parent: ladTable.uuid
|
||||
});
|
||||
|
||||
//Modify SWG to create a really stable SWG
|
||||
await page.locator('button[title="More options"]').click();
|
||||
|
||||
await page.getByRole('menuitem', { name: ' Edit Properties...' }).click();
|
||||
|
||||
//Forgive me, padre
|
||||
await page.getByRole('spinbutton', { name: 'Data Rate (hz)' }).fill('0');
|
||||
await page.getByRole('spinbutton', { name: 'Period' }).fill('0');
|
||||
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
});
|
||||
test('Toggled column widths behave accordingly', async ({ page, theme }) => {
|
||||
await page.goto(ladTable.url);
|
||||
|
||||
await expect(page.locator('button[title="Expand Columns"]')).toBeVisible();
|
||||
|
||||
await percySnapshot(
|
||||
page,
|
||||
`LAD Table w/ Sine Wave Generator columns autosized (theme: ${theme})`
|
||||
);
|
||||
|
||||
await page.locator('button[title="Expand Columns"]').click();
|
||||
|
||||
await expect(page.locator('button[title="Autosize Columns"]')).toBeVisible();
|
||||
|
||||
await percySnapshot(
|
||||
page,
|
||||
`LAD Table w/ Sine Wave Generator columns expanded (theme: ${theme})`
|
||||
);
|
||||
});
|
||||
});
|
||||
133
e2e/tests/visual-a11y/notebook.visual.spec.js
Normal file
133
e2e/tests/visual-a11y/notebook.visual.spec.js
Normal file
@@ -0,0 +1,133 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
const { test, scanForA11yViolations } = require('../../avpFixtures');
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
const { expandTreePaneItemByName, createDomainObjectWithDefaults } = require('../../appActions');
|
||||
const {
|
||||
startAndAddRestrictedNotebookObject,
|
||||
enterTextEntry
|
||||
} = require('../../helper/notebookUtils');
|
||||
const { VISUAL_URL } = require('../../constants');
|
||||
|
||||
test.describe('Visual - Restricted Notebook', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
const restrictedNotebook = await startAndAddRestrictedNotebookObject(page);
|
||||
await page.goto(restrictedNotebook.url + '?hideTree=true&hideInspector=true');
|
||||
});
|
||||
|
||||
test('Restricted Notebook is visually correct @addInit', async ({ page, theme }) => {
|
||||
// Take a snapshot of the newly created CUSTOM_NAME notebook
|
||||
await percySnapshot(page, `Restricted Notebook with CUSTOM_NAME (theme: '${theme}')`);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Visual - Notebook', () => {
|
||||
let notebook;
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
notebook = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Notebook',
|
||||
name: 'Test Notebook'
|
||||
});
|
||||
});
|
||||
test('Accepts dropped objects as embeds', async ({ page, theme, openmctConfig }) => {
|
||||
const { myItemsFolderName } = openmctConfig;
|
||||
|
||||
// Create Overlay Plot
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Overlay Plot',
|
||||
name: 'Dropped Overlay Plot'
|
||||
});
|
||||
|
||||
//Open Tree to perform drag
|
||||
await page.getByRole('button', { name: 'Browse' }).click();
|
||||
|
||||
await expandTreePaneItemByName(page, myItemsFolderName);
|
||||
|
||||
await page.goto(notebook.url);
|
||||
|
||||
await page.dragAndDrop('role=treeitem[name=/Dropped Overlay Plot/]', '.c-notebook__drag-area');
|
||||
|
||||
await percySnapshot(page, `Notebook w/ dropped embed (theme: ${theme})`);
|
||||
});
|
||||
test("Blur 'Add tag' on Notebook", async ({ page, theme }) => {
|
||||
await enterTextEntry(page, 'Entry 0');
|
||||
|
||||
await percySnapshot(page, `Notebook Entry (theme: '${theme}')`);
|
||||
|
||||
// Open the Inspector
|
||||
await page.getByRole('button', { name: 'Inspect' }).click();
|
||||
// Open the Annotations tab
|
||||
await page.getByRole('tab', { name: 'Annotations' }).click();
|
||||
|
||||
// Take snapshot of the notebook with the Annotations tab opened
|
||||
await percySnapshot(page, `Notebook Annotation (theme: '${theme}')`);
|
||||
|
||||
// Add annotation
|
||||
await page.locator('button:has-text("Add Tag")').click();
|
||||
|
||||
// Take snapshot of the notebook with the AutoComplete field visible
|
||||
await percySnapshot(page, `Notebook Add Tag (theme: '${theme}')`);
|
||||
|
||||
// Click inside the AutoComplete field
|
||||
await page.locator('[placeholder="Type to select tag"]').click();
|
||||
|
||||
// Click on the "Tags" header (simulating a click outside the autocomplete field)
|
||||
await page.locator('div.c-inspect-properties__header:has-text("Tags")').click();
|
||||
|
||||
// Take snapshot of the notebook with the AutoComplete field hidden and with the "Add Tag" button visible
|
||||
await percySnapshot(page, `Notebook Annotation de-select blur (theme: '${theme}')`);
|
||||
});
|
||||
test('Visual check of entry hover and selection', async ({ page, theme }) => {
|
||||
// Make two entries so we can test an unselected entry
|
||||
await enterTextEntry(page, 'Entry 0');
|
||||
await enterTextEntry(page, 'Entry 1');
|
||||
|
||||
// Hover the first entry
|
||||
await page.getByText('Entry 0').hover();
|
||||
|
||||
// Take a snapshot
|
||||
await percySnapshot(page, `Notebook Non-selected Entry Hover (theme: '${theme}')`);
|
||||
|
||||
// Click the first entry
|
||||
await page.getByText('Entry 0').click();
|
||||
|
||||
// Take a snapshot
|
||||
await percySnapshot(page, `Notebook Selected Entry Hover (theme: '${theme}')`);
|
||||
|
||||
// Hover the text entry area
|
||||
await page.getByText('Entry 0').hover();
|
||||
|
||||
// Take a snapshot
|
||||
await percySnapshot(page, `Notebook Selected Entry Text Area Hover (theme: '${theme}')`);
|
||||
|
||||
// Click the text entry area
|
||||
await page.getByText('Entry 0').click();
|
||||
|
||||
// Take a snapshot
|
||||
await percySnapshot(page, `Notebook Selected Entry Text Area Active (theme: '${theme}')`);
|
||||
});
|
||||
test.afterEach(async ({ page }, testInfo) => {
|
||||
await scanForA11yViolations(page, testInfo.title);
|
||||
});
|
||||
});
|
||||
65
e2e/tests/visual-a11y/notification.visual.spec.js
Normal file
65
e2e/tests/visual-a11y/notification.visual.spec.js
Normal file
@@ -0,0 +1,65 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* This test is dedicated to test notification banner functionality and its accessibility attributes.
|
||||
*/
|
||||
|
||||
const { test, expect, scanForA11yViolations } = require('../../avpFixtures');
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||
const VISUAL_URL = require('../../constants').VISUAL_URL;
|
||||
|
||||
test.describe("Visual - Check Notification Info Banner of 'Save successful' @a11y", () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
test("Create a clock, click on 'Save successful' banner and dismiss it", async ({
|
||||
page,
|
||||
theme
|
||||
}) => {
|
||||
// Create a clock domain object
|
||||
await createDomainObjectWithDefaults(page, {
|
||||
type: 'Clock',
|
||||
name: 'Default Clock'
|
||||
});
|
||||
// Click on the div with role="alert" that has "Save successful" text
|
||||
await page.locator('div[role="alert"]:has-text("Save successful")').click();
|
||||
// Verify there is a div with role="dialog"
|
||||
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(true);
|
||||
// Verify the div with role="dialog" contains text "Save successful"
|
||||
expect(await page.locator('div[role="dialog"]').innerText()).toContain('Save successful');
|
||||
await percySnapshot(page, `Notification banner shows Save successful (theme: '${theme}')`);
|
||||
// Verify there is a button with text "Dismiss"
|
||||
expect(await page.locator('button:has-text("Dismiss")').isVisible()).toBe(true);
|
||||
await percySnapshot(page, `Notification banner shows Dismiss (theme: '${theme}')`);
|
||||
// Click on button with text "Dismiss"
|
||||
await page.locator('button:has-text("Dismiss")').click();
|
||||
// Verify there is no div with role="dialog"
|
||||
expect(await page.locator('div[role="dialog"]').isVisible()).toBe(false);
|
||||
await percySnapshot(page, `Notification banner dismissed (theme: '${theme}')`);
|
||||
});
|
||||
test.afterEach(async ({ page }, testInfo) => {
|
||||
await scanForA11yViolations(page, testInfo.title);
|
||||
});
|
||||
});
|
||||
103
e2e/tests/visual-a11y/planning.visual.spec.js
Normal file
103
e2e/tests/visual-a11y/planning.visual.spec.js
Normal file
@@ -0,0 +1,103 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
const { test, scanForA11yViolations } = require('../../avpFixtures');
|
||||
const {
|
||||
setBoundsToSpanAllActivities,
|
||||
setDraftStatusForPlan
|
||||
} = require('../../helper/planningUtils');
|
||||
const { createDomainObjectWithDefaults, createPlanFromJSON } = require('../../appActions');
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
const VISUAL_URL = require('../../constants').VISUAL_URL;
|
||||
const examplePlanSmall = require('../../test-data/examplePlans/ExamplePlan_Small2.json');
|
||||
|
||||
const snapshotScope = '.l-shell__pane-main .l-pane__contents';
|
||||
|
||||
test.describe('Visual - Planning @a11y', () => {
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
});
|
||||
|
||||
test('Plan View', async ({ page, theme }) => {
|
||||
const plan = await createPlanFromJSON(page, {
|
||||
name: 'Plan Visual Test',
|
||||
json: examplePlanSmall
|
||||
});
|
||||
|
||||
await setBoundsToSpanAllActivities(page, examplePlanSmall, plan.url);
|
||||
await percySnapshot(page, `Plan View (theme: ${theme})`, {
|
||||
scope: snapshotScope
|
||||
});
|
||||
});
|
||||
|
||||
test('Plan View w/ draft status', async ({ page, theme }) => {
|
||||
const plan = await createPlanFromJSON(page, {
|
||||
name: 'Plan Visual Test (Draft)',
|
||||
json: examplePlanSmall
|
||||
});
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
await setDraftStatusForPlan(page, plan);
|
||||
|
||||
await setBoundsToSpanAllActivities(page, examplePlanSmall, plan.url);
|
||||
await percySnapshot(page, `Plan View w/ draft status (theme: ${theme})`, {
|
||||
scope: snapshotScope
|
||||
});
|
||||
});
|
||||
|
||||
test('Gantt Chart View', async ({ page, theme }) => {
|
||||
const ganttChart = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Gantt Chart',
|
||||
name: 'Gantt Chart Visual Test'
|
||||
});
|
||||
await createPlanFromJSON(page, {
|
||||
json: examplePlanSmall,
|
||||
parent: ganttChart.uuid
|
||||
});
|
||||
await setBoundsToSpanAllActivities(page, examplePlanSmall, ganttChart.url);
|
||||
await percySnapshot(page, `Gantt Chart View (theme: ${theme})`, {
|
||||
scope: snapshotScope
|
||||
});
|
||||
});
|
||||
|
||||
test('Gantt Chart View w/ draft status', async ({ page, theme }) => {
|
||||
const ganttChart = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Gantt Chart',
|
||||
name: 'Gantt Chart Visual Test (Draft)'
|
||||
});
|
||||
const plan = await createPlanFromJSON(page, {
|
||||
json: examplePlanSmall,
|
||||
parent: ganttChart.uuid
|
||||
});
|
||||
|
||||
await setDraftStatusForPlan(page, plan);
|
||||
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
await setBoundsToSpanAllActivities(page, examplePlanSmall, ganttChart.url);
|
||||
await percySnapshot(page, `Gantt Chart View w/ draft status (theme: ${theme})`, {
|
||||
scope: snapshotScope
|
||||
});
|
||||
});
|
||||
test.afterEach(async ({ page }, testInfo) => {
|
||||
await scanForA11yViolations(page, testInfo.title);
|
||||
});
|
||||
});
|
||||
105
e2e/tests/visual-a11y/search.visual.spec.js
Normal file
105
e2e/tests/visual-a11y/search.visual.spec.js
Normal file
@@ -0,0 +1,105 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2023, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
* Open MCT includes source code licensed under additional open source
|
||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
This test suite is dedicated to tests which verify search functionality.
|
||||
*/
|
||||
|
||||
const { test, expect, scanForA11yViolations } = require('../../avpFixtures');
|
||||
const { createDomainObjectWithDefaults } = require('../../appActions');
|
||||
const { VISUAL_URL } = require('../../constants');
|
||||
|
||||
const percySnapshot = require('@percy/playwright');
|
||||
|
||||
test.describe('Grand Search @a11y', () => {
|
||||
let conditionWidget;
|
||||
let displayLayout;
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
||||
|
||||
displayLayout = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Display Layout',
|
||||
name: 'Visual Test Display Layout'
|
||||
});
|
||||
|
||||
conditionWidget = await createDomainObjectWithDefaults(page, {
|
||||
type: 'Condition Widget',
|
||||
name: 'Visual Condition Widget',
|
||||
parent: displayLayout.uuid
|
||||
});
|
||||
});
|
||||
|
||||
test('Can search for folder object, and subsequent search dropdown behaves properly', async ({
|
||||
page,
|
||||
theme
|
||||
}) => {
|
||||
// Navigate to display layout
|
||||
await page.goto(displayLayout.url);
|
||||
|
||||
// Search for the object
|
||||
await page.getByRole('searchbox', { name: 'Search Input' }).click();
|
||||
await page.getByRole('searchbox', { name: 'Search Input' }).fill(conditionWidget.name);
|
||||
await expect(page.getByLabel('Search Result').getByText(conditionWidget.name)).toBeVisible();
|
||||
|
||||
//Searching for an object returns that object in the grandsearch
|
||||
await percySnapshot(page, `Searching for Object (theme: '${theme}')`);
|
||||
|
||||
// Enter Edit mode on the Display Layout
|
||||
await page.getByRole('button', { name: 'Edit' }).click();
|
||||
|
||||
// Navigate to the object while in edit mode on the display layout
|
||||
await page.getByRole('searchbox', { name: 'Search Input' }).click();
|
||||
await page.getByLabel('Search Result').getByText(conditionWidget.name).click();
|
||||
|
||||
await percySnapshot(
|
||||
page,
|
||||
`Preview should display when editing enabled and search item clicked (theme: '${theme}')`
|
||||
);
|
||||
|
||||
// Close the preview
|
||||
await page.getByRole('button', { name: 'Close' }).click();
|
||||
await percySnapshot(
|
||||
page,
|
||||
`Search should still be showing after preview closed (theme: '${theme}')`
|
||||
);
|
||||
|
||||
// Save and finish editing the Display Layout
|
||||
await page.getByRole('button', { name: 'Save' }).click();
|
||||
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
|
||||
|
||||
// Search for the object
|
||||
await page.getByRole('searchbox', { name: 'Search Input' }).click();
|
||||
await page.getByRole('searchbox', { name: 'Search Input' }).fill(conditionWidget.name);
|
||||
await expect(page.getByLabel('Search Result').getByText(conditionWidget.name)).toBeVisible();
|
||||
|
||||
// Navigate to the object while not in edit mode on the display layout
|
||||
await page.getByLabel('Search Result').getByText(conditionWidget.name).click();
|
||||
|
||||
await percySnapshot(
|
||||
page,
|
||||
`Clicking on search results should navigate to them if not editing (theme: '${theme}')`
|
||||
);
|
||||
});
|
||||
test.afterEach(async ({ page }, testInfo) => {
|
||||
await scanForA11yViolations(page, testInfo.title);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user