Skip to content

Commit e910c9d

Browse files
authored
chore: fix visual tests (Punctuation) (#1017)
1 parent da3e730 commit e910c9d

7 files changed

Lines changed: 14 additions & 12 deletions

File tree

demo/scripts/playwright-docker.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,14 @@ fi
6666

6767
if [[ "$1" = "update" ]]; then
6868
echo "Running playwright tests (update)"
69+
EXTRA_ARGS=""
70+
if [[ $# -ge 2 ]]; then
71+
for arg in "${@:2}"; do
72+
EXTRA_ARGS="$EXTRA_ARGS $(printf '%q' "$arg")"
73+
done
74+
fi
6975
run_command 'COREPACK_INTEGRITY_KEYS=0 corepack pnpm --filter '@gravity-ui/*' build'
70-
run_command 'COREPACK_INTEGRITY_KEYS=0 corepack pnpm --filter '@markdown-editor/demo' run playwright:update'
76+
run_command "cd demo && COREPACK_INTEGRITY_KEYS=0 corepack pnpm exec playwright test --config=tests/playwright/playwright.config.ts -u $EXTRA_ARGS"
7177
exit 0
7278
fi
7379

demo/src/stories/markdown/Markdown.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const PunctuationBoundaries: StoryObj<typeof component> = {
6161
initial: markup.punctuationBoundaries,
6262
initialEditor: 'markup',
6363
initialSplitModeEnabled: true,
64-
splitModeOrientation: 'horizontal',
64+
splitModeOrientation: 'vertical',
6565
},
6666
};
6767

demo/tests/playwright/core/mount.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const mount: PlaywrightFixture<MountFixture> = async ({mount: baseMount},
3535
`}
3636
</style>
3737
)}
38+
{options?.styles && <style>{options.styles}</style>}
3839
{component}
3940
</div>,
4041
options,

demo/tests/playwright/core/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface ComponentFixtures {
2424
width?: number | string;
2525
rootStyle?: React.CSSProperties;
2626
hidePlaygroundBlocks?: boolean;
27+
styles?: string;
2728
},
2829
): Promise<MountResult>;
2930
}

demo/tests/visual-tests/MarkdownExtensions.visual.test.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,12 @@ test.describe('Extensions, Markdown', () => {
5151
await mount(<MarkdownStories.DefinitionList />);
5252
await expectScreenshot();
5353
});
54-
test('Punctuation boundaries', async ({mount, expectScreenshot, page}) => {
55-
await page.setViewportSize({width: 1280, height: 1400});
54+
test('Punctuation boundaries', async ({page, mount, expectScreenshot}) => {
5655
await mount(<MarkdownStories.PunctuationBoundaries />, {
57-
rootStyle: {height: 'auto', width: 1200},
58-
});
59-
await page.addStyleTag({
60-
content:
61-
'.cm-editor { height: auto !important; } .cm-scroller { overflow: visible !important; }',
56+
hidePlaygroundBlocks: true,
57+
styles: '.cm-editor { height: auto !important; } .cm-scroller { overflow: visible !important; }',
6258
});
6359
await page.waitForTimeout(300);
64-
await expectScreenshot({
65-
component: page.locator('.playwright-wrapper-test'),
66-
});
60+
await expectScreenshot();
6761
});
6862
});
Loading
Loading

0 commit comments

Comments
 (0)