Add check to hide any old popup items when showing a new one (#5680)

* Add check to hide any old popup items when showing a new one

* Use more deterministic selector

* Hover first to "slow down" e2e actions while in headless mode

* Add notebook tests

* Combine the section tests

* Set focused image when timestamp prop is passed in

* Unused var

* Create timestrip with imagery child

* Add equality check for hovered image and view large image url

* Cleanup

* add annotation and checks

* [e2e] Minor locator improvements

* Update button title

* skipping with context

Co-authored-by: John Hill <john.c.hill@nasa.gov>
Co-authored-by: Jesse Mazzella <jesse.d.mazzella@nasa.gov>
This commit is contained in:
Khalid Adil 2022-08-31 12:11:09 -05:00 committed by GitHub
parent 0c9ea26888
commit 79d1df39b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 64 additions and 5 deletions

View File

@ -27,6 +27,7 @@ This test suite is dedicated to tests which verify the basic operations surround
// FIXME: Remove this eslint exception once tests are implemented
// eslint-disable-next-line no-unused-vars
const { test, expect } = require('../../../../baseFixtures');
const { createDomainObjectWithDefaults } = require('../../../../appActions');
test.describe('Notebook CRUD Operations', () => {
test.fixme('Can create a Notebook Object', async ({ page }) => {
@ -67,10 +68,32 @@ test.describe('Default Notebook', () => {
test.describe('Notebook section tests', () => {
//The following test cases are associated with Notebook Sections
test.fixme('New sections are automatically named Unnamed Section with Unnamed Page', async ({ page }) => {
//Create new notebook A
//Add section
//Verify new section and new page details
test.beforeEach(async ({ page }) => {
//Navigate to baseURL
await page.goto('./', { waitUntil: 'networkidle' });
// Create Notebook
await createDomainObjectWithDefaults(page, {
type: 'Notebook',
name: "Test Notebook"
});
});
test('Default and new sections are automatically named Unnamed Section with Unnamed Page', async ({ page }) => {
// Check that the default section and page are created and the name matches the defaults
const defaultSectionName = await page.locator('.c-notebook__sections .c-list__item__name').textContent();
expect(defaultSectionName).toBe('Unnamed Section');
const defaultPageName = await page.locator('.c-notebook__pages .c-list__item__name').textContent();
expect(defaultPageName).toBe('Unnamed Page');
// Expand sidebar and add a section
await page.locator('.c-notebook__toggle-nav-button').click();
await page.locator('.js-sidebar-sections .c-icon-button.icon-plus').click();
// Check that new section and page within the new section match the defaults
const newSectionName = await page.locator('.c-notebook__sections .c-list__item__name').nth(1).textContent();
expect(newSectionName).toBe('Unnamed Section');
const newPageName = await page.locator('.c-notebook__pages .c-list__item__name').textContent();
expect(newPageName).toBe('Unnamed Page');
});
test.fixme('Section selection operations and associated behavior', async ({ page }) => {
//Create new notebook A
@ -107,6 +130,38 @@ test.describe('Notebook section tests', () => {
test.describe('Notebook page tests', () => {
//The following test cases are associated with Notebook Pages
test.beforeEach(async ({ page }) => {
//Navigate to baseURL
await page.goto('./', { waitUntil: 'networkidle' });
// Create Notebook
await createDomainObjectWithDefaults(page, {
type: 'Notebook',
name: "Test Notebook"
});
});
//Test will need to be implemented after a refactor in #5713
// eslint-disable-next-line playwright/no-skipped-test
test.skip('Delete page popup is removed properly on clicking dropdown again', async ({ page }) => {
test.info().annotations.push({
type: 'issue',
description: 'https://github.com/nasa/openmct/issues/5713'
});
// Expand sidebar and add a second page
await page.locator('.c-notebook__toggle-nav-button').click();
await page.locator('text=Page Add >> button').click();
// Click on the 2nd page dropdown button and expect the Delete Page option to appear
await page.locator('button[title="Open context menu"]').nth(2).click();
await expect(page.locator('text=Delete Page')).toBeEnabled();
// Clicking on the same page a second time causes the same Delete Page option to recreate
await page.locator('button[title="Open context menu"]').nth(2).click();
await expect(page.locator('text=Delete Page')).toBeEnabled();
// Clicking on the first page causes the first delete button to detach and recreate on the first page
await page.locator('button[title="Open context menu"]').nth(1).click();
const numOfDeletePagePopups = await page.locator('li[title="Delete Page"]').count();
expect(numOfDeletePagePopups).toBe(1);
});
test.fixme('Page selection operations and associated behavior', async ({ page }) => {
//Create new notebook A
//Delete existing Page

View File

@ -1,7 +1,7 @@
<template>
<button
class="c-popup-menu-button c-disclosure-button"
title="popup menu"
title="Open context menu"
@click="showMenuItems"
>
</button>
@ -65,6 +65,10 @@ export default {
return;
},
showMenuItems($event) {
if (this.menuItems) {
this.hideMenuItems();
}
const menuItems = new Vue({
components: {
MenuItems