microsoft / design-to-code

A system of development tools, and utilities used à la carte or as a suite to build enterprise-grade websites and applications.
MIT License
24 stars 6 forks source link

Adding Playwright testing #151

Closed williamw2 closed 2 years ago

williamw2 commented 2 years ago

Pull Request

📖 Description

This adds the dependency to Playwright (https://playwright.dev/) and configures it to run locally. There are two scripts added to the package.json file:

Playwright is configured to scan the /packages/fast-tooling/src folder looking for files with a "*.spec.pw.ts" naming convention and execute the tests. This does not conflict with the existing karma/chia tests and both may exists side by side.

To create a new test add a new file with the named .spec.pw.ts in any folder under src and import "expect" and "test" from @playwright/test. Encapsulate your tests inside of a "test.describe()" call. Use the color-picker.spec.pw.ts as an example. Start an instance of the webpack dev server (npm start). In a separate terminal window execute playwright (npm run test-playwright).

To start the playwright test generator execute this command "npx playwright codegen http://localhost:7776" replacing the port number with the correct number for the package that you are testing (tooling=7776, react=7002, wasm=7003).

This only configures Playwright to be run manually on the local dev environment. GitHub build gate integration will be done in a separately.

🎫 Issues

closes: #147

👩‍💻 Reviewer Notes

✅ Checklist

General

⏭ Next Steps

janechu commented 2 years ago

Couple comments to make sure we don't bump versions when we don't need to, otherwise this looks good!