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

Playwright testing #681

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
0283678
Playwright tests and added testId to components
Ryanseanlee Aug 14, 2023
2dde7ee
checkpoint
Ryanseanlee Aug 17, 2023
d9210c4
Merge branch 'develop' into PlaywrightTesting
Ryanseanlee Aug 17, 2023
690287b
WIP on test fixtures
amcclain Aug 18, 2023
5d09f3d
Merge branch 'develop' into PlaywrightTesting
amcclain Sep 18, 2023
04e9e0c
Update to utils
Ryanseanlee Sep 18, 2023
66909fa
Merge remote-tracking branch 'origin/PlaywrightTesting' into Playwrig…
Ryanseanlee Sep 18, 2023
d227b11
Remove HoistUtils.ts
Ryanseanlee Sep 20, 2023
d4c74db
Merge branch 'develop' into PlaywrightTesting
Ryanseanlee Sep 21, 2023
1c0ab2c
Move util methods to HoistPage.ts
Ryanseanlee Sep 21, 2023
1667998
Test for Todo App and addition of grid helper
Ryanseanlee Sep 26, 2023
b35b86f
Clean up
Ryanseanlee Sep 26, 2023
c8bdb2a
Clean up
Ryanseanlee Sep 26, 2023
684f22d
Clean up import
Ryanseanlee Sep 26, 2023
6f24c0c
add todoPage and grid getter
Ryanseanlee Sep 28, 2023
d7799f1
WIP on re-org
amcclain Sep 29, 2023
ae4ffc8
Greg tweaks
ghsolomon Oct 2, 2023
3f1809e
Fixes from CR
ghsolomon Oct 3, 2023
b84dfcd
Merge pull request #673 from xh/PlaywrightTestingGregTweaks
ghsolomon Oct 3, 2023
08fd8be
Name clean-up
Ryanseanlee Oct 4, 2023
f2cf74f
playwright authentication with fixtures
Ryanseanlee Oct 5, 2023
dc485a2
Moment import
Ryanseanlee Oct 5, 2023
51f5240
Co-dev with Ryan
amcclain Oct 5, 2023
acc57dc
Form Helper
Ryanseanlee Oct 6, 2023
6999812
impersonation test
Ryanseanlee Oct 9, 2023
4b9c19a
Merge branch 'develop' into PlaywrightTesting
Ryanseanlee Oct 9, 2023
02e8c9f
Merge branch 'develop' into PlaywrightTesting
Ryanseanlee Oct 9, 2023
39c51ab
Wait for page refresh in impersonation test
Ryanseanlee Oct 10, 2023
1cf33bc
Add read only user for regular testing and have admin user test imper…
Ryanseanlee Oct 13, 2023
2f6719e
Enhance Layout > DockContainer page to showcase new `DockViewModel.on…
ghsolomon Oct 13, 2023
089b2c5
Showcase left / right group borders in SampleColumnGroupsGrid (#675)
ghsolomon Oct 16, 2023
c54b24d
Fix bug where column group borders were not being properly defaulted …
ghsolomon Oct 16, 2023
571fb2b
basic changelog
lbwexler Oct 26, 2023
26f9e77
Remove extraneous import
lbwexler Oct 26, 2023
96e42b5
Fix changelog
lbwexler Oct 26, 2023
f6a34bc
Merge branch 'develop' into PlaywrightTesting
lbwexler Oct 26, 2023
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
## v4.0.0-SNAPSHOT - unreleased

### New Features
* Automated testing via new built-in Hoist support and Playwright
* Enhance Layout > DockContainer page to showcase new `DockViewModel.onClose` hook
* Enhance Column Groups Grid example to showcase `ColumnGroup.showLeftRightBorders` functionality

### Libraries
* @xh/hoist 60.0.0
* @playwright/test 1.38.1


## v3.3.0 - 2023-09-20

### Libraries
Expand Down
1,262 changes: 631 additions & 631 deletions client-app/.yarn/releases/yarn-1.22.19.cjs

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions client-app/src/desktop/AppComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const AppComponent = hoistCmp({
tbar: appBar({
icon: img({src: xhLogo, onClick: () => model.goHome()}),
title: null,
leftItems: [tabSwitcher({enableOverflow: true})],
leftItems: [tabSwitcher({testId: 'toplevel-tab-switcher', enableOverflow: true})],
rightItems: [
webSocketIndicator({iconOnly: true, marginRight: 4}),
appBarSeparator()
Expand All @@ -30,7 +30,8 @@ export const AppComponent = hoistCmp({
appMenuButtonProps: {
hideLogoutItem: false,
extraItems: [welcomeMsg({multiline: true})]
}
},
testId: 'appbar'
}),
hotkeys: [
{
Expand Down
1 change: 0 additions & 1 deletion client-app/src/desktop/AppModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export class AppModel extends HoistAppModel {
{name: 'standard', path: '/standard'},
{name: 'tree', path: '/tree?dims'},
{name: 'treeWithCheckBox', path: '/treeWithCheckBox'},
{name: 'groupedRows', path: '/groupedRows'},
{name: 'groupedCols', path: '/groupedCols'},
{name: 'rest', path: '/rest'},
{name: 'inlineEditing', path: '/inlineEditing'},
Expand Down
8 changes: 4 additions & 4 deletions client-app/src/desktop/common/grid/SampleGrid.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {grid, gridCountLabel} from '@xh/hoist/cmp/grid';
import {filler, hbox, hframe, span, vframe} from '@xh/hoist/cmp/layout';
import {storeFilterField} from '@xh/hoist/cmp/store';
import {hoistCmp, uses, HoistProps, BoxProps} from '@xh/hoist/core';
import {BoxProps, hoistCmp, HoistProps, uses} from '@xh/hoist/core';
import {
colAutosizeButton,
colChooserButton,
Expand Down Expand Up @@ -34,7 +34,7 @@ export const [SampleGrid, sampleGrid] = hoistCmp.withFactory<SampleGridProps>({
model: uses(SampleGridModel, {createDefault: true}),
className: 'tb-sample-grid',

render({model, omitMask, omitGridTools, ...props}) {
render({model, omitMask, omitGridTools, testId, ...props}) {
const {selectedRecords} = model.gridModel,
selCount = selectedRecords.length;

Expand All @@ -55,7 +55,7 @@ export const [SampleGrid, sampleGrid] = hoistCmp.withFactory<SampleGridProps>({
return panel({
ref: model.panelRef,
mask: omitMask ? null : 'onLoad',
item: grid(),
item: grid({testId}),
...props
});
}
Expand All @@ -66,7 +66,7 @@ export const [SampleGrid, sampleGrid] = hoistCmp.withFactory<SampleGridProps>({
...props,
item: hframe(
vframe(
grid(),
grid({testId}),
hbox({
items: [Icon.info(), selText],
className: 'tb-sample-grid__selbar'
Expand Down
2 changes: 1 addition & 1 deletion client-app/src/desktop/common/grid/SampleTreeGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const [SampleTreeGrid, sampleTreeGrid] = hoistCmp.withFactory({
tbar: [
refreshButton({model}),
toolbarSep(),
groupingChooser(),
groupingChooser({testId: 'grouping-chooser'}),
filler(),
gridCountLabel({includeChildren: true}),
gridFindField(),
Expand Down
1 change: 1 addition & 0 deletions client-app/src/desktop/tabs/charts/ChartsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {splitTreeMapPanel} from './SplitTreeMapPanel';

export const chartsTab = hoistCmp.factory(() =>
tabContainer({
testId: 'charts-tab',
modelConfig: {
route: 'default.charts',
switcher: {orientation: 'left'},
Expand Down
2 changes: 1 addition & 1 deletion client-app/src/desktop/tabs/charts/LineChartPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const lineChartPanel = hoistCmp.factory({
height: '60%',
mask: 'onLoad',
tbar: tbar(),
item: chart()
item: chart({testId: 'line-chart'})
}),
links: [
{
Expand Down
1 change: 1 addition & 0 deletions client-app/src/desktop/tabs/examples/ExamplesTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const appTile = hoistCmp.factory<ExamplesTabModel>(({app, model}) => {
title: app.title,
icon: app.icon,
compactHeader: true,
testId: app.title,
items: div({
className: 'tb-examples__app-tile__contents',
items: app.text
Expand Down
1 change: 1 addition & 0 deletions client-app/src/desktop/tabs/forms/FormsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {toolbarFormPanel} from './ToolbarFormPanel';

export const formsTab = hoistCmp.factory(() =>
tabContainer({
testId: 'forms-tab',
modelConfig: {
route: 'default.forms',
switcher: {orientation: 'left'},
Expand Down
9 changes: 7 additions & 2 deletions client-app/src/desktop/tabs/forms/InputsPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import {form, FormModel} from '@xh/hoist/cmp/form';
import {box, div, span, strong, filler, frame, hbox, hframe, vbox} from '@xh/hoist/cmp/layout';
import {box, div, filler, frame, hbox, hframe, span, strong, vbox} from '@xh/hoist/cmp/layout';
import {creates, hoistCmp, uses} from '@xh/hoist/core';
import {button} from '@xh/hoist/desktop/cmp/button';
import {formField} from '@xh/hoist/desktop/cmp/form';
Expand Down Expand Up @@ -28,6 +28,7 @@ import {wrapper} from '../../common';
import './InputsPanel.scss';
import {InputsPanelModel} from './InputsPanelModel';
import {menu, menuItem, popover} from '@xh/hoist/kit/blueprint';
import {TEST_ID} from '@xh/hoist/utils/js';

export const inputsPanel = hoistCmp.factory({
model: creates(InputsPanelModel),
Expand Down Expand Up @@ -71,6 +72,7 @@ export const inputsPanel = hoistCmp.factory({

const formContents = hoistCmp.factory<InputsPanelModel>(({model}) =>
form({
testId: 'hoist-inputs',
fieldDefaults: {
commitOnChange: model.commitOnChange
},
Expand Down Expand Up @@ -314,7 +316,7 @@ const formContents = hoistCmp.factory<InputsPanelModel>(({model}) =>
const row = hoistCmp.factory<FormModel>({
model: uses(FormModel),

render({model, label, field, info, readonlyRenderer, fmtVal, layout = {}, children}) {
render({model, label, field, info, readonlyRenderer, fmtVal, layout = {}, testId, children}) {
const fieldModel = model.fields[field];

if (!layout.width) layout.flex = 1;
Expand All @@ -328,6 +330,7 @@ const row = hoistCmp.factory<FormModel>({
item: children,
label,
info,
testId,
readonlyRenderer,
...layout
})
Expand Down Expand Up @@ -382,6 +385,7 @@ const bbar = hoistCmp.factory<InputsPanelModel>(({model}) => {
toolbarSep(),
switchInput({
model,
testId: 'inputs-panel-commit-radio',
bind: 'commitOnChange',
label: 'Commit on change'
})
Expand All @@ -399,6 +403,7 @@ const fieldDisplay = hoistCmp.factory(({fieldModel, fmtVal}) => {
}
}
return div({
[TEST_ID]: `inputs-panel-${fieldModel.name}`,
className: 'inputs-panel-field-display',
item: displayVal
});
Expand Down
1 change: 1 addition & 0 deletions client-app/src/desktop/tabs/grids/GridsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import './GridsTab.scss';

export const gridsTab = hoistCmp.factory(() =>
tabContainer({
testId: 'grids-tab',
modelConfig: {
route: 'default.grids',
tabs: [
Expand Down
2 changes: 1 addition & 1 deletion client-app/src/desktop/tabs/grids/StandardGridPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const standardGridPanel = hoistCmp.factory(() =>
title: 'Grids › Standard',
icon: Icon.gridPanel(),
className: 'tb-grid-wrapper-panel',
item: sampleGrid()
item: sampleGrid({testId: 'standard-grid'})
})
})
);
1 change: 1 addition & 0 deletions client-app/src/desktop/tabs/layout/LayoutTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {vboxContainerPanel} from './VBoxContainerPanel';

export const layoutTab = hoistCmp.factory(() =>
tabContainer({
testId: 'layout-tab',
modelConfig: {
route: 'default.layout',
switcher: {orientation: 'left'},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {switchInput, numberInput} from '@xh/hoist/desktop/cmp/input';
import {numberInput, switchInput} from '@xh/hoist/desktop/cmp/input';
import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
import React from 'react';
import {creates, hoistCmp, HoistModel, managed, XH} from '@xh/hoist/core';
Expand Down Expand Up @@ -45,7 +45,7 @@ export const dashCanvasPanel = hoistCmp.factory({
height: '80%',
width: '80%',
item: model.renderDashboard
? frame(dashCanvas())
? frame(dashCanvas({testId: 'dash-canvas'}))
: frame({
item: 'The Dashboard is not rendered now and has been unmounted. When rendered again, its previous state will be restored.',
padding: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const dashContainerPanel = hoistCmp.factory({
height: '80%',
width: '80%',
item: model.renderDashboard
? dashContainer()
? dashContainer({testId: 'dash-container'})
: frame({
item: 'The Dashboard is not rendered now and has been unmounted. When rendered again, its previous state will be restored.',
padding: 10
Expand Down
13 changes: 12 additions & 1 deletion client-app/src/desktop/tabs/other/ClockPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {bindable, makeObservable} from '@xh/hoist/mobx';
import {ONE_SECOND} from '@xh/hoist/utils/datetime';
import {wrapper} from '../../common';
import './ClockPanel.scss';
import {getTestId} from '@xh/hoist/utils/js';

export const clockPanel = hoistCmp.factory({
model: creates(() => ClockPanelModel),
Expand Down Expand Up @@ -87,7 +88,17 @@ const clockCard = hoistCmp.factory<ClockPanelModel>({
const {format, prefix, suffix, updateInterval} = model;
return vbox({
...rest,
items: [div(label), clock({timezone, format, prefix, suffix, updateInterval})]
items: [
div(label),
clock({
timezone,
format,
prefix,
suffix,
updateInterval,
testId: getTestId('clock', label)
})
]
});
}
});
Expand Down
5 changes: 3 additions & 2 deletions client-app/src/desktop/tabs/other/ErrorMessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {button} from '@xh/hoist/desktop/cmp/button';
import {errorMessage} from '@xh/hoist/desktop/cmp/error';
import {panel} from '@xh/hoist/desktop/cmp/panel';
import {Icon} from '@xh/hoist/icon';
import {makeObservable, bindable} from '@xh/hoist/mobx';
import {bindable, makeObservable} from '@xh/hoist/mobx';
import React from 'react';
import {wrapper} from '../../common';
import './ClockPanel.scss';
Expand Down Expand Up @@ -47,7 +47,8 @@ export const errorMessagePanel = hoistCmp.factory({
actionButtonProps: {
icon: Icon.refresh(),
onClick: () => model.toggleError()
}
},
testId: 'error-message'
}),
vframe({
omit: error,
Expand Down
1 change: 1 addition & 0 deletions client-app/src/desktop/tabs/other/OtherTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {relativeTimestampPanel} from './RelativeTimestampPanel';

export const otherTab = hoistCmp.factory(() =>
tabContainer({
testId: 'other-tab',
modelConfig: {
route: 'default.other',
switcher: {orientation: 'left'},
Expand Down
4 changes: 2 additions & 2 deletions client-app/src/desktop/tabs/other/PinPadPanel.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {creates, hoistCmp, HoistModel, managed} from '@xh/hoist/core';
import {h3, p} from '@xh/hoist/cmp/layout';
import {action, observable, makeObservable} from '@xh/hoist/mobx';
import {action, makeObservable, observable} from '@xh/hoist/mobx';
import {pinPad, PinPadModel} from '@xh/hoist/cmp/pinpad';
import {panel} from '@xh/hoist/desktop/cmp/panel';
import {button} from '@xh/hoist/desktop/cmp/button';
Expand Down Expand Up @@ -33,7 +33,7 @@ export const pinPadPanel = hoistCmp.factory({
width: 380,
height: 500,
className: 'tb-pinpad-container',
item: !model.loggedIn ? pinPad() : secretPlans(),
item: !model.loggedIn ? pinPad({testId: 'pinpad'}) : secretPlans(),
bbar: [
button({
text: 'Reset',
Expand Down
1 change: 1 addition & 0 deletions client-app/src/desktop/tabs/panels/PanelsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import './PanelsTab.scss';

export const panelsTab = hoistCmp.factory(() =>
tabContainer({
testId: 'panels-tab',
modelConfig: {
route: 'default.panels',
switcher: {orientation: 'left'},
Expand Down
11 changes: 7 additions & 4 deletions client-app/src/examples/todo/TaskDialog.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {uses, hoistCmp} from '@xh/hoist/core';
import {hoistCmp, uses} from '@xh/hoist/core';
import {Icon} from '@xh/hoist/icon';
import {filler, hbox, vbox} from '@xh/hoist/cmp/layout';
import {panel} from '@xh/hoist/desktop/cmp/panel';
Expand Down Expand Up @@ -30,12 +30,13 @@ export const taskDialog = hoistCmp.factory({

const formPanel = hoistCmp.factory(() =>
panel({
item: form(
vbox({
item: form({
testId: 'task-dialog',
item: vbox({
items: [description(), dueDate()],
className: 'todo-form'
})
),
}),
bbar: bbar()
})
);
Expand Down Expand Up @@ -68,10 +69,12 @@ const bbar = hoistCmp.factory<TaskDialogModel>(({model}) =>
toolbar(
filler(),
button({
testId: 'cancel-task-edit-button',
text: 'Cancel',
onClick: () => model.close()
}),
button({
testId: 'save-task-button',
text: 'OK',
icon: Icon.check(),
disabled: !model.formModel.isValid,
Expand Down
4 changes: 2 additions & 2 deletions client-app/src/examples/todo/TaskDialogModel.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {HoistModel, managed} from '@xh/hoist/core';
import {FormModel} from '@xh/hoist/cmp/form';
import {required, lengthIs} from '@xh/hoist/data';
import {lengthIs, required} from '@xh/hoist/data';
import {LocalDate} from '@xh/hoist/utils/datetime';
import {observable, action, makeObservable} from '@xh/hoist/mobx';
import {action, makeObservable, observable} from '@xh/hoist/mobx';
import {TodoPanelModel} from './TodoPanelModel';

export class TaskDialogModel extends HoistModel {
Expand Down
10 changes: 9 additions & 1 deletion client-app/src/examples/todo/TodoPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ export const todoPanel = hoistCmp.factory({
ref: model.panelRef,
mask: 'onLoad',
tbar: tbar(),
items: [grid({agOptions: {suppressMakeColumnVisibleAfterUnGroup: true}}), taskDialog()],
items: [
grid({
testId: 'todo-grid',
agOptions: {suppressMakeColumnVisibleAfterUnGroup: true}
}),
taskDialog()
],
bbar: bbar()
});
}
Expand Down Expand Up @@ -49,11 +55,13 @@ const bbar = hoistCmp.factory<TodoPanelModel>(({model}) =>
}),
'-',
switchInput({
testId: 'show-completed-switch',
bind: 'showCompleted',
label: 'Show Completed'
}),
filler(),
button({
testId: 'reset-button',
icon: Icon.reset(),
intent: 'danger',
tooltip: 'Reset to example defaults.',
Expand Down
Loading