Skip to content

Commit 6bcb4b7

Browse files
authored
Merge pull request #16 from tkrotoff/update-npm-packages
Update npm packages
2 parents edea3fd + ceece38 commit 6bcb4b7

70 files changed

Lines changed: 27862 additions & 4930 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ node_modules/
66

77
build/
88
dist/
9+
coverage/

.eslintrc.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const config = {
66
parserOptions: {},
77
extends: [
88
// /!\ Order matters: the next one overrides rules from the previous one
9-
'plugin:jest-playwright/recommended',
9+
'plugin:playwright/playwright-test',
1010
'plugin:jest/recommended',
1111
'plugin:unicorn/recommended',
1212
'airbnb',
@@ -15,7 +15,7 @@ const config = {
1515
'plugin:@typescript-eslint/recommended',
1616
'plugin:prettier/recommended'
1717
],
18-
plugins: ['simple-import-sort', 'react-hooks', 'jest-playwright'],
18+
plugins: ['simple-import-sort', 'react-hooks'],
1919
env: {
2020
browser: true
2121
},
@@ -119,6 +119,9 @@ const config = {
119119
'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
120120
'react/require-default-props': 'off',
121121
'react/prop-types': 'off',
122+
// FIXME https://github.com/yannickcr/eslint-plugin-react/issues/3114#issuecomment-951725512
123+
'react/jsx-no-bind': 'off',
124+
'react/function-component-definition': 'off',
122125

123126
'react-hooks/rules-of-hooks': 'error',
124127
'react-hooks/exhaustive-deps': 'error'

.github/workflows/node.js.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# https://github.com/actions/starter-workflows/blob/c934669ce246e6d64e54006b714b04199cbe445b/ci/node.js.yml
1+
# https://github.com/actions/starter-workflows/blob/432e3e3e741760610382c82fb0e909ff700496f7/ci/node.js.yml
22

33
name: Node.js CI
44

@@ -9,25 +9,22 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111

12-
# https://github.com/arjun27/playwright-github-actions
13-
container: arjun27/playwright-bionic:0.2.0
14-
1512
strategy:
1613
matrix:
17-
node-version: [12.x, 14.x]
14+
node-version: [16.x]
1815

1916
steps:
2017
- uses: actions/checkout@v2
2118
- name: Use Node.js ${{matrix.node-version}}
22-
uses: actions/setup-node@v1
19+
uses: actions/setup-node@v2
2320
with:
2421
node-version: ${{matrix.node-version}}
22+
cache: 'npm'
2523
- run: npm ci
24+
- run: npx playwright install --with-deps
2625
- run: npm run build
2726
- run: npm run npm:install:examples
2827
- run: npm run build:examples
2928
- run: npm run lint
3029
- run: npm run test:coverage
3130
- run: npm run test:examples
32-
env:
33-
CI: true

.github/workflows/npm-publish.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# https://github.com/actions/starter-workflows/blob/c934669ce246e6d64e54006b714b04199cbe445b/ci/npm-publish.yml
1+
# https://github.com/actions/starter-workflows/blob/432e3e3e741760610382c82fb0e909ff700496f7/ci/npm-publish.yml
22

33
name: Node.js Package
44

@@ -9,16 +9,13 @@ on:
99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
12-
13-
# https://github.com/arjun27/playwright-github-actions
14-
container: arjun27/playwright-bionic:0.2.0
15-
1612
steps:
1713
- uses: actions/checkout@v2
18-
- uses: actions/setup-node@v1
14+
- uses: actions/setup-node@v2
1915
with:
20-
node-version: 12
16+
node-version: 16
2117
- run: npm ci
18+
- run: npx playwright install --with-deps
2219
- run: npm run build
2320
- run: npm run npm:install:examples
2421
- run: npm run build:examples
@@ -31,9 +28,9 @@ jobs:
3128
runs-on: ubuntu-latest
3229
steps:
3330
- uses: actions/checkout@v2
34-
- uses: actions/setup-node@v1
31+
- uses: actions/setup-node@v2
3532
with:
36-
node-version: 12
33+
node-version: 16
3734
registry-url: https://registry.npmjs.org/
3835
- run: npm ci
3936
- run: npm publish

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ node_modules/
55

66
dist/
77
coverage/
8-
examples/package-lock.json
98
examples/build/

.husky/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ LICENSE
1212

1313
dist/
1414
build/
15+
coverage/
1516
*.gif
1617
*.png

examples/Bootstrap.html

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
66

77
<title>Bootstrap example</title>
8-
9-
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet" />
10-
<style>
11-
* {
12-
/* Force Roboto font so Playwright works on all platforms: Mac, Linux, Windows and Docker */
13-
font-family: 'Roboto', sans-serif !important;
14-
}
15-
</style>
168
</head>
179

1810
<body>

examples/Bootstrap.test.e2e.ts

Lines changed: 100 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,108 @@
1-
import 'jest-playwright-preset';
1+
/* eslint-disable unicorn/no-await-expression-member, jest/no-done-callback, playwright/missing-playwright-await */
22

3+
import { expect, test } from '@playwright/test';
34
import path from 'path';
45

5-
const waitForResize = () => page.waitForTimeout(100);
6-
7-
test('resize', async () => {
6+
test('resize', async ({ page }) => {
87
await page.goto(`file:${path.join(__dirname, 'build/Bootstrap.html')}`);
98

109
const height = 768;
1110

12-
const firstPersonChildren = (await page.$('.people > .person:first-child > .wrap-children'))!;
13-
const children = await firstPersonChildren.$$(':scope > div');
14-
expect(children.length).toEqual(5);
15-
16-
{
17-
await page.setViewportSize({ width: /*1114*/ 1111, height });
18-
await waitForResize();
19-
20-
const classNames = await Promise.all(children.map(div => div.evaluate(el => el.className)));
21-
expect(classNames).toEqual([
22-
'floating-label mb-3 me-2 flex-fill',
23-
'floating-label mb-3 me-2 flex-fill',
24-
'floating-label mb-3 me-2',
25-
'floating-label mb-3 me-2',
26-
'floating-label mb-3 me-2'
27-
]);
28-
29-
expect(await page.screenshot()).toMatchImageSnapshot();
30-
}
31-
32-
{
33-
await page.setViewportSize({ width: /*1113*/ 1110, height });
34-
await waitForResize();
35-
36-
const classNames = await Promise.all(children.map(div => div.evaluate(el => el.className)));
37-
expect(classNames).toEqual([
38-
'floating-label mb-3 me-2 flex-fill',
39-
'floating-label mb-3 me-2 flex-fill',
40-
'floating-label mb-3 me-2',
41-
'floating-label mb-3 me-2 next-is-wrapped',
42-
'floating-label mb-3 me-2'
43-
]);
44-
45-
expect(await page.screenshot()).toMatchImageSnapshot();
46-
}
47-
48-
{
49-
await page.setViewportSize({ width: /*814*/ 813, height });
50-
await waitForResize();
51-
52-
const classNames = await Promise.all(children.map(div => div.evaluate(el => el.className)));
53-
expect(classNames).toEqual([
54-
'floating-label mb-3 me-2 flex-fill',
55-
'floating-label mb-3 me-2 flex-fill',
56-
'floating-label mb-3 me-2 next-is-wrapped',
57-
'floating-label mb-3 me-2',
58-
'floating-label mb-3 me-2'
59-
]);
60-
61-
expect(await page.screenshot()).toMatchImageSnapshot();
62-
}
63-
64-
{
65-
await page.setViewportSize({ width: /*610*/ 609, height });
66-
await waitForResize();
67-
68-
const classNames = await Promise.all(children.map(div => div.evaluate(el => el.className)));
69-
expect(classNames).toEqual([
70-
'floating-label mb-3 me-2 flex-fill',
71-
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
72-
'floating-label mb-3 me-2',
73-
'floating-label mb-3 me-2 next-is-wrapped',
74-
'floating-label mb-3 me-2'
75-
]);
76-
77-
expect(await page.screenshot()).toMatchImageSnapshot();
78-
}
79-
80-
{
81-
await page.setViewportSize({ width: /*485*/ 485, height });
82-
await waitForResize();
83-
84-
const classNames = await Promise.all(children.map(div => div.evaluate(el => el.className)));
85-
expect(classNames).toEqual([
86-
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
87-
'floating-label mb-3 me-2 flex-fill',
88-
'floating-label mb-3 me-2 next-is-wrapped',
89-
'floating-label mb-3 me-2 next-is-wrapped',
90-
'floating-label mb-3 me-2'
91-
]);
92-
93-
expect(await page.screenshot()).toMatchImageSnapshot();
94-
}
95-
96-
{
97-
await page.setViewportSize({ width: /*375*/ 374, height });
98-
await waitForResize();
99-
100-
const classNames = await Promise.all(children.map(div => div.evaluate(el => el.className)));
101-
expect(classNames).toEqual([
102-
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
103-
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
104-
'floating-label mb-3 me-2',
105-
'floating-label mb-3 me-2 next-is-wrapped',
106-
'floating-label mb-3 me-2'
107-
]);
108-
109-
expect(await page.screenshot()).toMatchImageSnapshot();
110-
}
111-
112-
{
113-
await page.setViewportSize({ width: /*344*/ 341, height });
114-
await waitForResize();
115-
116-
const classNames = await Promise.all(children.map(div => div.evaluate(el => el.className)));
117-
expect(classNames).toEqual([
118-
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
119-
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
120-
'floating-label mb-3 me-2 next-is-wrapped',
121-
'floating-label mb-3 me-2 next-is-wrapped',
122-
'floating-label mb-3 me-2'
123-
]);
124-
125-
expect(await page.screenshot()).toMatchImageSnapshot();
126-
}
11+
const firstBeatlesChildren = page
12+
.locator('.people > .person:first-child > .wrap-children')
13+
.first();
14+
await expect(firstBeatlesChildren).toHaveCount(1);
15+
const inputs = firstBeatlesChildren.locator('> div');
16+
await expect(inputs).toHaveCount(5);
17+
18+
// 1
19+
await page.setViewportSize({ width: 1068, height });
20+
21+
expect(await page.screenshot()).toMatchSnapshot('bootstrap-1.png');
22+
23+
await expect(inputs).toHaveClass([
24+
'floating-label mb-3 me-2 flex-fill',
25+
'floating-label mb-3 me-2 flex-fill',
26+
'floating-label mb-3 me-2',
27+
'floating-label mb-3 me-2',
28+
'floating-label mb-3 me-2'
29+
]);
30+
31+
// 2
32+
await page.setViewportSize({ width: 1067, height });
33+
34+
expect(await page.screenshot()).toMatchSnapshot('bootstrap-2.png');
35+
36+
await expect(inputs).toHaveClass([
37+
'floating-label mb-3 me-2 flex-fill',
38+
'floating-label mb-3 me-2 flex-fill',
39+
'floating-label mb-3 me-2',
40+
'floating-label mb-3 me-2 next-is-wrapped',
41+
'floating-label mb-3 me-2'
42+
]);
43+
44+
// 3
45+
await page.setViewportSize({ width: 761, height });
46+
47+
expect(await page.screenshot()).toMatchSnapshot('bootstrap-3.png');
48+
49+
await expect(inputs).toHaveClass([
50+
'floating-label mb-3 me-2 flex-fill',
51+
'floating-label mb-3 me-2 flex-fill',
52+
'floating-label mb-3 me-2 next-is-wrapped',
53+
'floating-label mb-3 me-2',
54+
'floating-label mb-3 me-2'
55+
]);
56+
57+
// 4
58+
await page.setViewportSize({ width: 559, height });
59+
60+
expect(await page.screenshot()).toMatchSnapshot('bootstrap-4.png');
61+
62+
await expect(inputs).toHaveClass([
63+
'floating-label mb-3 me-2 flex-fill',
64+
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
65+
'floating-label mb-3 me-2',
66+
'floating-label mb-3 me-2 next-is-wrapped',
67+
'floating-label mb-3 me-2'
68+
]);
69+
70+
// 5
71+
await page.setViewportSize({ width: 433, height });
72+
73+
expect(await page.screenshot()).toMatchSnapshot('bootstrap-5.png');
74+
75+
await expect(inputs).toHaveClass([
76+
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
77+
'floating-label mb-3 me-2 flex-fill',
78+
'floating-label mb-3 me-2 next-is-wrapped',
79+
'floating-label mb-3 me-2 next-is-wrapped',
80+
'floating-label mb-3 me-2'
81+
]);
82+
83+
// 6
84+
await page.setViewportSize({ width: 350, height });
85+
86+
expect(await page.screenshot()).toMatchSnapshot('bootstrap-6.png');
87+
88+
await expect(inputs).toHaveClass([
89+
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
90+
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
91+
'floating-label mb-3 me-2 next-is-wrapped',
92+
'floating-label mb-3 me-2 next-is-wrapped',
93+
'floating-label mb-3 me-2'
94+
]);
95+
96+
// 7
97+
await page.setViewportSize({ width: 343, height });
98+
99+
expect(await page.screenshot()).toMatchSnapshot('bootstrap-7.png');
100+
101+
await expect(inputs).toHaveClass([
102+
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
103+
'floating-label mb-3 me-2 flex-fill next-is-wrapped',
104+
'floating-label mb-3 me-2 next-is-wrapped',
105+
'floating-label mb-3 me-2 next-is-wrapped',
106+
'floating-label mb-3 me-2'
107+
]);
127108
});
124 KB
Loading

0 commit comments

Comments
 (0)