2021-12-20 20:01:16 +00:00
|
|
|
/*****************************************************************************
|
2022-01-18 19:27:28 +00:00
|
|
|
* Open MCT, Copyright (c) 2014-2022, United States Government
|
2021-12-20 20:01:16 +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.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
2022-05-03 18:09:12 +00:00
|
|
|
This test suite is dedicated to tests which verify the basic operations surrounding conditionSets. Note: this
|
|
|
|
suite is sharing state between tests which is considered an anti-pattern. Implimenting in this way to
|
|
|
|
demonstrate some playwright for test developers. This pattern should not be re-used in other CRUD suites.
|
2021-12-20 20:01:16 +00:00
|
|
|
*/
|
|
|
|
|
2022-05-13 17:55:34 +00:00
|
|
|
const { test } = require('../../../fixtures.js');
|
|
|
|
const { expect } = require('@playwright/test');
|
2021-12-20 20:01:16 +00:00
|
|
|
|
2022-05-03 18:09:12 +00:00
|
|
|
let conditionSetUrl;
|
|
|
|
let getConditionSetIdentifierFromUrl;
|
|
|
|
|
|
|
|
test('Create new Condition Set object and store @localStorage', async ({ page, context }) => {
|
|
|
|
//Go to baseURL
|
|
|
|
await page.goto('/', { waitUntil: 'networkidle' });
|
|
|
|
|
|
|
|
//Click the Create button
|
|
|
|
await page.click('button:has-text("Create")');
|
|
|
|
|
|
|
|
// Click text=Condition Set
|
|
|
|
await page.click('text=Condition Set');
|
|
|
|
|
2022-05-25 22:45:11 +00:00
|
|
|
// Click on My Items in Tree. Workaround for https://github.com/nasa/openmct/issues/5184
|
|
|
|
await page.click('form[name="mctForm"] a:has-text("My Items")');
|
|
|
|
|
2022-05-03 18:09:12 +00:00
|
|
|
// Click text=OK
|
|
|
|
await Promise.all([
|
|
|
|
page.waitForNavigation(),
|
|
|
|
page.click('text=OK')
|
|
|
|
]);
|
|
|
|
|
|
|
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
|
|
|
//Save localStorage for future test execution
|
|
|
|
await context.storageState({ path: './e2e/tests/recycled_storage.json' });
|
|
|
|
|
|
|
|
//Set object identifier from url
|
|
|
|
conditionSetUrl = await page.url();
|
|
|
|
console.log('conditionSetUrl ' + conditionSetUrl);
|
|
|
|
|
|
|
|
getConditionSetIdentifierFromUrl = await conditionSetUrl.split('/').pop().split('?')[0];
|
|
|
|
console.log('getConditionSetIdentifierFromUrl ' + getConditionSetIdentifierFromUrl);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
test.describe.serial('Condition Set CRUD Operations on @localStorage', () => {
|
|
|
|
//Load localStorage for subsequent tests
|
|
|
|
test.use({ storageState: './e2e/tests/recycled_storage.json' });
|
|
|
|
|
|
|
|
//Begin suite of tests again localStorage
|
|
|
|
test('Condition set object properties persist in main view and inspector', async ({ page }) => {
|
|
|
|
//Navigate to baseURL with injected localStorage
|
|
|
|
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
2021-12-20 20:01:16 +00:00
|
|
|
|
2022-05-03 18:09:12 +00:00
|
|
|
//Assertions on loaded Condition Set in main view
|
|
|
|
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
2021-12-20 20:01:16 +00:00
|
|
|
|
2022-05-03 18:09:12 +00:00
|
|
|
//Assertions on loaded Condition Set in Inspector
|
|
|
|
await expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy;
|
2021-12-20 20:01:16 +00:00
|
|
|
|
2022-05-03 18:09:12 +00:00
|
|
|
//Reload Page
|
2021-12-20 20:01:16 +00:00
|
|
|
await Promise.all([
|
2022-05-03 18:09:12 +00:00
|
|
|
page.reload(),
|
|
|
|
page.waitForLoadState('networkidle')
|
2021-12-20 20:01:16 +00:00
|
|
|
]);
|
|
|
|
|
2022-05-03 18:09:12 +00:00
|
|
|
//Re-verify after reload
|
|
|
|
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
|
|
|
//Assertions on loaded Condition Set in Inspector
|
|
|
|
await expect.soft(page.locator('_vue=item.name=Unnamed Condition Set')).toBeTruthy;
|
|
|
|
|
2022-03-09 14:45:10 +00:00
|
|
|
});
|
2022-05-03 18:09:12 +00:00
|
|
|
test('condition set object can be modified on @localStorage', async ({ page }) => {
|
|
|
|
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
|
|
|
|
|
|
|
//Assertions on loaded Condition Set in main view
|
|
|
|
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
|
|
|
|
2022-03-09 14:45:10 +00:00
|
|
|
//Update the Condition Set properties
|
2022-05-03 18:09:12 +00:00
|
|
|
// Click Edit Button
|
|
|
|
await page.locator('text=Conditions View Snapshot >> button').nth(3).click();
|
|
|
|
|
|
|
|
//Edit Condition Set Name from main view
|
|
|
|
await page.locator('text=Unnamed Condition Set').first().fill('Renamed Condition Set');
|
|
|
|
await page.locator('text=Renamed Condition Set').first().press('Enter');
|
|
|
|
// Click Save Button
|
|
|
|
await page.locator('text=Snapshot Save and Finish Editing Save and Continue Editing >> button').nth(1).click();
|
|
|
|
// Click Save and Finish Editing Option
|
|
|
|
await page.locator('text=Save and Finish Editing').click();
|
|
|
|
|
|
|
|
//Verify Main section reflects updated Name Property
|
|
|
|
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Renamed Condition Set');
|
|
|
|
|
|
|
|
// Verify Inspector properties
|
|
|
|
// Verify Inspector has updated Name property
|
|
|
|
await expect.soft(page.locator('text=Renamed Condition Set').nth(1)).toBeTruthy();
|
|
|
|
// Verify Inspector Details has updated Name property
|
|
|
|
await expect.soft(page.locator('text=Renamed Condition Set').nth(2)).toBeTruthy();
|
|
|
|
|
|
|
|
// Verify Tree reflects updated Name proprety
|
|
|
|
// Expand Tree
|
|
|
|
await page.locator('text=Open MCT My Items >> span >> nth=3').click();
|
|
|
|
// Verify Condition Set Object is renamed in Tree
|
|
|
|
await expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
|
|
|
// Verify Search Tree reflects renamed Name property
|
|
|
|
await page.locator('input[type="search"]').fill('Renamed');
|
|
|
|
await expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
|
|
|
|
|
|
|
//Reload Page
|
|
|
|
await Promise.all([
|
|
|
|
page.reload(),
|
|
|
|
page.waitForLoadState('networkidle')
|
|
|
|
]);
|
|
|
|
|
|
|
|
//Verify Main section reflects updated Name Property
|
|
|
|
await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText('Renamed Condition Set');
|
|
|
|
|
|
|
|
// Verify Inspector properties
|
|
|
|
// Verify Inspector has updated Name property
|
|
|
|
await expect.soft(page.locator('text=Renamed Condition Set').nth(1)).toBeTruthy();
|
|
|
|
// Verify Inspector Details has updated Name property
|
|
|
|
await expect.soft(page.locator('text=Renamed Condition Set').nth(2)).toBeTruthy();
|
|
|
|
|
|
|
|
// Verify Tree reflects updated Name proprety
|
|
|
|
// Expand Tree
|
|
|
|
await page.locator('text=Open MCT My Items >> span >> nth=3').click();
|
|
|
|
// Verify Condition Set Object is renamed in Tree
|
|
|
|
await expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
|
|
|
// Verify Search Tree reflects renamed Name property
|
|
|
|
await page.locator('input[type="search"]').fill('Renamed');
|
|
|
|
await expect(page.locator('a:has-text("Renamed Condition Set")')).toBeTruthy();
|
2022-03-09 14:45:10 +00:00
|
|
|
});
|
2022-05-03 18:09:12 +00:00
|
|
|
test('condition set object can be deleted by Search Tree Actions menu on @localStorage', async ({ page }) => {
|
|
|
|
//Navigate to baseURL
|
|
|
|
await page.goto('/', { waitUntil: 'networkidle' });
|
|
|
|
|
|
|
|
//Expect Unnamed Condition Set to be visible in Main View
|
|
|
|
await expect(page.locator('a:has-text("Unnamed Condition Set Condition Set")')).toBeVisible();
|
|
|
|
|
|
|
|
// Search for Unnamed Condition Set
|
|
|
|
await page.locator('input[type="search"]').fill('Unnamed Condition Set');
|
|
|
|
// Right Click to Open Actions Menu
|
|
|
|
await page.locator('a:has-text("Unnamed Condition Set")').click({
|
|
|
|
button: 'right'
|
|
|
|
});
|
|
|
|
// Click Remove Action
|
|
|
|
await page.locator('text=Remove').click();
|
|
|
|
|
|
|
|
await page.locator('text=OK').click();
|
|
|
|
|
|
|
|
//Expect Unnamed Condition Set to be removed in Main View
|
|
|
|
await expect(page.locator('a:has-text("Unnamed Condition Set Condition Set")')).not.toBeVisible();
|
|
|
|
|
|
|
|
await page.locator('.c-search__clear-input').click();
|
|
|
|
// Search for Unnamed Condition Set
|
|
|
|
await page.locator('input[type="search"]').fill('Unnamed Condition Set');
|
|
|
|
// Expect Unnamed Condition Set to be removed
|
|
|
|
await expect(page.locator('a:has-text("Unnamed Condition Set")')).not.toBeVisible();
|
|
|
|
|
|
|
|
//Feature?
|
|
|
|
//Domain Object is still available by direct URL after delete
|
|
|
|
await page.goto(conditionSetUrl, { waitUntil: 'networkidle' });
|
|
|
|
await expect(page.locator('.l-browse-bar__object-name')).toContainText('Unnamed Condition Set');
|
|
|
|
|
2022-03-09 14:45:10 +00:00
|
|
|
});
|
2021-12-20 20:01:16 +00:00
|
|
|
});
|