mirror of
https://github.com/nasa/openmct.git
synced 2024-12-24 07:16:39 +00:00
Added visual test for capturing the Save Successful Banner (#5237)
Co-authored-by: John Hill <john.c.hill@nasa.gov>
This commit is contained in:
parent
9f9c69ee68
commit
17c16eba50
@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
||||||
const config = {
|
const config = {
|
||||||
retries: 0,
|
retries: 0, // visual tests should never retry due to snapshot comparison errors
|
||||||
testDir: 'tests',
|
testDir: 'tests/visual',
|
||||||
timeout: 90 * 1000,
|
timeout: 90 * 1000,
|
||||||
workers: 1,
|
workers: 1, // visual tests should never run in parallel due to test pollution
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'npm run start',
|
command: 'npm run start',
|
||||||
port: 8080,
|
port: 8080,
|
||||||
@ -17,7 +17,7 @@ const config = {
|
|||||||
use: {
|
use: {
|
||||||
browserName: "chromium",
|
browserName: "chromium",
|
||||||
baseURL: 'http://localhost:8080/',
|
baseURL: 'http://localhost:8080/',
|
||||||
headless: true,
|
headless: true, // this needs to remain headless to avoid visual changes due to GPU
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
screenshot: 'on',
|
screenshot: 'on',
|
||||||
trace: 'off',
|
trace: 'off',
|
||||||
@ -25,8 +25,7 @@ const config = {
|
|||||||
},
|
},
|
||||||
reporter: [
|
reporter: [
|
||||||
['list'],
|
['list'],
|
||||||
['junit', { outputFile: 'test-results/results.xml' }],
|
['junit', { outputFile: 'test-results/results.xml' }]
|
||||||
['allure-playwright']
|
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,7 +47,10 @@ test.beforeEach(async ({ context }) => {
|
|||||||
path: path.join(__dirname, '../../..', './node_modules/sinon/pkg/sinon.js')
|
path: path.join(__dirname, '../../..', './node_modules/sinon/pkg/sinon.js')
|
||||||
});
|
});
|
||||||
await context.addInitScript(() => {
|
await context.addInitScript(() => {
|
||||||
window.__clock = sinon.useFakeTimers(); //Set browser clock to UNIX Epoch
|
window.__clock = sinon.useFakeTimers({
|
||||||
|
now: 0,
|
||||||
|
shouldAdvanceTime: true
|
||||||
|
}); //Set browser clock to UNIX Epoch
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -171,3 +174,24 @@ test('Visual - Sine Wave Generator Form', async ({ page }) => {
|
|||||||
await page.waitForTimeout(VISUAL_GRACE_PERIOD);
|
await page.waitForTimeout(VISUAL_GRACE_PERIOD);
|
||||||
await percySnapshot(page, 'removed amplitude property value');
|
await percySnapshot(page, 'removed amplitude property value');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Visual - Save Successful Banner', async ({ page }) => {
|
||||||
|
//Go to baseURL
|
||||||
|
await page.goto('/', { waitUntil: 'networkidle' });
|
||||||
|
|
||||||
|
//Click the Create button
|
||||||
|
await page.click('button:has-text("Create")');
|
||||||
|
|
||||||
|
//NOTE Something other than example imagery
|
||||||
|
await page.click('text=Timer');
|
||||||
|
|
||||||
|
// Click text=OK
|
||||||
|
await page.click('text=OK');
|
||||||
|
await page.locator('.c-message-banner__message').hover({ trial: true });
|
||||||
|
await percySnapshot(page, 'Banner message shown');
|
||||||
|
|
||||||
|
//Wait until Save Banner is gone
|
||||||
|
await page.waitForSelector('.c-message-banner__message', { state: 'detached'});
|
||||||
|
await percySnapshot(page, 'Banner message gone');
|
||||||
|
|
||||||
|
});
|
||||||
|
@ -95,7 +95,7 @@
|
|||||||
"test:e2e:ci": "npx playwright test --config=e2e/playwright-ci.config.js --project=chrome smoke default condition timeConductor branding clock exampleImagery",
|
"test:e2e:ci": "npx playwright test --config=e2e/playwright-ci.config.js --project=chrome smoke default condition timeConductor branding clock exampleImagery",
|
||||||
"test:e2e:local": "npx playwright test --config=e2e/playwright-local.config.js --project=chrome",
|
"test:e2e:local": "npx playwright test --config=e2e/playwright-local.config.js --project=chrome",
|
||||||
"test:e2e:updatesnapshots": "npx playwright test --config=e2e/playwright-local.config.js --project=chrome --grep @snapshot --update-snapshots",
|
"test:e2e:updatesnapshots": "npx playwright test --config=e2e/playwright-local.config.js --project=chrome --grep @snapshot --update-snapshots",
|
||||||
"test:e2e:visual": "percy exec --config ./e2e/.percy.yml -- npx playwright test --config=e2e/playwright-visual.config.js default",
|
"test:e2e:visual": "percy exec --config ./e2e/.percy.yml -- npx playwright test --config=e2e/playwright-visual.config.js",
|
||||||
"test:e2e:full": "npx playwright test --config=e2e/playwright-ci.config.js",
|
"test:e2e:full": "npx playwright test --config=e2e/playwright-ci.config.js",
|
||||||
"test:watch": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --no-single-run",
|
"test:watch": "cross-env NODE_OPTIONS=\"--max_old_space_size=4096\" karma start --no-single-run",
|
||||||
"jsdoc": "jsdoc -c jsdoc.json -R API.md -r -d dist/docs/api",
|
"jsdoc": "jsdoc -c jsdoc.json -R API.md -r -d dist/docs/api",
|
||||||
|
Loading…
Reference in New Issue
Block a user