Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New action to reload an individual view and all of its children #7362

Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 13 additions & 31 deletions e2e/tests/functional/plugins/reloadAction/reloadAction.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test.describe('Reload action', () => {
// Expand all folders
await expandEntireTree(page);

await page.getByLabel('Edit').click();
await page.getByLabel('Edit Object', { exact: true }).click();

await page.dragAndDrop(`text='Alpha Table'`, '.l-layout__grid-holder', {
scottbell marked this conversation as resolved.
Show resolved Hide resolved
targetPosition: { x: 0, y: 0 }
Expand All @@ -77,40 +77,28 @@ test.describe('Reload action', () => {

test('can reload display layout and its children', async ({ page }) => {
const beforeReloadAlphaTelemetryValue = await page
.locator('table.c-telemetry-table__body > tbody')
.getByLabel('Alpha Table table content')
.getByLabel('wavelengths table cell')
.first()
.locator('tr')
.first()
.locator('td')
.nth(3)
.getAttribute('title');
const beforeReloadBetaTelemetryValue = await page
.locator('table.c-telemetry-table__body > tbody')
.last()
.locator('tr')
.getByLabel('Beta Table table content')
.getByLabel('wavelengths table cell')
.first()
.locator('td')
.nth(3)
.getAttribute('title');
// reload alpha
await page.getByTitle('View menu items').first().click();
await page.getByRole('menuitem', { name: /Reload/ }).click();

const afterReloadAlphaTelemetryValue = await page
.locator('table.c-telemetry-table__body > tbody')
.first()
.locator('tr')
.getByLabel('Alpha Table table content')
.getByLabel('wavelengths table cell')
.first()
.locator('td')
.nth(3)
.getAttribute('title');
const afterReloadBetaTelemetryValue = await page
.locator('table.c-telemetry-table__body > tbody')
.last()
.locator('tr')
.getByLabel('Beta Table table content')
.getByLabel('wavelengths table cell')
.first()
.locator('td')
.nth(3)
.getAttribute('title');

expect(beforeReloadAlphaTelemetryValue).not.toEqual(afterReloadAlphaTelemetryValue);
Expand All @@ -121,20 +109,14 @@ test.describe('Reload action', () => {
await page.getByRole('menuitem', { name: /Reload/ }).click();

const fullReloadAlphaTelemetryValue = await page
.locator('table.c-telemetry-table__body > tbody')
.first()
.locator('tr')
.getByLabel('Alpha Table table content')
.getByLabel('wavelengths table cell')
.first()
.locator('td')
.nth(3)
.getAttribute('title');
const fullReloadBetaTelemetryValue = await page
.locator('table.c-telemetry-table__body > tbody')
.last()
.locator('tr')
.getByLabel('Beta Table table content')
.getByLabel('wavelengths table cell')
.first()
.locator('td')
.nth(3)
.getAttribute('title');

expect(fullReloadAlphaTelemetryValue).not.toEqual(afterReloadAlphaTelemetryValue);
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/functional/plugins/tabs/tabs.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ test.describe('Tabs View', () => {
page.goto(tabsView.url);

// select first tab
await page.getByLabel(`${table.name} tab`).click();
await page.getByLabel(`${table.name} tab`, { exact: true }).click();
// ensure table header visible
await expect(page.getByRole('searchbox', { name: 'message filter input' })).toBeVisible();

// no canvas (i.e., sine wave generator) in the document should be visible
await expect(page.locator('canvas')).toBeHidden();

// select second tab
await page.getByLabel(`${notebook.name} tab`).click();
await page.getByLabel(`${notebook.name} tab`, { exact: true }).click();

// ensure notebook visible
await expect(page.locator('.c-notebook__drag-area')).toBeVisible();
Expand All @@ -67,7 +67,7 @@ test.describe('Tabs View', () => {
await expect(page.locator('canvas')).toBeHidden();

// select third tab
await page.getByLabel(`${sineWaveGenerator.name} tab`).click();
await page.getByLabel(`${sineWaveGenerator.name} tab`, { exact: true }).click();

// expect sine wave generator visible
await expect(page.locator('.c-plot')).toBeVisible();
Expand All @@ -78,7 +78,7 @@ test.describe('Tabs View', () => {
await expect(page.locator('canvas').nth(1)).toBeVisible();

// now try to select the first tab again
await page.getByLabel(`${table.name} tab`).click();
await page.getByLabel(`${table.name} tab`, { exact: true }).click();
// ensure table header visible
await expect(page.getByRole('searchbox', { name: 'message filter input' })).toBeVisible();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ test.describe('Telemetry Table', () => {

// Get the most recent telemetry date
const latestTelemetryDate = await page
.locator('table.c-telemetry-table__body > tbody > tr')
.getByLabel('table content')
.getByLabel('utc table cell')
.last()
.locator('td')
.nth(1)
.getAttribute('title');

// Verify that it is <= our new end bound
Expand All @@ -91,7 +90,7 @@ test.describe('Telemetry Table', () => {
await page.getByRole('searchbox', { name: 'message filter input' }).click();
await page.getByRole('searchbox', { name: 'message filter input' }).fill('Roger');

let cells = await page.getByRole('cell', { name: /Roger/ }).all();
let cells = await page.getByRole('cell').getByText(/Roger/).all();
// ensure we've got more than one cell
expect(cells.length).toBeGreaterThan(1);
// ensure the text content of each cell contains the search term
Expand All @@ -103,7 +102,10 @@ test.describe('Telemetry Table', () => {
await page.getByRole('searchbox', { name: 'message filter input' }).click();
await page.getByRole('searchbox', { name: 'message filter input' }).fill('Dodger');

cells = await page.getByRole('cell', { name: /Dodger/ }).all();
cells = await page
.getByRole('cell')
.getByText(/Dodger/)
.all();
// ensure we've got more than one cell
expect(cells.length).toBe(0);
// ensure the text content of each cell contains the search term
Expand Down Expand Up @@ -135,7 +137,7 @@ test.describe('Telemetry Table', () => {
await page.getByRole('searchbox', { name: 'message filter input' }).click();
await page.getByRole('searchbox', { name: 'message filter input' }).fill('/[Rr]oger/');

let cells = await page.getByRole('cell', { name: /Roger/ }).all();
let cells = await page.getByRole('cell').getByText(/Roger/).all();
// ensure we've got more than one cell
expect(cells.length).toBeGreaterThan(1);
// ensure the text content of each cell contains the search term
Expand All @@ -147,7 +149,10 @@ test.describe('Telemetry Table', () => {
await page.getByRole('searchbox', { name: 'message filter input' }).click();
await page.getByRole('searchbox', { name: 'message filter input' }).fill('/[Dd]oger/');

cells = await page.getByRole('cell', { name: /Dodger/ }).all();
cells = await page
.getByRole('cell')
.getByText(/Dodger/)
.all();
// ensure we've got more than one cell
expect(cells.length).toBe(0);
// ensure the text content of each cell contains the search term
Expand Down
12 changes: 6 additions & 6 deletions e2e/tests/performance/tabs.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { createDomainObjectWithDefaults, waitForPlotsToRender } from '../../appA
import { expect, test } from '../../pluginFixtures.js';

test.describe('Tabs View', () => {
test('Renders tabbed elements nicely', async ({ page }) => {
test('Renders tabbed elements only when visible', async ({ page }) => {
// Code to hook into the requestAnimationFrame function and log each call
let animationCalls = [];
await page.exposeFunction('logCall', (callCount) => {
Expand Down Expand Up @@ -64,32 +64,32 @@ test.describe('Tabs View', () => {
page.goto(tabsView.url);

// select first tab
await page.getByLabel(`${table.name} tab`).click();
await page.getByLabel(`${table.name} tab`, { exact: true }).click();
// ensure table header visible
await expect(page.getByRole('searchbox', { name: 'message filter input' })).toBeVisible();

// select second tab
await page.getByLabel(`${notebook.name} tab`).click();
await page.getByLabel(`${notebook.name} tab`, { exact: true }).click();

// expect notebook visible
await expect(page.locator('.c-notebook__drag-area')).toBeVisible();

// select third tab
await page.getByLabel(`${sineWaveGenerator.name} tab`).click();
await page.getByLabel(`${sineWaveGenerator.name} tab`, { exact: true }).click();

// ensure sine wave generator visible
expect(await page.locator('.c-plot').isVisible()).toBe(true);

// now select notebook and clear animation calls
await page.getByLabel(`${notebook.name} tab`).click();
await page.getByLabel(`${notebook.name} tab`, { exact: true }).click();
animationCalls = [];
// expect notebook visible
await expect(page.locator('.c-notebook__drag-area')).toBeVisible();
const notebookAnimationCalls = animationCalls.length;

// select sine wave generator and clear animation calls
animationCalls = [];
await page.getByLabel(`${sineWaveGenerator.name} tab`).click();
await page.getByLabel(`${sineWaveGenerator.name} tab`, { exact: true }).click();

// ensure sine wave generator visible
await waitForPlotsToRender(page);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/telemetryTable/components/TableCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
<template>
<td
ref="tableCell"
:aria-label="formattedValue"
:title="formattedValue"
:aria-label="`${columnKey} table cell ${formattedValue}`"

Check warning on line 26 in src/plugins/telemetryTable/components/TableCell.vue

View check run for this annotation

Codecov / codecov/patch

src/plugins/telemetryTable/components/TableCell.vue#L26

Added line #L26 was not covered by tests
@click="selectCell($event.currentTarget, columnKey)"
@mouseover.ctrl="showToolTip"
@mouseleave="hideToolTip"
Expand Down
1 change: 1 addition & 0 deletions src/plugins/telemetryTable/components/TableComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@
ref="contentTable"
class="c-table__body c-telemetry-table__body js-telemetry-table__content"
:style="{ height: totalHeight + 'px' }"
:aria-label="`${table.domainObject.name} table content`"
>
<tbody>
<telemetry-table-row
Expand Down
3 changes: 2 additions & 1 deletion src/ui/components/ObjectView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,10 @@
this.updateView(true);
},
reload(domainObjectToReload) {
if (objectUtils.equals(domainObjectToReload, this.domainObject)) {

Check warning on line 224 in src/ui/components/ObjectView.vue

View check run for this annotation

Codecov / codecov/patch

src/ui/components/ObjectView.vue#L224

Added line #L224 was not covered by tests
this.clear();
this.updateView(true);
this.initObjectStyles();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

this.triggerStalenessSubscribe(this.domainObject);
}
},
triggerStalenessSubscribe(object) {
Expand Down
Loading