Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from storybookjs/shilman/rename-package
Browse files Browse the repository at this point in the history
Rename package to @storybook/playwright-ct
  • Loading branch information
shilman committed Aug 19, 2023
2 parents 5f0bd8d + 67931db commit 06751b5
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,24 @@ jobs:
- name: Prepare repository
run: git fetch --unshallow --tags

- name: Use Node.js 14.x
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 16.x

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: false

- name: Install dependencies
uses: bahmutov/npm-install@v1
run: pnpm install

- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
yarn release
pnpm run release
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CT Storybook allows you to write a Playwright test against that story using all

```ts
// Button.spec.ts
import { test, expect } from 'playwright-ct-storybook';
import { test, expect } from '@storybook/playwright-ct';
import * as ButtonStories from './Button.stories';

test('interacts', async ({ mount }) => {
Expand Down Expand Up @@ -144,14 +144,14 @@ npm init playwright@latest
Then install this package:

```sh
npm install playwright-ct-storybook
npm install @storybook/playwright-ct
```

Then update your Playwright config to use `playwright-ct-storybook`'s `defineConfig`:
Then update your Playwright config to use `@storybook/playwright-ct`'s `defineConfig`:

```diff
- import { defineConfig, devices } from '@playwright/test';
+ import { defineConfig, devices } from 'playwright-ct-storybook';
+ import { defineConfig, devices } from '@storybook/playwright-ct';
```

This is a thin wrapper around Playwright's `defineConfig` that tells Playwright to run against your Storybook dev server.
Expand All @@ -167,7 +167,7 @@ This will run the example E2E tests that Playwright installs in your project.
Then, you can write your first test based on your existing stories. This test uses `Button.stories` that is included as an example file in the Storybook installation, but it can be any Story file.

```js
import { test, expect } from 'playwright-ct-storybook';
import { test, expect } from '@storybook/playwright-ct';
import * as ButtonStories from './Button.stories';

test('renders', async ({ mount }) => {
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "playwright-ct-storybook",
"name": "@storybook/playwright-ct",
"version": "0.0.0",
"description": "Playwright CT powered by Storybook (Experimental)",
"repository": {
"type": "git",
"url": "https://github.com/shilman/playwright-ct-storybook"
"url": "https://github.com/storybookjs/playwright-ct"
},
"author": "Michael Shilman <michael@lab80.co>",
"license": "MIT",
Expand Down Expand Up @@ -107,5 +107,6 @@
},
"peerDependencies": {
"@playwright/test": "^1.36.2"
}
},
"packageManager": "pnpm"
}
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const defineConfig = (config: PlaywrightTestConfig) =>
// @ts-expect-error WTH
babelPlugins: [...(config.build?.babelPlugins || []), [join(__dirname, 'ct-test-plugin.js')]],
// @ts-expect-error WTH
external: [/playwright-ct-storybook\/.*.js$/],
external: [/playwright-ct\/.*.js$/],
...config.build,
},
webServer: {
Expand Down

0 comments on commit 06751b5

Please sign in to comment.