mirror of
https://github.com/nasa/openmct.git
synced 2025-05-08 03:28:33 +00:00
* refactor: rename prop for clarity - `orientation` -> `dragOrientation` * fix(#7234): fix event name for flexible layout toolbar action * test(e2e): add tests for flexible layout toolbar actions * test: add `@localStorage` tags
This commit is contained in:
parent
7f8262b882
commit
cdd772aa87
22
e2e/test-data/flexible_layout_with_child_layouts.json
Normal file
22
e2e/test-data/flexible_layout_with_child_layouts.json
Normal file
File diff suppressed because one or more lines are too long
@ -91,6 +91,31 @@ test.describe('Generate Visual Test Data @localStorage @generatedata', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Generate flexible layout with 2 child display layouts', async ({ page, context }) => {
|
||||||
|
// Create Display Layout
|
||||||
|
const parent = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Flexible Layout',
|
||||||
|
name: 'Parent Flexible Layout'
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Child Layout 1',
|
||||||
|
parent: parent.uuid
|
||||||
|
});
|
||||||
|
await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Display Layout',
|
||||||
|
name: 'Child Layout 2',
|
||||||
|
parent: parent.uuid
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto(parent.url);
|
||||||
|
|
||||||
|
//Save localStorage for future test execution
|
||||||
|
await context.storageState({
|
||||||
|
path: path.join(__dirname, '../../../e2e/test-data/flexible_layout_with_child_layouts.json')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// TODO: Visual test for the generated object here
|
// TODO: Visual test for the generated object here
|
||||||
// - Move to using appActions to create the overlay plot
|
// - Move to using appActions to create the overlay plot
|
||||||
// and embedded standard telemetry object
|
// and embedded standard telemetry object
|
||||||
|
@ -37,7 +37,7 @@ const LOCALSTORAGE_PATH = path.resolve(
|
|||||||
const TINY_IMAGE_BASE64 =
|
const TINY_IMAGE_BASE64 =
|
||||||
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII';
|
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII';
|
||||||
|
|
||||||
test.describe('Display Layout Toolbar Actions', () => {
|
test.describe('Display Layout Toolbar Actions @localStorage', () => {
|
||||||
const PARENT_DISPLAY_LAYOUT_NAME = 'Parent Display Layout';
|
const PARENT_DISPLAY_LAYOUT_NAME = 'Parent Display Layout';
|
||||||
const CHILD_DISPLAY_LAYOUT_NAME1 = 'Child Layout 1';
|
const CHILD_DISPLAY_LAYOUT_NAME1 = 'Child Layout 1';
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
|
@ -19,12 +19,19 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
/* global __dirname */
|
||||||
|
|
||||||
const { test, expect } = require('../../../../pluginFixtures');
|
const { test, expect } = require('../../../../pluginFixtures');
|
||||||
const {
|
const {
|
||||||
createDomainObjectWithDefaults,
|
createDomainObjectWithDefaults,
|
||||||
setIndependentTimeConductorBounds
|
setIndependentTimeConductorBounds
|
||||||
} = require('../../../../appActions');
|
} = require('../../../../appActions');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const LOCALSTORAGE_PATH = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
'../../../../test-data/flexible_layout_with_child_layouts.json'
|
||||||
|
);
|
||||||
|
|
||||||
test.describe('Flexible Layout', () => {
|
test.describe('Flexible Layout', () => {
|
||||||
let sineWaveObject;
|
let sineWaveObject;
|
||||||
@ -257,3 +264,40 @@ test.describe('Flexible Layout', () => {
|
|||||||
await expect(page.getByText('2021-12-30 01:11:00.000Z')).toBeHidden();
|
await expect(page.getByText('2021-12-30 01:11:00.000Z')).toBeHidden();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.describe('Flexible Layout Toolbar Actions @localStorage', () => {
|
||||||
|
test.use({
|
||||||
|
storageState: path.resolve(__dirname, LOCALSTORAGE_PATH)
|
||||||
|
});
|
||||||
|
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
|
await page.goto('./', { waitUntil: 'domcontentloaded' });
|
||||||
|
await page
|
||||||
|
.locator('a')
|
||||||
|
.filter({ hasText: 'Parent Flexible Layout Flexible Layout' })
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
await page.getByLabel('Edit').click();
|
||||||
|
});
|
||||||
|
test('Add/Remove Container', async ({ page }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/7234'
|
||||||
|
});
|
||||||
|
await page.locator('div:nth-child(5) > .c-fl-container__frames-holder').click();
|
||||||
|
expect(await page.locator('.c-fl-container').count()).toEqual(2);
|
||||||
|
await page.getByTitle('Add Container').click();
|
||||||
|
expect(await page.locator('.c-fl-container').count()).toEqual(3);
|
||||||
|
await page.getByTitle('Remove Container').click();
|
||||||
|
await page.getByRole('button', { name: 'OK' }).click();
|
||||||
|
expect(await page.locator('.c-fl-container').count()).toEqual(2);
|
||||||
|
});
|
||||||
|
test('Columns/Rows Layout Toggle', async ({ page }) => {
|
||||||
|
await page.locator('div:nth-child(5) > .c-fl-container__frames-holder').click();
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toEqual(0);
|
||||||
|
await page.getByTitle('Columns layout').click();
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toEqual(1);
|
||||||
|
await page.getByTitle('Rows layout').click();
|
||||||
|
expect(await page.locator('.c-fl--rows').count()).toEqual(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
<resize-handle
|
<resize-handle
|
||||||
v-if="i !== frames.length - 1"
|
v-if="i !== frames.length - 1"
|
||||||
:index="i"
|
:index="i"
|
||||||
:orientation="rowsLayout ? 'horizontal' : 'vertical'"
|
:drag-orientation="rowsLayout ? 'horizontal' : 'vertical'"
|
||||||
:is-editing="isEditing"
|
:is-editing="isEditing"
|
||||||
@init-move="startFrameResizing"
|
@init-move="startFrameResizing"
|
||||||
@move="frameResizing"
|
@move="frameResizing"
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
<resize-handle
|
<resize-handle
|
||||||
v-if="index !== containers.length - 1"
|
v-if="index !== containers.length - 1"
|
||||||
:index="index"
|
:index="index"
|
||||||
:orientation="rowsLayout ? 'vertical' : 'horizontal'"
|
:drag-orientation="rowsLayout ? 'vertical' : 'horizontal'"
|
||||||
:is-editing="isEditing"
|
:is-editing="isEditing"
|
||||||
@init-move="startContainerResizing"
|
@init-move="startContainerResizing"
|
||||||
@move="containerResizing"
|
@move="containerResizing"
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<div
|
<div
|
||||||
v-show="isEditing && !isDragging"
|
v-show="isEditing && !isDragging"
|
||||||
class="c-fl-frame__resize-handle"
|
class="c-fl-frame__resize-handle"
|
||||||
:class="[orientation]"
|
:class="[dragOrientation]"
|
||||||
@mousedown="mousedown"
|
@mousedown="mousedown"
|
||||||
></div>
|
></div>
|
||||||
</template>
|
</template>
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
orientation: {
|
dragOrientation: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
@ -78,7 +78,7 @@ export default {
|
|||||||
let mousePos;
|
let mousePos;
|
||||||
let delta;
|
let delta;
|
||||||
|
|
||||||
if (this.orientation === 'horizontal') {
|
if (this.dragOrientation === 'horizontal') {
|
||||||
elSize = this.$el.getBoundingClientRect().x;
|
elSize = this.$el.getBoundingClientRect().x;
|
||||||
mousePos = event.clientX;
|
mousePos = event.clientX;
|
||||||
} else {
|
} else {
|
||||||
|
@ -46,6 +46,12 @@ function ToolbarProvider(openmct) {
|
|||||||
let deleteContainer;
|
let deleteContainer;
|
||||||
let addContainer;
|
let addContainer;
|
||||||
let toggleFrame;
|
let toggleFrame;
|
||||||
|
const primaryKeyString =
|
||||||
|
primary?.context?.item?.identifier &&
|
||||||
|
openmct.objects.makeKeyString(primary.context.item.identifier);
|
||||||
|
const tertiaryKeyString =
|
||||||
|
tertiary?.context?.item?.identifier &&
|
||||||
|
openmct.objects.makeKeyString(tertiary.context.item.identifier);
|
||||||
|
|
||||||
toggleContainer = {
|
toggleContainer = {
|
||||||
control: 'toggle-button',
|
control: 'toggle-button',
|
||||||
@ -84,8 +90,6 @@ function ToolbarProvider(openmct) {
|
|||||||
let containerIndex = containers.indexOf(container);
|
let containerIndex = containers.indexOf(container);
|
||||||
let frame = container && container.frames.filter((f) => f.id === frameId)[0];
|
let frame = container && container.frames.filter((f) => f.id === frameId)[0];
|
||||||
let frameIndex = container && container.frames.indexOf(frame);
|
let frameIndex = container && container.frames.indexOf(frame);
|
||||||
const primaryKeyString = openmct.objects.makeKeyString(primary.context.item.identifier);
|
|
||||||
const tertiaryKeyString = openmct.objects.makeKeyString(tertiary.context.item.identifier);
|
|
||||||
deleteFrame = {
|
deleteFrame = {
|
||||||
control: 'button',
|
control: 'button',
|
||||||
domainObject: primary.context.item,
|
domainObject: primary.context.item,
|
||||||
@ -169,7 +173,11 @@ function ToolbarProvider(openmct) {
|
|||||||
label: 'OK',
|
label: 'OK',
|
||||||
emphasis: 'true',
|
emphasis: 'true',
|
||||||
callback: function () {
|
callback: function () {
|
||||||
openmct.objectViews.emit('contextAction', 'deleteContainer', containerId);
|
openmct.objectViews.emit(
|
||||||
|
`contextAction:${primaryKeyString}`,
|
||||||
|
'deleteContainer',
|
||||||
|
containerId
|
||||||
|
);
|
||||||
prompt.dismiss();
|
prompt.dismiss();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user