2023-01-14 02:12:08 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2024-01-02 15:24:22 +00:00
|
|
|
import percySnapshot from '@percy/playwright';
|
|
|
|
|
|
|
|
import { createDomainObjectWithDefaults } from '../../appActions.js';
|
|
|
|
import { expect, scanForA11yViolations, test } from '../../avpFixtures.js';
|
|
|
|
import { VISUAL_URL } from '../../constants.js';
|
2023-01-14 02:12:08 +00:00
|
|
|
|
2023-12-19 22:16:08 +00:00
|
|
|
test.describe("Visual - Check Notification Info Banner of 'Save successful' @a11y", () => {
|
2023-01-14 02:12:08 +00:00
|
|
|
test.beforeEach(async ({ page }) => {
|
2023-09-11 23:33:46 +00:00
|
|
|
await page.goto(VISUAL_URL, { waitUntil: 'domcontentloaded' });
|
2023-01-14 02:12:08 +00:00
|
|
|
});
|
|
|
|
|
2023-04-13 17:02:56 +00:00
|
|
|
test("Create a clock, click on 'Save successful' banner and dismiss it", async ({
|
|
|
|
page,
|
|
|
|
theme
|
|
|
|
}) => {
|
2023-01-14 02:12:08 +00:00
|
|
|
// Create a clock domain object
|
2023-08-12 00:18:08 +00:00
|
|
|
await createDomainObjectWithDefaults(page, {
|
|
|
|
type: 'Clock',
|
|
|
|
name: 'Default Clock'
|
|
|
|
});
|
2023-01-14 02:12:08 +00:00
|
|
|
// Click on the div with role="alert" that has "Save successful" text
|
2024-01-08 19:29:01 +00:00
|
|
|
await page.getByRole('alert').filter({ hasText: 'Save successful' }).click();
|
2023-01-14 02:12:08 +00:00
|
|
|
// Verify there is a div with role="dialog"
|
2024-01-08 19:29:01 +00:00
|
|
|
await expect(page.getByRole('dialog', { name: 'Overlay' })).toBeVisible();
|
2023-01-14 02:12:08 +00:00
|
|
|
// Verify the div with role="dialog" contains text "Save successful"
|
2024-01-08 19:29:01 +00:00
|
|
|
expect(await page.getByRole('dialog', { name: 'Overlay' }).innerText()).toContain(
|
|
|
|
'Save successful'
|
|
|
|
);
|
2023-08-12 00:18:08 +00:00
|
|
|
await percySnapshot(page, `Notification banner shows Save successful (theme: '${theme}')`);
|
2023-01-14 02:12:08 +00:00
|
|
|
// Verify there is a button with text "Dismiss"
|
2024-01-08 19:29:01 +00:00
|
|
|
await expect(page.getByText('Dismiss', { exact: true })).toBeVisible();
|
2023-08-12 00:18:08 +00:00
|
|
|
await percySnapshot(page, `Notification banner shows Dismiss (theme: '${theme}')`);
|
2023-01-14 02:12:08 +00:00
|
|
|
// Click on button with text "Dismiss"
|
2024-01-08 19:29:01 +00:00
|
|
|
await page.getByText('Dismiss', { exact: true }).click();
|
2023-01-14 02:12:08 +00:00
|
|
|
// Verify there is no div with role="dialog"
|
2024-01-08 19:29:01 +00:00
|
|
|
await expect(page.getByRole('dialog', { name: 'Overlay' })).toBeHidden();
|
2023-08-12 00:18:08 +00:00
|
|
|
await percySnapshot(page, `Notification banner dismissed (theme: '${theme}')`);
|
2023-01-14 02:12:08 +00:00
|
|
|
});
|
2023-12-19 22:16:08 +00:00
|
|
|
test.afterEach(async ({ page }, testInfo) => {
|
|
|
|
await scanForA11yViolations(page, testInfo.title);
|
|
|
|
});
|
2023-01-14 02:12:08 +00:00
|
|
|
});
|