-
Notifications
You must be signed in to change notification settings - Fork 165
chore: add config and tests for screenshots on playwright #3734
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
base: main
Are you sure you want to change the base?
Conversation
|
✅ Deploy Preview for adyen-web ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary of ChangesHello @johnayeni, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly upgrades the project's end-to-end testing infrastructure by integrating automated visual regression testing using Playwright. It introduces new configurations and scripts to manage visual tests, refactors existing test setups, and enhances Storybook components with test-specific attributes and loading indicators. The goal is to improve the reliability of UI changes and expand test coverage for various payment method states. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces visual regression testing using Playwright screenshots. It includes new configurations for visual tests, scripts to run them, and updates to Storybook components to facilitate testing by adding data-testid attributes and handling loading states. My review focuses on improving the maintainability of the test filtering logic and addressing some TypeScript typing inconsistencies in the new stories. Overall, this is a great step towards improving UI consistency and quality.
| const storyIds = allEntries | ||
| .filter( | ||
| entry => | ||
| entry.type === 'story' && | ||
| !entry.id.includes('dropin') && | ||
| !entry.id.includes('internal') && | ||
| !entry.id.includes('applepay') && | ||
| !entry.id.includes('amazonpay') && | ||
| !entry.id.includes('paybybankpix') && | ||
| !entry.id.includes('clicktopay') && | ||
| !entry.id.includes('paypal--express') && | ||
| !entry.id.includes('fastlane--lookup') && | ||
| !entry.id.includes('components-cards--card-with-3-ds-2-create-from-action') && | ||
| !entry.id.includes('helpers') | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current method of filtering stories to exclude from visual tests is a bit brittle as it relies on string matching against story IDs. If stories are renamed or moved, these filters might break silently.
A more robust and declarative approach would be to use Storybook tags. You could add a specific tag (e.g., 'no-visual-test') to the stories you want to exclude in their .stories.tsx file.
For example, in a story file:
export const MyStory: Story = {
// ...
tags: ['no-visual-test'],
};Then, you could simplify the filtering logic here to:
const storyIds = allEntries
.filter(
entry =>
entry.type === 'story' &&
!entry.tags.includes('no-visual-test')
)
.map(entry => entry.id);This would make the exclusion criteria more explicit and easier to manage directly from the story files.
| // @ts-expect-error instructionsUrl is not defined in VoucherConfiguration | ||
| instructionsUrl: 'https://example.com/instructions', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using @ts-expect-error here indicates a potential mismatch in types. The Econtext component is instantiated with props that are not defined in its EcontextConfiguration type, specifically instructionsUrl.
While @ts-expect-error works, a better long-term solution would be to improve the typings. You could create a more specific configuration type for Econtext that includes the properties for the voucher result view.
For example, you could define EcontextConfiguration to include these optional properties:
// in packages/lib/src/components/Econtext/types.ts
export interface EcontextConfiguration extends PersonalDetailsConfiguration, VoucherConfiguration {
instructionsUrl?: string;
collectionInstitutionNumber?: string;
maskedTelephoneNumber?: string;
expiresAt?: string;
}This would make the component's props type-safe and remove the need for @ts-expect-error. A similar issue exists in Oxxo.stories.tsx.
| // @ts-expect-error merchantReference is not defined in VoucherConfiguration | ||
| merchantReference: 'testmerchantreference', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use of @ts-expect-error suggests a typing issue. The Oxxo component is instantiated with merchantReference which is not part of VoucherConfiguration.
To improve type safety and remove the need for this comment, you could define a specific OxxoConfiguration type that extends VoucherConfiguration with the additional properties needed for the voucher result.
For example, in a new packages/lib/src/components/Oxxo/types.ts:
import { VoucherConfiguration, VoucherResultProps } from '../types';
export interface OxxoConfiguration extends VoucherConfiguration, Pick<VoucherResultProps, 'merchantReference' | 'alternativeReference' | 'downloadUrl' | 'expiresAt'> {}Then, you would update Oxxo.tsx to use UIElement<OxxoConfiguration> and this story to use StoryConfiguration<OxxoConfiguration>. This would provide better type checking and autocompletion.
|
size-limit report 📦
|
|
/screenshots |



📋 Pull Request Checklist
📝 Summary
🧪 Tested scenarios
🔗 Related GitHub Issue / Internal Ticket number
Closes: