Download react-slick/playwright-tests/sample/sample.spec.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 794 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-slick/playwright-tests/sample/sample.spec.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-slick/playwright-tests/sample/sample.spec.tsx
-
curl -L -o sample.spec.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-slick/playwright-tests/sample/sample.spec.tsx
794 Bytes
| //Imports the test and expect functions from the Playwright ct-react module | |
| import { test, expect } from "@playwright/experimental-ct-react"; | |
| //Imports the App component to test from the relative ../App path | |
| import App from "./sample.story"; | |
| //Configures the viewport to a 500x500 size | |
| test.use({ viewport: { width: 500, height: 500 } }); | |
| //Starts a test case named "should work" which will run asynchronously, | |
| //mount function binding is destructured from test parameter | |
| test("Sample playwright test", async ({ mount }) => { | |
| //Uses mount() to instantiate the <App /> component in isolation | |
| const component = await mount(<App></App>); | |
| //Asserts that component contains expected "Learn React" text on it verifying basic render. | |
| await expect(component).toContainText("Learn React"); | |
| }); | |