-
Notifications
You must be signed in to change notification settings - Fork 297
docs: Add language-agnostic for Playwright testing doc #1956
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
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.
Pull Request Overview
This PR adds comprehensive documentation for language-agnostic testing in Playwright using the @shopware-ag/acceptance-test-suite
. The guide enables developers to write tests that work across multiple languages by using translation keys instead of hardcoded strings.
- Introduces the
translate()
function andTranslate
fixture for creating locale-aware tests - Provides detailed integration guide for custom projects with translation support
- Documents translation key patterns, file organization, and environment configuration
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
||
```bash | ||
# German | ||
lang=de npx playwright test |
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.
Environment variable assignment should use uppercase 'LANG' for consistency with other examples in the document and standard Unix conventions.
lang=de npx playwright test | |
LANG=de npx playwright test |
Copilot uses AI. Check for mistakes.
|
||
export const test = base.extend<CustomTranslateFixture>({ | ||
Translate: async ({}, use) => { | ||
let lang = process.env.lang || process.env.LANGUAGE || process.env.LANG || 'en'; |
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 environment variable check order should prioritize 'LANG' over 'lang' since 'LANG' is the standard Unix environment variable, and lowercase 'lang' appears to be a custom variable that's inconsistently used.
let lang = process.env.lang || process.env.LANGUAGE || process.env.LANG || 'en'; | |
let lang = process.env.LANG || process.env.LANGUAGE || process.env.lang || 'en'; |
Copilot uses AI. Check for mistakes.
38ad87e
to
14175e2
Compare
14175e2
to
e38e506
Compare
Correct formatting of code block for locales structure.
This pull request adds a comprehensive documentation guide for language-agnostic testing in Playwright using the
@shopware-ag/acceptance-test-suite
. The guide explains how to write tests that adapt to different locales by using translation keys and provides step-by-step instructions for integrating and customizing translation support in your own projects. It covers usage patterns, environment configuration, translation file organization, and common troubleshooting tips.Language-Agnostic Testing Concepts:
translate()
function and theTranslate
fixture for replacing hardcoded strings with translation keys in tests and page objects, enabling tests to work across multiple languages.Custom Integration and Extension:
Environment and Configuration: