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

feat: add ability to specify autoscreenshotSelector in story-files #21

Merged
merged 1 commit into from
Jun 7, 2024

Conversation

KuznetsovRoman
Copy link
Member

No description provided.

@@ -7,6 +7,7 @@ export interface StorybookStoryExtended extends StorybookStory {
assertViewOpts: AssertViewOpts;
browserIds: Array<string | RegExp> | null;
extraTests?: Record<string, TestplaneTestFunction>;
autoscreenshotSelector: string | null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это - внутренний тип стори, расширенный дополнительными полями

@@ -22,6 +22,7 @@ export type TestplaneMetaConfig<T = void> = Combined<
skip?: boolean;
assertViewOpts?: AssertViewOpts;
browserIds?: Array<string | RegExp>;
autoscreenshotSelector?: string;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это - внешний тип, используемый пользователем.

@@ -44,6 +44,7 @@ export function extendStoriesFromStoryFile(stories: StorybookStory[]): Storybook
story.skip = testplaneStoryOpts.skip || false;
story.assertViewOpts = testplaneStoryOpts.assertViewOpts || {};
story.browserIds = testplaneStoryOpts.browserIds || null;
story.autoscreenshotSelector = testplaneStoryOpts.autoscreenshotSelector || null;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Прокидываем в сторю селектор, аналогично остальным опциям из default export

@@ -24,7 +24,7 @@ function createTestplaneTests(story: StorybookStoryExtended, { autoScreenshots }

const result = await openStoryStep(ctx.browser, story);

await autoScreenshotStep(ctx.browser, result.rootSelector);
await autoScreenshotStep(ctx.browser, story.autoscreenshotSelector || result.rootSelector);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если в сторе указан селектор (который прорастает туда из дефолтного экспорта), то он имеет приоритет над стандартным

@KuznetsovRoman KuznetsovRoman merged commit 1306694 into master Jun 7, 2024
2 checks passed
@KuznetsovRoman KuznetsovRoman deleted the TESTPLANE-71.autoscreenshotSelector branch June 7, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants