diff --git a/.gitignore b/.gitignore index bfacec0e9..b345f606b 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,8 @@ next-env.d.ts /.nuxt/ /.output/ +# Playwright +/test-results/ +/playwright-report/ +/blob-report/ +/playwright/.cache/ diff --git a/package.json b/package.json index e6ceec410..1dac48b97 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "@biomejs/biome": "^2.2.2", "@commitlint/cli": "^19.8.1", "@commitlint/config-conventional": "^19.8.1", + "@playwright/test": "^1.55.0", "@testing-library/dom": "^10.4.1", "@testing-library/jest-dom": "^6.8.0", "@testing-library/react": "^16.3.0", diff --git a/packages/widget-playground/src/components/Card/ExpandableCard.tsx b/packages/widget-playground/src/components/Card/ExpandableCard.tsx index b149046e0..f21714ae0 100644 --- a/packages/widget-playground/src/components/Card/ExpandableCard.tsx +++ b/packages/widget-playground/src/components/Card/ExpandableCard.tsx @@ -14,6 +14,7 @@ interface ExpandableCardProps { title: ReactNode value: ReactNode alwaysShowTitleValue?: boolean + dataTestId?: string } export const ExpandableCard: FC> = ({ @@ -22,6 +23,7 @@ export const ExpandableCard: FC> = ({ value, children, alwaysShowTitleValue, + dataTestId, }) => { const { expanded, toggleExpanded } = useExpandableCard() const buttonId = useId() @@ -36,6 +38,7 @@ export const ExpandableCard: FC> = ({ onClick={toggleExpanded} disableRipple sx={{ p: 1 }} + data-testid={dataTestId} > {icon} diff --git a/packages/widget-playground/src/components/DrawerControls/CodeControl/CodeControl.tsx b/packages/widget-playground/src/components/DrawerControls/CodeControl/CodeControl.tsx index 48709cc0b..97d5f87ac 100644 --- a/packages/widget-playground/src/components/DrawerControls/CodeControl/CodeControl.tsx +++ b/packages/widget-playground/src/components/DrawerControls/CodeControl/CodeControl.tsx @@ -46,8 +46,18 @@ export const CodeControl = () => { indicatorColor="primary" onChange={(_, value) => setCodeControlTab(value)} > - - + + diff --git a/packages/widget-playground/src/components/DrawerControls/DesignControls/AppearanceControl.tsx b/packages/widget-playground/src/components/DrawerControls/DesignControls/AppearanceControl.tsx index d59309855..af2e2a21a 100644 --- a/packages/widget-playground/src/components/DrawerControls/DesignControls/AppearanceControl.tsx +++ b/packages/widget-playground/src/components/DrawerControls/DesignControls/AppearanceControl.tsx @@ -148,6 +148,7 @@ export const AppearanceControl = () => { {colorSchemeMode} } + dataTestId="appearance-section" > {restricted ? ( diff --git a/packages/widget-playground/src/components/DrawerControls/DesignControls/ButtonRaduisControl.tsx b/packages/widget-playground/src/components/DrawerControls/DesignControls/ButtonRaduisControl.tsx index c88f0f0ee..e1787b800 100644 --- a/packages/widget-playground/src/components/DrawerControls/DesignControls/ButtonRaduisControl.tsx +++ b/packages/widget-playground/src/components/DrawerControls/DesignControls/ButtonRaduisControl.tsx @@ -64,10 +64,14 @@ export const ButtonRadiusControl = () => { + {borderRadiusSecondary} } + dataTestId="button-radius-section" > {clickableValues.map((value) => { @@ -76,6 +80,7 @@ export const ButtonRadiusControl = () => { key={value.toString()} selected={borderRadiusSecondary === value && focused !== 'input'} onClick={() => handleButtonClick(value)} + data-testid="button-radius-value" onFocus={handleFocusButton} disableRipple > @@ -93,6 +98,7 @@ export const ButtonRadiusControl = () => { onBlur={handleBlurInput} inputProps={{ pattern: '[0-9]' }} onFocus={handleFocusInput} + data-testid="button-radius-custom-input" placeholder={focused === 'input' ? '' : 'Custom'} value={customValue} /> diff --git a/packages/widget-playground/src/components/DrawerControls/DesignControls/CardRadiusControl.tsx b/packages/widget-playground/src/components/DrawerControls/DesignControls/CardRadiusControl.tsx index 7f6495478..4b9ce0cee 100644 --- a/packages/widget-playground/src/components/DrawerControls/DesignControls/CardRadiusControl.tsx +++ b/packages/widget-playground/src/components/DrawerControls/DesignControls/CardRadiusControl.tsx @@ -66,6 +66,7 @@ export const CardRadiusControl = () => { {borderRadius} } + dataTestId="card-radius-section" > {clickableValues.map((value) => { diff --git a/packages/widget-playground/src/components/DrawerControls/DesignControls/ColorControls.tsx b/packages/widget-playground/src/components/DrawerControls/DesignControls/ColorControls.tsx index 9228d1200..a9ee2a433 100644 --- a/packages/widget-playground/src/components/DrawerControls/DesignControls/ColorControls.tsx +++ b/packages/widget-playground/src/components/DrawerControls/DesignControls/ColorControls.tsx @@ -35,7 +35,11 @@ export const ColorControl = () => { const { themeMode } = useThemeMode() const editableColors = getEditableColors(themeMode) return ( - }> + } + dataTestId="color-section" + > {Object.entries(editableColors).map(([colorName, colorConfigPath]) => ( { )} } + dataTestId="fonts-section" value={selectedFont?.family} > {selectedFont && ( diff --git a/packages/widget-playground/src/components/DrawerControls/DesignControls/LayoutControls/LayoutControl.tsx b/packages/widget-playground/src/components/DrawerControls/DesignControls/LayoutControls/LayoutControl.tsx index 214249866..0774bfc1c 100644 --- a/packages/widget-playground/src/components/DrawerControls/DesignControls/LayoutControls/LayoutControl.tsx +++ b/packages/widget-playground/src/components/DrawerControls/DesignControls/LayoutControls/LayoutControl.tsx @@ -176,6 +176,7 @@ export const LayoutControl = () => { ?.name || ''} } + dataTestId="layout-section" > { title={'Playground settings'} value={} alwaysShowTitleValue + dataTestId="playground-settings-section" > diff --git a/packages/widget-playground/src/components/DrawerControls/DesignControls/SkeletonControl.tsx b/packages/widget-playground/src/components/DrawerControls/DesignControls/SkeletonControl.tsx index 529f92d7f..cece44cb9 100644 --- a/packages/widget-playground/src/components/DrawerControls/DesignControls/SkeletonControl.tsx +++ b/packages/widget-playground/src/components/DrawerControls/DesignControls/SkeletonControl.tsx @@ -40,6 +40,7 @@ export const SkeletonControl = () => { {isSkeletonShown ? 'shown' : 'hidden'} } + dataTestId="skeleton-section" > Show skeleton diff --git a/packages/widget-playground/src/components/DrawerControls/DesignControls/SubvariantControl.tsx b/packages/widget-playground/src/components/DrawerControls/DesignControls/SubvariantControl.tsx index 40068f5c4..48cbf52a8 100644 --- a/packages/widget-playground/src/components/DrawerControls/DesignControls/SubvariantControl.tsx +++ b/packages/widget-playground/src/components/DrawerControls/DesignControls/SubvariantControl.tsx @@ -45,6 +45,7 @@ export const SubvariantControl = () => { value={ {subvariant} } + dataTestId="subvariant-section" > { {selectedThemeItem?.name ? selectedThemeItem?.name : 'default'} } + dataTestId="theme-section" >