Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emileperron/playwright-test-gh-action
A template that brings @playwright/test E2E tests to your GitHub workflows!
https://github.com/emileperron/playwright-test-gh-action
e2e-tests github-actions playwright
Last synced: about 1 month ago
JSON representation
A template that brings @playwright/test E2E tests to your GitHub workflows!
- Host: GitHub
- URL: https://github.com/emileperron/playwright-test-gh-action
- Owner: EmilePerron
- License: mit
- Created: 2021-06-09T23:55:24.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-06-10T00:25:36.000Z (over 3 years ago)
- Last Synced: 2024-11-07T16:46:03.574Z (3 months ago)
- Topics: e2e-tests, github-actions, playwright
- Language: TypeScript
- Homepage:
- Size: 35.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Playwright-based tests in GitHub workflows
End-to-end tests have never been easier than with the new [@playwright/test](https://github.com/microsoft/playwright-test): Playwright's official test runner.
And with the help of this template, you can easily run these E2E tests in your GitHub workflows!## Add to an existing project
1. Set up your Workflow file:
- If you don't have a GitHub action workflow yet, copy this template's `.github/workflows/` in your project.
- If you already have a workflow, make sure it has the following steps:
```yaml
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 15.x # Change this for the version of your choice
- name: Install JS dependencies
run: npm ci # or "npm install"
- name: Install Playwright dependencies
run: npx playwright install-deps
- name: Install Playwright browsers
run: npx playwright install
- name: Run E2E tests
run: npx playwright test
```
2. Install Playwright's test runner:
```bash
npm i -D @playwright/test
```
3. Create your tests in the `test/` directory.
Ex.:
```bash
# test/test.spec.ts
import { test, expect } from '@playwright/test';test('basic test', async ({ page }) => {
await page.goto('https://playwright.dev/');
const name = await page.innerText('.navbar__title');
expect(name).toBe('Playwright');
});
```
4. Push to GitHub, and watch your tests run in the Actions tab! 🙌Check out the [official @playwright/test documentation](https://playwright.dev/docs/test-intro) to learn more about how it works.