Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nasa/openmct.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'e2e/tests/plugins/notebook/restrictedNotebook.e2e.spec.js')
-rw-r--r--e2e/tests/plugins/notebook/restrictedNotebook.e2e.spec.js49
1 files changed, 21 insertions, 28 deletions
diff --git a/e2e/tests/plugins/notebook/restrictedNotebook.e2e.spec.js b/e2e/tests/plugins/notebook/restrictedNotebook.e2e.spec.js
index 37012504a..18c4653d8 100644
--- a/e2e/tests/plugins/notebook/restrictedNotebook.e2e.spec.js
+++ b/e2e/tests/plugins/notebook/restrictedNotebook.e2e.spec.js
@@ -35,7 +35,7 @@ test.describe('Restricted Notebook', () => {
});
test('Can be renamed @addInit', async ({ page }) => {
- await expect.soft(page.locator('.l-browse-bar__object-name')).toContainText(`Unnamed ${CUSTOM_NAME}`);
+ await expect(page.locator('.l-browse-bar__object-name')).toContainText(`Unnamed ${CUSTOM_NAME}`);
});
test('Can be deleted if there are no locked pages @addInit', async ({ page }) => {
@@ -52,16 +52,15 @@ test.describe('Restricted Notebook', () => {
// Click Remove Text
await page.locator('text=Remove').click();
- //Wait until Save Banner is gone
+ // Click 'OK' on confirmation window and wait for save banner to appear
await Promise.all([
page.waitForNavigation(),
page.locator('text=OK').click(),
page.waitForSelector('.c-message-banner__message')
]);
- await page.locator('.c-message-banner__close-button').click();
// has been deleted
- expect.soft(await restrictedNotebookTreeObject.count()).toEqual(0);
+ expect(await restrictedNotebookTreeObject.count()).toEqual(0);
});
test('Can be locked if at least one page has one entry @addInit', async ({ page }) => {
@@ -69,7 +68,7 @@ test.describe('Restricted Notebook', () => {
await enterTextEntry(page);
const commitButton = page.locator('button:has-text("Commit Entries")');
- expect.soft(await commitButton.count()).toEqual(1);
+ expect(await commitButton.count()).toEqual(1);
});
});
@@ -81,11 +80,17 @@ test.describe('Restricted Notebook with at least one entry and with the page loc
await enterTextEntry(page);
await lockPage(page);
+ // FIXME: Give ample time for the mutation to happen
+ // https://github.com/nasa/openmct/issues/5409
+ // eslint-disable-next-line playwright/no-wait-for-timeout
+ await page.waitForTimeout(1 * 1000);
+
// open sidebar
await page.locator('button.c-notebook__toggle-nav-button').click();
});
- test('Locked page should now be in a locked state @addInit', async ({ page }) => {
+ test('Locked page should now be in a locked state @addInit', async ({ page }, testInfo) => {
+ test.fixme(testInfo.project === 'chrome-beta', "Test is unreliable on chrome-beta");
// main lock message on page
const lockMessage = page.locator('text=This page has been committed and cannot be modified or removed');
expect.soft(await lockMessage.count()).toEqual(1);
@@ -96,11 +101,9 @@ test.describe('Restricted Notebook with at least one entry and with the page loc
// no way to remove a restricted notebook with a locked page
await openContextMenuRestrictedNotebook(page);
-
const menuOptions = page.locator('.c-menu ul');
- await expect.soft(menuOptions).not.toContainText('Remove');
-
+ await expect(menuOptions).not.toContainText('Remove');
});
test('Can still: add page, rename, add entry, delete unlocked pages @addInit', async ({ page }) => {
@@ -139,7 +142,7 @@ test.describe('Restricted Notebook with at least one entry and with the page loc
// deleted page, should no longer exist
const deletedPageElement = page.locator(`text=${TEST_TEXT_NAME}`);
- expect.soft(await deletedPageElement.count()).toEqual(0);
+ expect(await deletedPageElement.count()).toEqual(0);
});
});
@@ -155,7 +158,7 @@ test.describe('Restricted Notebook with a page locked and with an embed @addInit
await page.locator('.c-ne__embed__name .c-popup-menu-button').click(); // embed popup menu
const embedMenu = page.locator('body >> .c-menu');
- await expect.soft(embedMenu).toContainText('Remove This Embed');
+ await expect(embedMenu).toContainText('Remove This Embed');
});
test('Disallows embeds to be deleted if page locked @addInit', async ({ page }) => {
@@ -164,7 +167,7 @@ test.describe('Restricted Notebook with a page locked and with an embed @addInit
await page.locator('.c-ne__embed__name .c-popup-menu-button').click(); // embed popup menu
const embedMenu = page.locator('body >> .c-menu');
- await expect.soft(embedMenu).not.toContainText('Remove This Embed');
+ await expect(embedMenu).not.toContainText('Remove This Embed');
});
});
@@ -232,28 +235,18 @@ async function lockPage(page) {
await commitButton.click();
//Wait until Lock Banner is visible
- await Promise.all([
- page.locator('text=Lock Page').click(),
- page.waitForSelector('.c-message-banner__message')
- ]);
- // Close Lock Banner
- await page.locator('.c-message-banner__close-button').click();
-
- //artifically wait to avoid mutation delay TODO: https://github.com/nasa/openmct/issues/5409
- // eslint-disable-next-line playwright/no-wait-for-timeout
- await page.waitForTimeout(1 * 1000);
+ await page.locator('text=Lock Page').click();
}
/**
* @param {import('@playwright/test').Page} page
*/
async function openContextMenuRestrictedNotebook(page) {
- // Click text=Open MCT My Items (This expands the My Items folder to show it's chilren in the tree)
- await page.locator('text=Open MCT My Items >> span').nth(3).click();
-
- //artifically wait to avoid mutation delay TODO: https://github.com/nasa/openmct/issues/5409
- // eslint-disable-next-line playwright/no-wait-for-timeout
- await page.waitForTimeout(1 * 1000);
+ const myItemsFolder = page.locator('text=Open MCT My Items >> span').nth(3);
+ const className = await myItemsFolder.getAttribute('class');
+ if (!className.includes('c-disclosure-triangle--expanded')) {
+ await myItemsFolder.click();
+ }
// Click a:has-text("Unnamed CUSTOM_NAME")
await page.locator(`a:has-text("Unnamed ${CUSTOM_NAME}")`).click({