2022-03-16 21:53:58 +00:00
|
|
|
/*****************************************************************************
|
2024-01-09 21:31:51 +00:00
|
|
|
* Open MCT, Copyright (c) 2014-2024, United States Government
|
2022-03-16 21:53:58 +00:00
|
|
|
* 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 the basic operations surrounding conditionSets.
|
|
|
|
*/
|
|
|
|
|
2024-01-02 15:24:22 +00:00
|
|
|
import { expect, test } from '../../../../baseFixtures.js';
|
2022-03-16 21:53:58 +00:00
|
|
|
|
|
|
|
test.describe('Sine Wave Generator', () => {
|
2022-06-30 18:50:47 +00:00
|
|
|
test('Create new Sine Wave Generator Object and validate create Form Logic', async ({
|
|
|
|
page,
|
|
|
|
browserName
|
|
|
|
}) => {
|
2022-08-24 19:31:26 +00:00
|
|
|
// eslint-disable-next-line playwright/no-skipped-test
|
|
|
|
test.skip(browserName === 'firefox', 'This test needs to be updated to work with firefox');
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
//Go to baseURL
|
2023-04-18 22:32:29 +00:00
|
|
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
//Click the Create button
|
|
|
|
await page.click('button:has-text("Create")');
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Click Sine Wave Generator
|
|
|
|
await page.click('text=Sine Wave Generator');
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Verify that the each required field has required indicator
|
|
|
|
// Title
|
2022-06-30 18:50:47 +00:00
|
|
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/req/);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Verify that the Notes row does not have a required indicator
|
|
|
|
await expect(
|
|
|
|
page.locator('.c-form__section div:nth-child(3) .form-row .c-form-row__state-indicator')
|
|
|
|
).not.toContain('.req');
|
2022-06-30 18:50:47 +00:00
|
|
|
await page.locator('textarea[type="text"]').fill('Optional Note Text');
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Period
|
2022-06-30 18:50:47 +00:00
|
|
|
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(/req/);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Amplitude
|
2022-06-30 18:50:47 +00:00
|
|
|
await expect(page.locator('div:nth-child(5) .c-form-row__state-indicator')).toHaveClass(/req/);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Offset
|
2022-06-30 18:50:47 +00:00
|
|
|
await expect(page.locator('div:nth-child(6) .c-form-row__state-indicator')).toHaveClass(/req/);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Data Rate
|
2022-06-30 18:50:47 +00:00
|
|
|
await expect(page.locator('div:nth-child(7) .c-form-row__state-indicator')).toHaveClass(/req/);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Phase
|
2022-06-30 18:50:47 +00:00
|
|
|
await expect(page.locator('div:nth-child(8) .c-form-row__state-indicator')).toHaveClass(/req/);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Randomness
|
2022-06-30 18:50:47 +00:00
|
|
|
await expect(page.locator('div:nth-child(9) .c-form-row__state-indicator')).toHaveClass(/req/);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Verify that by removing value from required text field shows invalid indicator
|
|
|
|
await page
|
|
|
|
.locator(
|
|
|
|
'text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]'
|
2023-05-18 21:54:46 +00:00
|
|
|
)
|
2022-03-16 21:53:58 +00:00
|
|
|
.fill('');
|
2022-06-30 18:50:47 +00:00
|
|
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/invalid/);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Verify that by adding value to empty required text field changes invalid to valid indicator
|
2022-06-30 18:50:47 +00:00
|
|
|
await page
|
|
|
|
.locator(
|
|
|
|
'text=Properties Title Notes Period Amplitude Offset Data Rate (hz) Phase (radians) Ra >> input[type="text"]'
|
2023-05-18 21:54:46 +00:00
|
|
|
)
|
2022-06-30 18:50:47 +00:00
|
|
|
.fill('New Sine Wave Generator');
|
|
|
|
await expect(page.locator('.c-form-row__state-indicator').first()).toHaveClass(/valid/);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Verify that by removing value from required number field shows invalid indicator
|
|
|
|
await page.locator('.field.control.l-input-sm input').first().fill('');
|
2022-06-30 18:50:47 +00:00
|
|
|
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(
|
|
|
|
/invalid/
|
|
|
|
);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Verify that by adding value to empty required number field changes invalid to valid indicator
|
|
|
|
await page.locator('.field.control.l-input-sm input').first().fill('3');
|
2022-06-30 18:50:47 +00:00
|
|
|
await expect(page.locator('div:nth-child(4) .c-form-row__state-indicator')).toHaveClass(
|
|
|
|
/valid/
|
|
|
|
);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Verify that can change value of number field by up/down arrows keys
|
|
|
|
// Click .field.control.l-input-sm input >> nth=0
|
|
|
|
await page.locator('.field.control.l-input-sm input').first().click();
|
|
|
|
// Press ArrowUp 3 times to change value from 3 to 6
|
|
|
|
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
|
|
|
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
|
|
|
await page.locator('.field.control.l-input-sm input').first().press('ArrowUp');
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
const value = await page.locator('.field.control.l-input-sm input').first().inputValue();
|
|
|
|
await expect(value).toBe('6');
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
//Click text=OK
|
2022-11-07 23:50:33 +00:00
|
|
|
await Promise.all([page.waitForNavigation(), page.click('button:has-text("OK")')]);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-16 21:53:58 +00:00
|
|
|
// Verify that the Sine Wave Generator is displayed and correct
|
|
|
|
// Verify object properties
|
|
|
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText(
|
|
|
|
'New Sine Wave Generator'
|
|
|
|
);
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-06-30 18:50:47 +00:00
|
|
|
// Verify canvas rendered and can be interacted with
|
2022-03-16 21:53:58 +00:00
|
|
|
await page
|
|
|
|
.locator('canvas')
|
|
|
|
.nth(1)
|
|
|
|
.click({
|
|
|
|
position: {
|
|
|
|
x: 341,
|
|
|
|
y: 28
|
|
|
|
}
|
|
|
|
});
|
2023-05-18 21:54:46 +00:00
|
|
|
|
2022-03-25 16:13:10 +00:00
|
|
|
// Verify that where we click on canvas shows the number we clicked on
|
2022-03-28 18:20:55 +00:00
|
|
|
// Note that any number will do, we just care that a number exists
|
|
|
|
await expect(page.locator('.value-to-display-nearestValue')).toContainText(
|
|
|
|
/[+-]?([0-9]*[.])?[0-9]+/
|
|
|
|
);
|
2022-03-16 21:53:58 +00:00
|
|
|
});
|
|
|
|
});
|