-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from todays-mitsui/add-test
e2eテストを追加する
- Loading branch information
Showing
10 changed files
with
90 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Test | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "src/**" | ||
- "test/**" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Start wp-env local server | ||
run: nohup npm start & | ||
|
||
- name: Wait for local server to start | ||
run: | | ||
while ! nc -z localhost 8889; do | ||
sleep 1 | ||
done | ||
- name: Run tests | ||
run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"cookies":[{"name":"wordpress_test_cookie","value":"WP%20Cookie%20check","domain":"localhost","path":"/","expires":-1,"httpOnly":false,"secure":false,"sameSite":"Lax"},{"name":"wordpress_23778236db82f19306f247e20a353a99","value":"admin%7C1717235962%7CrdtWoFHwA11nQRfIwVH2DblwNSkH7Rlo6j1osrLKg6o%7C6535e5ea286bbe966bbba1817959cc676401d77a4ea9280af819d86b149db65a","domain":"localhost","path":"/wp-content/plugins","expires":-1,"httpOnly":true,"secure":false,"sameSite":"Lax"},{"name":"wordpress_23778236db82f19306f247e20a353a99","value":"admin%7C1717235962%7CrdtWoFHwA11nQRfIwVH2DblwNSkH7Rlo6j1osrLKg6o%7C6535e5ea286bbe966bbba1817959cc676401d77a4ea9280af819d86b149db65a","domain":"localhost","path":"/wp-admin","expires":-1,"httpOnly":true,"secure":false,"sameSite":"Lax"},{"name":"wordpress_logged_in_23778236db82f19306f247e20a353a99","value":"admin%7C1717235962%7CrdtWoFHwA11nQRfIwVH2DblwNSkH7Rlo6j1osrLKg6o%7Cf83bc297e9c6946f38fc750f1b876981adcd4184e27b58e9e8ba87792c8fc4a2","domain":"localhost","path":"/","expires":-1,"httpOnly":true,"secure":false,"sameSite":"Lax"},{"name":"wp-settings-time-1","value":"1717063163","domain":"localhost","path":"/","expires":1748599163.075,"httpOnly":false,"secure":false,"sameSite":"Lax"}],"nonce":"68d34ccc5a","rootURL":"http://localhost:8889/index.php?rest_route=/"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"status": "passed", | ||
"failedTests": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineConfig } from '@playwright/test'; | ||
|
||
const baseConfig = require( '@wordpress/scripts/config/playwright.config.js' ); | ||
|
||
const config = defineConfig( { | ||
...baseConfig, | ||
testDir: './test/e2e', | ||
} ); | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/e2e/__snapshots__/Block-should-add-a-block-1-chromium.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- wp:todays-mitsui/nonogram --> | ||
<div class="wp-block-todays-mitsui-nonogram" style="aspect-ratio:1 / 1" data-aspect-ratio="1:1" data-row-clues="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0" data-column-clues="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0"></div> | ||
<!-- /wp:todays-mitsui/nonogram --> |
3 changes: 3 additions & 0 deletions
3
test/e2e/__snapshots__/addBlock-should-add-a-block-1-chromium.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!-- wp:todays-mitsui/nonogram --> | ||
<div class="wp-block-todays-mitsui-nonogram" style="aspect-ratio:1 / 1" data-aspect-ratio="1:1" data-row-clues="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0" data-column-clues="0;0;0;0;0;0;0;0;0;0;0;0;0;0;0"></div> | ||
<!-- /wp:todays-mitsui/nonogram --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { test, expect } from '@wordpress/e2e-test-utils-playwright'; | ||
|
||
test.describe( 'addBlock', () => { | ||
test.beforeEach( async ( { admin } ) => { | ||
await admin.createNewPost(); | ||
} ); | ||
|
||
test( 'should add a block', async ( { editor } ) => { | ||
await editor.insertBlock( { | ||
name: 'todays-mitsui/nonogram', | ||
attributes: { | ||
aspectRatio: [ 1, 1 ], | ||
boardData: null, | ||
}, | ||
} ); | ||
expect( await editor.getEditedPostContent() ).toMatchSnapshot(); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters