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

Use Playwright with Storybook for component tests in fast-foundation #6189

Merged
merged 92 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
a6cf6c5
add playwright and remove karma from fast-foundation
radium-v Aug 26, 2022
bfc31f3
make ElementsFilter type arguments optional
radium-v Aug 26, 2022
7878ad2
convert utilities tests to playwright
radium-v Aug 26, 2022
794c798
convert accordion tests to playwright
radium-v Aug 26, 2022
b009ee2
convert accordion-item tests to playwright
radium-v Aug 26, 2022
943047c
convert anchor tests to playwright
radium-v Aug 26, 2022
d3c2f12
convert anchored-region tests to playwright
radium-v Aug 26, 2022
b2f5d66
add slottedBreadcrumbItemFilter
radium-v Aug 26, 2022
05e7d5b
convert breadcrumb tests to playwright
radium-v Aug 26, 2022
2872c4a
convert breadcrumb-item tests to playwright
radium-v Aug 26, 2022
bf20a0b
mark formnovalidate as boolean attribute in button template
radium-v Aug 26, 2022
cf5d7a3
convert breadcrumb-item tests to playwright
radium-v Aug 26, 2022
ef2461c
convert button tests to playwright
radium-v Aug 26, 2022
642d519
clean up extra spacing in checkbox template
radium-v Aug 26, 2022
0b376fc
convert checkbox tests to playwright
radium-v Aug 26, 2022
eba0972
reset combobox value if no first selected option
radium-v Aug 26, 2022
f36dcee
convert combobox tests to playwright
radium-v Aug 26, 2022
a3eef88
allow cell templates to be SyntheticViewTemplate or string
radium-v Aug 26, 2022
d39d927
use lookup for data-grid-cell template role and class
radium-v Aug 26, 2022
8bf0df5
convert data-grid tests to playwright
radium-v Aug 26, 2022
f0d5758
convert data-grid-row tests to playwright
radium-v Aug 26, 2022
2c94cbb
convert data-grid-cell tests to playwright
radium-v Aug 26, 2022
b792867
convert dialog tests to playwright
radium-v Aug 26, 2022
0229e27
convert disclosure tests to playwright
radium-v Aug 26, 2022
ac8123d
convert divider tests to playwright
radium-v Aug 26, 2022
cd75a0d
convert flipper tests to playwright
radium-v Aug 26, 2022
f2fb86c
convert horizontal-scroll tests to playwright
radium-v Aug 26, 2022
27cc055
convert listbox-option tests to playwright
radium-v Aug 26, 2022
f8a565f
convert listbox tests to playwright
radium-v Aug 26, 2022
68742f4
menu should not navigate to hidden items when set after connection
radium-v Aug 26, 2022
cd55a87
convert menu tests to playwright
radium-v Aug 26, 2022
62d35ab
convert menu-item tests to playwright
radium-v Aug 26, 2022
6107038
convert number-field tests to playwright
radium-v Aug 26, 2022
bf3b78e
convert progress tests to playwright
radium-v Aug 26, 2022
5ccf26b
convert progress-ring tests to playwright
radium-v Aug 26, 2022
af66f57
convert radiogroup tests to playwright
radium-v Aug 26, 2022
64d962e
convert radio tests to playwright
radium-v Aug 26, 2022
8eca288
convert search tests to playwright
radium-v Aug 26, 2022
4d2c2b2
convert select tests to playwright
radium-v Aug 26, 2022
896429c
ensure slider value is within min and max limits
radium-v Aug 26, 2022
c1d1a06
convert slider tests to playwright
radium-v Aug 26, 2022
d2e3984
convert slider-label tests to playwright
radium-v Aug 26, 2022
c321bfd
use whitespaceFilter with switch template
radium-v Aug 26, 2022
ea0e459
convert switch tests to playwright
radium-v Aug 26, 2022
b9e5d46
convert tab tests to playwright
radium-v Aug 26, 2022
a32808d
convert tab-panel tests to playwright
radium-v Aug 26, 2022
36d37d1
convert tabs tests to playwright
radium-v Aug 26, 2022
aa2da1d
convert text-area tests to playwright
radium-v Aug 26, 2022
fbcd718
convert text-field tests to playwright
radium-v Aug 26, 2022
97797ba
convert toolbar tests to playwright
radium-v Aug 26, 2022
937f75d
convert tooltip tests to playwright
radium-v Aug 26, 2022
472be9f
add ARIA attributes to tree-item
radium-v Aug 26, 2022
e311e0d
convert tree-item tests to playwright
radium-v Aug 26, 2022
bddf0bd
convert tree-view tests to playwright
radium-v Aug 26, 2022
5803aa6
update api-report.md
radium-v Aug 26, 2022
e9eb9af
update lockfile
radium-v Aug 26, 2022
e39cf91
Change files
radium-v Aug 26, 2022
1a99b0b
wip
radium-v Aug 30, 2022
c125bf7
update playwright
radium-v Sep 15, 2022
072753b
update api-report.md
radium-v Sep 15, 2022
b59c20d
update imports
radium-v Sep 15, 2022
2fbe4d1
menu tests
radium-v Sep 15, 2022
82dd664
tooltip tests
radium-v Sep 15, 2022
f94eb6e
text-area tests
radium-v Sep 15, 2022
6f73dfb
progress tests
radium-v Sep 15, 2022
666a48d
horizontal-scroll tests
radium-v Sep 15, 2022
6e8d5c1
toolbar tests
radium-v Sep 15, 2022
39eedfc
make dialog tests syncronous
radium-v Sep 15, 2022
aea8602
finish converting all tests to be synchronous
radium-v Sep 16, 2022
36628d1
remove attribute enumeration
radium-v Sep 16, 2022
00e6a63
remove positioningRegion from radio-group
radium-v Sep 16, 2022
857c7c0
fix flaky tree-item test
radium-v Sep 16, 2022
f41fc40
ensure aria-expanded is only set when the tree-item has children
radium-v Sep 16, 2022
0464e76
simplify rewritten combobox form reset fix
radium-v Sep 16, 2022
d10c609
revert breadcrumb and breadcrumb item changes
radium-v Sep 16, 2022
801ab6a
revert checkbox template changes
radium-v Sep 16, 2022
855f14e
use regex for toHaveClass assertions
radium-v Sep 16, 2022
5a24878
revert unrelated number-field changes
radium-v Sep 16, 2022
cea8bc3
remove unused import from radio-group template
radium-v Sep 16, 2022
e6d2856
revert unrelated search template changes
radium-v Sep 16, 2022
7b88c02
revert unrelated switch template changes
radium-v Sep 16, 2022
552dc6f
revert unrelated text-area template changes
radium-v Sep 16, 2022
c1f96f3
revert unrelated text-field class and template changes
radium-v Sep 16, 2022
08d31db
revert unrelated tree-item and tree-view changes
radium-v Sep 16, 2022
290b6ea
make tree-view tests synchronous
radium-v Sep 16, 2022
303332c
revert unrelated radio-group changes
radium-v Sep 16, 2022
0014807
revert unrelated search template changes
radium-v Sep 16, 2022
eb50455
revert unrelated text-field template changes
radium-v Sep 16, 2022
f826895
update api-report and READMEs
radium-v Sep 16, 2022
f68441e
revert unrelated combobox changes
radium-v Sep 16, 2022
ad81104
revert unrelated data-grid-row template changes
radium-v Sep 16, 2022
cdd7659
revert unrelated menu-item template changes
radium-v Sep 17, 2022
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Never lint test files
*.spec.ts
!*.pw.spec.ts

# Never lint node_modules
node_modules
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.spec.ts
!*.pw.spec.ts
*.spec.tsx
**/__tests__
**/__test__
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "make ElementsFilter type arguments optional",
"packageName": "@microsoft/fast-element",
"email": "[email protected]",
"dependentChangeType": "prerelease"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Convert karma and mocha tests to playwright",
"packageName": "@microsoft/fast-foundation",
"email": "[email protected]",
"dependentChangeType": "prerelease"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "update playwright",
"packageName": "@microsoft/fast-ssr",
"email": "[email protected]",
"dependentChangeType": "prerelease"
}
2 changes: 1 addition & 1 deletion packages/web-components/fast-element/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export class ElementController<TElement extends HTMLElement = HTMLElement> exten
export const elements: (selector?: string) => ElementsFilter;

// @public
export type ElementsFilter = (value: Node, index: number, array: Node[]) => boolean;
export type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;

// @public
export class ElementStyles {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface NodeBehaviorOptions<T = any> {
*
* @public
*/
export type ElementsFilter = (value: Node, index: number, array: Node[]) => boolean;
export type ElementsFilter = (value: Node, index?: number, array?: Node[]) => boolean;

const selectElements = (value: Node): boolean => value.nodeType === 1;

Expand Down
13 changes: 4 additions & 9 deletions packages/web-components/fast-foundation/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# don't ever lint node_modules
node_modules
# don't lint build output (make sure it's set to your correct build folder name)
dist
# don't lint coverage output
coverage
# don't lint tests
*.spec.*
#
karma.conf.cjs
dist
node_modules
*.spec.ts
!*.pw.spec.ts
2 changes: 1 addition & 1 deletion packages/web-components/fast-foundation/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"no-restricted-imports": [
"error",
{
"patterns": ["**/stories/**"]
"patterns": ["**/stories/**", "**/*.pw.spec.ts"]
}
]
}
Expand Down
9 changes: 0 additions & 9 deletions packages/web-components/fast-foundation/.mocharc.json

This file was deleted.

22 changes: 20 additions & 2 deletions packages/web-components/fast-foundation/.storybook/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@ module.exports = {
},
core: {
disableTelemetry: true,
builder: "webpack5",
builder: {
name: "webpack5",
options: {
lazyCompilation: true,
fsCache: true,
},
},
},
webpackFinal: async config => {
config.performance = {
...(config.performance ?? {}),
hints: false,
};
config.module.rules = [
{
test: /\.ts$/,
Expand All @@ -23,10 +33,18 @@ module.exports = {
transpileOnly: true,
},
},
{
test: /\.m?js$/,
enforce: "pre",
loader: require.resolve("source-map-loader"),
resolve: {
fullySpecified: false,
},
},
];

config.resolve.plugins = [
...(config.resolve.plugins || []),
...(config.resolve.plugins ?? []),
new ResolveTypescriptPlugin({
includeNodeModules: true,
}),
Expand Down

This file was deleted.

9 changes: 9 additions & 0 deletions packages/web-components/fast-foundation/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useArgs } from "@storybook/client-api";

import "@microsoft/fast-element/polyfills";
import "../src/anchor/stories/anchor.register.js";
import "../src/anchored-region/stories/anchored-region.register.js";
Expand Down Expand Up @@ -56,3 +58,10 @@ import "../src/menu/stories/menu.register.js";

import "../src/tree-item/stories/tree-item.register.js";
import "../src/tree-view/stories/tree-view.register.js";

export const decorators = [
(Story, context) => {
const [_, updateArgs] = useArgs();
return Story({ ...context, updateArgs });
},
];
80 changes: 53 additions & 27 deletions packages/web-components/fast-foundation/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import type { CaptureType } from '@microsoft/fast-element';
import { composedContains } from '@microsoft/fast-element/utilities';
import { composedParent } from '@microsoft/fast-element/utilities';
import { Constructable } from '@microsoft/fast-element';
import { CSSDirective } from '@microsoft/fast-element';
import type { CSSDirective } from '@microsoft/fast-element';
import { Direction } from '@microsoft/fast-web-utilities';
import type { ElementsFilter } from '@microsoft/fast-element';
import { ElementStyles } from '@microsoft/fast-element';
import { ElementViewTemplate } from '@microsoft/fast-element';
import { FASTElement } from '@microsoft/fast-element';
Expand Down Expand Up @@ -269,12 +270,12 @@ export function checkboxTemplate<T extends FASTCheckbox>(options?: CheckboxOptio
export interface ColumnDefinition {
cellFocusTargetCallback?: (cell: FASTDataGridCell) => HTMLElement;
cellInternalFocusQueue?: boolean;
cellTemplate?: ViewTemplate;
cellTemplate?: ViewTemplate | SyntheticViewTemplate | string;
columnDataKey: string;
gridColumn?: string;
headerCellFocusTargetCallback?: (cell: FASTDataGridCell) => HTMLElement;
headerCellInternalFocusQueue?: boolean;
headerCellTemplate?: ViewTemplate;
headerCellTemplate?: ViewTemplate | SyntheticViewTemplate | string;
isRowHeader?: boolean;
title?: string;
}
Expand Down Expand Up @@ -513,6 +514,20 @@ export class DelegatesARIAToolbar {
export interface DelegatesARIAToolbar extends ARIAGlobalStatesAndProperties {
}

// Warning: (ae-different-release-tags) This symbol has another declaration with a different release tag
// Warning: (ae-internal-mixed-release-tag) Mixed release tags are not allowed for "DelegatesARIATreeItem" because one of its declarations is marked as @internal
//
// @public
export class DelegatesARIATreeItem {
ariaDisabled: "true" | "false" | string | null;
ariaExpanded: "true" | "false" | string | null;
ariaSelected: "true" | "false" | string | null;
}

// @internal
export interface DelegatesARIATreeItem extends ARIAGlobalStatesAndProperties {
}

// @public
export type DerivedDesignTokenValue<T> = (resolve: DesignTokenResolver) => T;

Expand Down Expand Up @@ -777,10 +792,11 @@ export class FASTBaseProgress extends FASTElement {

// @public
export class FASTBreadcrumb extends FASTElement {
static slottedBreadcrumbItemFilter: (n: HTMLElement) => boolean;
// @internal (undocumented)
slottedBreadcrumbItems: HTMLElement[];
// (undocumented)
protected slottedBreadcrumbItemsChanged(): void;
protected slottedBreadcrumbItemsChanged(prev: Element[] | undefined, next: Element[] | undefined): void;
}

// Warning: (ae-different-release-tags) This symbol has another declaration with a different release tag
Expand Down Expand Up @@ -1327,14 +1343,16 @@ export class FASTMenu extends FASTElement {
// @internal (undocumented)
disconnectedCallback(): void;
focus(): void;
// (undocumented)
handleChange(source: any, propertyName: string): void;
// @internal
handleFocusOut: (e: FocusEvent) => void;
// @internal (undocumented)
handleMenuKeyDown(e: KeyboardEvent): void | boolean;
// @internal (undocumented)
readonly isNestedMenu: () => boolean;
// @internal (undocumented)
items: HTMLSlotElement;
items: HTMLElement[];
// (undocumented)
protected itemsChanged(oldValue: HTMLElement[], newValue: HTMLElement[]): void;
}
Expand Down Expand Up @@ -1367,6 +1385,7 @@ export class FASTMenuItem extends FASTElement {
handleMouseOver: (e: MouseEvent) => boolean;
// @internal (undocumented)
hasSubmenu: boolean;
hidden: boolean;
role: MenuItemRole;
// @internal (undocumented)
startColumnCount: MenuItemColumnCount;
Expand Down Expand Up @@ -1630,7 +1649,9 @@ export class FASTRadioGroup extends FASTElement {
name: string;
// (undocumented)
protected nameChanged(): void;
orientation: Orientation | "horizontal" | "vertical";
orientation: Orientation;
// (undocumented)
positioningRegion: HTMLDivElement;
readOnly: boolean;
// (undocumented)
protected readOnlyChanged(): void;
Expand Down Expand Up @@ -1770,6 +1791,8 @@ export class FASTSkeleton extends FASTElement {
//
// @public
export class FASTSlider extends FormAssociatedSlider implements SliderConfiguration {
// @internal
calculateNewValue(rawValue: number): number;
// @internal (undocumented)
connectedCallback(): void;
decrement(): void;
Expand Down Expand Up @@ -1970,7 +1993,7 @@ export interface FASTTextArea extends DelegatesARIATextbox {
export class FASTTextField extends FormAssociatedTextField {
autofocus: boolean;
// (undocumented)
protected autofocusChanged(): void;
protected autofocusChanged(prev: boolean | undefined, next: boolean): void;
// @internal (undocumented)
connectedCallback(): void;
// @internal
Expand All @@ -1983,29 +2006,29 @@ export class FASTTextField extends FormAssociatedTextField {
handleTextInput(): void;
list: string;
// (undocumented)
protected listChanged(): void;
maxlength: number;
protected listChanged(prev: string | undefined, next: string): void;
maxlength: number | null;
// (undocumented)
protected maxlengthChanged(): void;
minlength: number;
protected maxlengthChanged(prev: number | null | undefined, next: number | null): void;
minlength: number | null;
// (undocumented)
protected minlengthChanged(): void;
protected minlengthChanged(prev: number | null | undefined, next: number | null): void;
pattern: string;
// (undocumented)
protected patternChanged(): void;
protected patternChanged(prev: string | undefined, next: string): void;
placeholder: string;
// (undocumented)
protected placeholderChanged(): void;
protected placeholderChanged(prev: string | undefined, next: string): void;
readOnly: boolean;
// (undocumented)
protected readOnlyChanged(): void;
protected readOnlyChanged(prev: boolean | undefined, next: boolean): void;
select(): void;
size: number;
size: number | null;
// (undocumented)
protected sizeChanged(): void;
protected sizeChanged(prev: number | null | undefined, next: number | null): void;
spellcheck: boolean;
// (undocumented)
protected spellcheckChanged(): void;
protected spellcheckChanged(prev: boolean | undefined, next: boolean): void;
type: TextFieldType;
validate(): void;
}
Expand Down Expand Up @@ -2108,39 +2131,39 @@ export class FASTTooltip extends FASTElement {
//
// @public
export class FASTTreeItem extends FASTElement {
// @internal
childItemLength(): number;
// @internal (undocumented)
childItems: HTMLElement[];
disabled: boolean;
// (undocumented)
protected disabledChanged(prev: boolean | undefined, next: boolean): void;
// @internal
expandCollapseButton: HTMLDivElement;
expanded: boolean;
// (undocumented)
protected expandedChanged(): void;
protected expandedChanged(prev: boolean | undefined, next: boolean): void;
// @internal
focusable: boolean;
static focusItem(el: HTMLElement): void;
// @internal
handleBlur: (e: FocusEvent) => void;
// @internal
handleExpandCollapseButtonClick: (e: MouseEvent) => void;
handleExpandCollapseButtonClick: (e: MouseEvent) => boolean | void;
// @internal
handleFocus: (e: FocusEvent) => void;
readonly isNestedItem: () => boolean;
// @internal
items: HTMLElement[];
// (undocumented)
protected itemsChanged(oldValue: unknown, newValue: HTMLElement[]): void;
protected itemsChanged(prev: HTMLElement[] | undefined, next: HTMLElement[]): void;
// @internal
nested: boolean;
selected: boolean;
// (undocumented)
protected selectedChanged(): void;
protected selectedChanged(prev: boolean | undefined, next: boolean): void;
}

// @internal
export interface FASTTreeItem extends StartEnd {
export interface FASTTreeItem extends StartEnd, DelegatesARIATreeItem {
}

// @public
Expand Down Expand Up @@ -2333,11 +2356,14 @@ export type HorizontalScrollView = typeof HorizontalScrollView[keyof typeof Hori
// @internal
export function interactiveCalendarGridTemplate<T extends FASTCalendar>(options: CalendarOptions, todayString: string): ViewTemplate<T>;

// @public
export function isBreadcrumbItem(element: Element): element is FASTBreadcrumbItem;

// @public
export function isListboxOption(el: Element): el is FASTListboxOption;

// @public
export function isTreeItemElement(el: Element): el is HTMLElement;
export function isTreeItemElement(el: Element): el is FASTTreeItem;

// @public
export const lightModeStylesheetBehavior: (styles: ElementStyles) => MatchMediaStyleSheetBehavior;
Expand Down Expand Up @@ -2795,7 +2821,7 @@ export type WeekdayText = {
};

// @public
export function whitespaceFilter(value: Node, index: number, array: Node[]): boolean;
export const whitespaceFilter: ElementsFilter;

// @public
export const YearFormat: {
Expand Down
Loading