Repository navigation
docs(component-testing): split guides into a dedicated category #2194
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| --- | ||
| id: test-components-faq | ||
| title: "Frequently asked questions" | ||
| --- | ||
| import Tabs from '@theme/Tabs'; | ||
| import TabItem from '@theme/TabItem'; | ||
| import HTMLCard from '@site/src/components/HTMLCard'; | ||
|
|
||
| ## Frequently asked questions | ||
|
|
||
| ### How do I access the component's methods or its instance? | ||
|
|
||
| Accessing a component's internal methods or its instance within test code is neither recommended nor supported. Instead, focus on observing and interacting with the component from a user's perspective — click it, look at the page, and record internal effects into the DOM through the story. Tests become less fragile and more valuable when they avoid implementation details. If a test fails when run from a user's perspective, it likely means the automated test has uncovered a genuine bug. | ||
|
|
||
| ### Can I keep using my bundler plugins, aliases and CSS setup? | ||
|
|
||
| Yes — that is the core of the design. The gallery is served by your own dev server, so whatever your app can render, your stories can render. There is no second bundler config to keep in sync. | ||
|
|
||
| ### What about frameworks other than React and Vue? | ||
|
|
||
| Ask your coding agent to implement the gallery contract for your framework: resolve a story id to a component, render it into `#root`, reuse the root across calls so `update()` preserves state. The `mount` fixture does not know or care which framework is on the other side. | ||
|
|
||
|
|
||
| [APIRequest]: /api/class-apirequest.mdx "APIRequest" | ||
| [APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext" | ||
| [APIResponse]: /api/class-apiresponse.mdx "APIResponse" | ||
| [APIResponseAssertions]: /api/class-apiresponseassertions.mdx "APIResponseAssertions" | ||
| [Browser]: /api/class-browser.mdx "Browser" | ||
| [BrowserContext]: /api/class-browsercontext.mdx "BrowserContext" | ||
| [BrowserServer]: /api/class-browserserver.mdx "BrowserServer" | ||
| [BrowserType]: /api/class-browsertype.mdx "BrowserType" | ||
| [CDPSession]: /api/class-cdpsession.mdx "CDPSession" | ||
| [Clock]: /api/class-clock.mdx "Clock" | ||
| [ConsoleMessage]: /api/class-consolemessage.mdx "ConsoleMessage" | ||
| [Coverage]: /api/class-coverage.mdx "Coverage" | ||
| [Credentials]: /api/class-credentials.mdx "Credentials" | ||
| [Debugger]: /api/class-debugger.mdx "Debugger" | ||
| [Dialog]: /api/class-dialog.mdx "Dialog" | ||
| [Disposable]: /api/class-disposable.mdx "Disposable" | ||
| [Download]: /api/class-download.mdx "Download" | ||
| [ElementHandle]: /api/class-elementhandle.mdx "ElementHandle" | ||
| [FileChooser]: /api/class-filechooser.mdx "FileChooser" | ||
| [Frame]: /api/class-frame.mdx "Frame" | ||
| [FrameLocator]: /api/class-framelocator.mdx "FrameLocator" | ||
| [GenericAssertions]: /api/class-genericassertions.mdx "GenericAssertions" | ||
| [JSHandle]: /api/class-jshandle.mdx "JSHandle" | ||
| [Keyboard]: /api/class-keyboard.mdx "Keyboard" | ||
| [Locator]: /api/class-locator.mdx "Locator" | ||
| [LocatorAssertions]: /api/class-locatorassertions.mdx "LocatorAssertions" | ||
| [Logger]: /api/class-logger.mdx "Logger" | ||
| [Mouse]: /api/class-mouse.mdx "Mouse" | ||
| [Page]: /api/class-page.mdx "Page" | ||
| [PageAssertions]: /api/class-pageassertions.mdx "PageAssertions" | ||
| [Playwright]: /api/class-playwright.mdx "Playwright" | ||
| [PlaywrightAssertions]: /api/class-playwrightassertions.mdx "PlaywrightAssertions" | ||
| [Request]: /api/class-request.mdx "Request" | ||
| [Response]: /api/class-response.mdx "Response" | ||
| [Route]: /api/class-route.mdx "Route" | ||
| [Screencast]: /api/class-screencast.mdx "Screencast" | ||
| [Selectors]: /api/class-selectors.mdx "Selectors" | ||
| [SnapshotAssertions]: /api/class-snapshotassertions.mdx "SnapshotAssertions" | ||
| [TimeoutError]: /api/class-timeouterror.mdx "TimeoutError" | ||
| [Touchscreen]: /api/class-touchscreen.mdx "Touchscreen" | ||
| [Tracing]: /api/class-tracing.mdx "Tracing" | ||
| [Video]: /api/class-video.mdx "Video" | ||
| [WebError]: /api/class-weberror.mdx "WebError" | ||
| [WebMCP]: /api/class-webmcp.mdx "WebMCP" | ||
| [WebSocket]: /api/class-websocket.mdx "WebSocket" | ||
| [WebSocketRoute]: /api/class-websocketroute.mdx "WebSocketRoute" | ||
| [WebStorage]: /api/class-webstorage.mdx "WebStorage" | ||
| [Worker]: /api/class-worker.mdx "Worker" | ||
| [Electron]: /api/class-electron.mdx "Electron" | ||
| [ElectronApplication]: /api/class-electronapplication.mdx "ElectronApplication" | ||
| [Android]: /api/class-android.mdx "Android" | ||
| [AndroidDevice]: /api/class-androiddevice.mdx "AndroidDevice" | ||
| [AndroidInput]: /api/class-androidinput.mdx "AndroidInput" | ||
| [AndroidSocket]: /api/class-androidsocket.mdx "AndroidSocket" | ||
| [AndroidWebView]: /api/class-androidwebview.mdx "AndroidWebView" | ||
| [Fixtures]: /api/class-fixtures.mdx "Fixtures" | ||
| [FullConfig]: /api/class-fullconfig.mdx "FullConfig" | ||
| [FullProject]: /api/class-fullproject.mdx "FullProject" | ||
| [Location]: /api/class-location.mdx "Location" | ||
| [Test]: /api/class-test.mdx "Test" | ||
| [TestConfig]: /api/class-testconfig.mdx "TestConfig" | ||
| [TestInfo]: /api/class-testinfo.mdx "TestInfo" | ||
| [TestInfoError]: /api/class-testinfoerror.mdx "TestInfoError" | ||
| [TestOptions]: /api/class-testoptions.mdx "TestOptions" | ||
| [TestProject]: /api/class-testproject.mdx "TestProject" | ||
| [TestStepInfo]: /api/class-teststepinfo.mdx "TestStepInfo" | ||
| [WorkerInfo]: /api/class-workerinfo.mdx "WorkerInfo" | ||
| [Reporter]: /api/class-reporter.mdx "Reporter" | ||
| [Suite]: /api/class-suite.mdx "Suite" | ||
| [TestCase]: /api/class-testcase.mdx "TestCase" | ||
| [TestError]: /api/class-testerror.mdx "TestError" | ||
| [TestResult]: /api/class-testresult.mdx "TestResult" | ||
| [TestRun]: /api/class-testrun.mdx "TestRun" | ||
| [TestStep]: /api/class-teststep.mdx "TestStep" | ||
| [Element]: https://developer.mozilla.org/en-US/docs/Web/API/element "Element" | ||
| [EvaluationArgument]: /evaluating.mdx#evaluation-argument "EvaluationArgument" | ||
| [Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise" | ||
| [iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols "Iterator" | ||
| [origin]: https://developer.mozilla.org/en-US/docs/Glossary/Origin "Origin" | ||
| [selector]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors "selector" | ||
| [Serializable]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#Description "Serializable" | ||
| [UIEvent.detail]: https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail "UIEvent.detail" | ||
| [UnixTime]: https://en.wikipedia.org/wiki/Unix_time "Unix Time" | ||
| [xpath]: https://developer.mozilla.org/en-US/docs/Web/XPath "xpath" | ||
|
|
||
| [AbortSignal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal "AbortSignal" | ||
| [Array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array "Array" | ||
| [boolean]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type "Boolean" | ||
| [Buffer]: https://nodejs.org/api/buffer.html#buffer_class_buffer "Buffer" | ||
| [ChildProcess]: https://nodejs.org/api/child_process.html "ChildProcess" | ||
| [Date]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date "Date" | ||
| [Error]: https://nodejs.org/api/errors.html#errors_class_error "Error" | ||
| [EventEmitter]: https://nodejs.org/api/events.html#events_class_eventemitter "EventEmitter" | ||
| [function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function "Function" | ||
| [FormData]: https://developer.mozilla.org/en-US/docs/Web/API/FormData "FormData" | ||
| [Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map "Map" | ||
| [Metadata]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object<string, any>" | ||
| [null]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null "null" | ||
| [number]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type "Number" | ||
| [Object]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object "Object" | ||
| [Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise "Promise" | ||
| [Readable]: https://nodejs.org/api/stream.html#stream_class_stream_readable "Readable" | ||
| [ReadStream]: https://nodejs.org/api/fs.html#class-fsreadstream "ReadStream" | ||
| [RegExp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp "RegExp" | ||
| [string]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type "string" | ||
| [void]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined "void" | ||
| [URL]: https://nodejs.org/api/url.html "URL" | ||
| [URLPattern]: https://developer.mozilla.org/en-US/docs/Web/API/URLPattern "URLPattern" | ||
| [URLSearchParams]: https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams "URLSearchParams" | ||
|
|
||
| [all available image tags]: https://mcr.microsoft.com/en-us/product/playwright/about "all available image tags" | ||
| [Microsoft Artifact Registry]: https://mcr.microsoft.com/en-us/product/playwright/about "Microsoft Artifact Registry" | ||
| [Dockerfile.noble]: https://github.com/microsoft/playwright/blob/main/utils/docker/Dockerfile.noble "Dockerfile.noble" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
No changes in nodejs/docs should be done in playwright.dev repo. The source of truth is https://github.com/microsoft/playwright/blob/main/docs/src
See https://github.com/microsoft/playwright/blob/main/CONTRIBUTING.md and https://github.com/microsoft/playwright.dev/blob/main/README.md