[e2e][couchdb] Add test coverage for mct5616 (#5913)

* [e2e][couchdb] Add test for mct5616

- Add test to verify that modifying object properties generates a single persistence operation with CouchDB

* [e2e] Poll for 1 sec to allow time for request

* [e2e] ignore expected console error

* add comments

* add `aria-label`s to form select fields

* add `aria-label` for clock format select

* [e2e] Improve selector

* make property name less ambiguous

* refactor(e2e): use default object name
This commit is contained in:
Jesse Mazzella 2022-11-07 16:04:02 -08:00 committed by GitHub
parent d545124942
commit 4b14d2d6d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 0 deletions

View File

@ -25,6 +25,7 @@ This test suite is dedicated to tests which verify form functionality in isolati
*/
const { test, expect } = require('../../baseFixtures');
const { createDomainObjectWithDefaults } = require('../../appActions');
const path = require('path');
const TEST_FOLDER = 'test folder';
@ -91,6 +92,44 @@ test.describe('Persistence operations @addInit', () => {
});
});
test.describe('Persistence operations @couchdb', () => {
test.use({ failOnConsoleError: false });
test('Editing object properties should generate a single persistence operation', async ({ page }) => {
test.info().annotations.push({
type: 'issue',
description: 'https://github.com/nasa/openmct/issues/5616'
});
await page.goto('./', { waitUntil: 'networkidle' });
// Create a new 'Clock' object with default settings
const clock = await createDomainObjectWithDefaults(page, {
type: 'Clock'
});
// Count all persistence operations (PUT requests) for this specific object
let putRequestCount = 0;
page.on('request', req => {
if (req.method() === 'PUT' && req.url().endsWith(clock.uuid)) {
putRequestCount += 1;
}
});
// Open the edit form for the clock object
await page.click('button[title="More options"]');
await page.click('li[title="Edit properties of this object."]');
// Modify the display format from default 12hr -> 24hr and click 'Save'
await page.locator('select[aria-label="12 or 24 hour clock"]').selectOption({ value: 'clock24' });
await page.click('button[aria-label="Save"]');
await expect.poll(() => putRequestCount, {
message: 'Verify a single PUT request was made to persist the object',
timeout: 1000
}).toEqual(1);
});
});
test.describe('Form Correctness by Object Type', () => {
test.fixme('Verify correct behavior of number object (SWG)', async ({page}) => {});
test.fixme('Verify correct behavior of number object Timer', async ({page}) => {});

View File

@ -26,6 +26,7 @@
v-model="selected"
required="model.required"
name="mctControl"
:aria-label="model.ariaLabel || model.name"
@change="onChange($event)"
>
<option

View File

@ -68,6 +68,7 @@ export default function ClockPlugin(options) {
]
},
{
ariaLabel: "12 or 24 hour clock",
control: 'select',
options: [
{