Skip to content
9 changes: 7 additions & 2 deletions .github/workflows/cf_test_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ on:
- BISO
- BRAPI Staging
- BRAPI Production
grep:
description: 'Test filter grep'
required: false
type: string

jobs:
full-tests:
runs-on: ubuntu-latest
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
BROWSER_BINDINGS: ${{ secrets.BROWSER_BINDINGS }}
TESTS_SERVER_URL: https://playwright-test-workers.rendering.cfdata.org
CF_ACCESS_CLIENT_SECRET: ${{ secrets.CF_ACCESS_CLIENT_SECRET }}
CF_ACCESS_CLIENT_ID: ${{ secrets.CF_ACCESS_CLIENT_ID }}
Expand All @@ -37,7 +42,7 @@ jobs:
- name: Run tests
run: |
cd packages/playwright-cloudflare
npm run test:full -- --reporter=html --project="${{ github.event.inputs.project || 'BISO' }}"
npm run test:full -- --reporter=html --project="${{ github.event.inputs.project || 'BISO' }}" ${{ github.event.inputs.grep && format('--grep="{0}"', github.event.inputs.grep) }}

- name: Upload HTML report
uses: actions/upload-artifact@v4
Expand All @@ -48,7 +53,7 @@ jobs:
retention-days: 14

- name: Deploy to Cloudflare Pages
if: ${{ !cancelled() }}
if: ${{ !cancelled() && !github.event.inputs.grep }}
run: |
cd packages/playwright-cloudflare/tests
npx wrangler pages deploy ./playwright-report --project-name playwright-full-test-report
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ export default {
### Trace

```js
import fs from "fs";

import { launch } from "@cloudflare/playwright";
import fs from "@cloudflare/playwright/fs";

export default {
async fetch(request, env): Promise<Response> {
Expand All @@ -86,9 +87,10 @@ export default {

// ... do something, screenshot for example

await page.context().tracing.stop({ path: "trace.zip" });
// For now, fs only supports writing into /tmp
await page.context().tracing.stop({ path: "/tmp/trace.zip" });
await browser.close();
const file = await fs.promises.readFile("trace.zip");
const file = await fs.promises.readFile("/tmp/trace.zip");

return new Response(file, {
status: 200,
Expand Down
131 changes: 0 additions & 131 deletions packages/playwright-cloudflare/bundles/fs/package-lock.json

This file was deleted.

8 changes: 0 additions & 8 deletions packages/playwright-cloudflare/bundles/fs/package.json

This file was deleted.

103 changes: 0 additions & 103 deletions packages/playwright-cloudflare/bundles/fs/src/fs.ts

This file was deleted.

11 changes: 6 additions & 5 deletions packages/playwright-cloudflare/examples/todomvc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ https://<your-worker>.workers.dev
```
Returns a screenshot of the TodoMVC app with default todo items.

### Custom Todo Items
### Generate Trace

To generate a trace and open it in [Playwright Trace Viewer](https://trace.playwright.dev/), use the following URL:

```
https://<your-worker>.workers.dev?todo=first&todo=second
https://trace.playwright.dev/?trace=https://<your-worker>.workers.dev
```
Returns a screenshot with your custom todo items.

### Generate Trace
To download the trace, use the following URL:
```
https://<your-worker>.workers.dev?trace
```
Returns a Playwright trace file that can be viewed in [Playwright Trace Viewer](https://playwright.dev/docs/trace-viewer).
Loading
Loading