Skip to content

Commit 076eec1

Browse files
authored
Merge branch 'UGN-409' into master
2 parents 127c585 + 2cf0821 commit 076eec1

12 files changed

Lines changed: 252 additions & 48 deletions

File tree

.github/workflows/test.yaml

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,51 @@ on:
77
branches: [master]
88

99
jobs:
10-
build:
10+
unit-tests:
1111
runs-on: ubuntu-latest
12-
1312
steps:
14-
- uses: actions/checkout@v2
15-
- name: Use Node.js
16-
uses: actions/setup-node@v1
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v3
1715
with:
18-
node-version: "16.x"
19-
- run: npm ci
16+
node-version: 18
17+
- name: Install dependencies
18+
run: npm ci
2019
- run: npm run lint
2120
- run: npm run ts
22-
- run: npm run test
21+
- run: npm run test:unit
22+
23+
e2e-tests:
24+
timeout-minutes: 60
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v3
28+
- uses: actions/setup-node@v3
29+
with:
30+
node-version: 18
31+
- name: Install dependencies
32+
run: npm ci
33+
- name: Install Playwright
34+
run: npx playwright install --with-deps
35+
- name: Run Playwright tests
36+
run: npx playwright test
37+
- uses: actions/upload-artifact@v3
38+
if: always()
39+
with:
40+
name: playwright-report
41+
path: playwright-report/
42+
retention-days: 30
43+
44+
45+
chromatic-test:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v2
49+
with:
50+
fetch-depth: 0 # Required to retrieve git history
51+
- name: Install dependencies
52+
run: npm ci
53+
- name: Publish to Chromatic
54+
uses: chromaui/action@v1
55+
with:
56+
# Grab this from the Chromatic manage page
57+
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,7 @@ web_modules
77
dist
88
dist-commonjs
99
types
10-
coverage
10+
coverage
11+
/test-results/
12+
/playwright-report/
13+
/playwright/.cache/

e2e/example.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { test } from '@playwright/test';
2+
3+
test('has title', async ({ page }) => {
4+
await page.goto('http://localhost:6006/iframe.html?args=&id=select-header-step--basic&viewMode=story');
5+
6+
await page.getByRole('row', ).filter({ hasText: 'second' }).click();
7+
});

package-lock.json

Lines changed: 74 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-spreadsheet-import",
3-
"version": "4.1.2",
3+
"version": "4.2.1",
44
"description": "React spreadsheet import for xlsx and csv files with column matching and validation",
55
"main": "./dist-commonjs/index.js",
66
"module": "./dist/index.js",
@@ -12,16 +12,18 @@
1212
],
1313
"scripts": {
1414
"start": "storybook dev -p 6006",
15-
"test": "jest",
15+
"test:unit": "jest",
16+
"test:e2e": "npx playwright test",
17+
"test:chromatic": "npx chromatic ",
1618
"ts": "tsc",
1719
"lint": "eslint \"src/**/*.{ts,tsx}\"",
1820
"lint:fix": "eslint \"src/**/*.{ts,tsx}\" --fix",
1921
"prebuild": "npm run clean",
2022
"build": "rollup -c rollup.config.ts",
2123
"build-storybook": "storybook build -o docs-build",
22-
"release:patch": "git checkout master && git pull && npm run test && npm run ts && npm run build && npm version patch && git add -A && git push && git push --tags && npm publish",
23-
"release:minor": "git checkout master && git pull && npm run test && npm run ts && npm run build && npm version minor && git add -A && git push && git push --tags && npm publish",
24-
"release:major": "git checkout master && git pull && npm run test && npm run ts && npm run build && npm version major && git add -A && git push && git push --tags && npm publish",
24+
"release:patch": "git checkout master && git pull && npm run test:unit && npm run ts && npm run build && npm version patch && git add -A && git push && git push --tags && npm publish",
25+
"release:minor": "git checkout master && git pull && npm run test:unit && npm run ts && npm run build && npm version minor && git add -A && git push && git push --tags && npm publish",
26+
"release:major": "git checkout master && git pull && npm run test:unit && npm run ts && npm run build && npm version major && git add -A && git push && git push --tags && npm publish",
2527
"clean": "rimraf dist dist-commonjs types"
2628
},
2729
"repository": {
@@ -39,7 +41,9 @@
3941
"automatic",
4042
"match"
4143
],
42-
"author": "Ugnis",
44+
"author": {
45+
"name": "Ugnis"
46+
},
4347
"license": "MIT",
4448
"bugs": {
4549
"url": "https://github.com/UgnisSoftware/react-spreadsheet-import/issues"
@@ -71,6 +75,7 @@
7175
"@babel/preset-typescript": "7.21.5",
7276
"@emotion/jest": "11.11.0",
7377
"@jest/types": "27.5.1",
78+
"@playwright/test": "^1.39.0",
7479
"@storybook/addon-essentials": "7.0.14",
7580
"@storybook/addon-interactions": "7.0.14",
7681
"@storybook/addon-links": "7.0.14",
@@ -85,13 +90,15 @@
8590
"@testing-library/user-event": "14.4.3",
8691
"@types/jest": "27.4.1",
8792
"@types/js-levenshtein": "1.1.1",
93+
"@types/node": "^20.8.7",
8894
"@types/react": "18.2.6",
8995
"@types/react-dom": "18.2.4",
9096
"@types/styled-system": "5.1.16",
9197
"@types/uuid": "9.0.1",
9298
"@typescript-eslint/eslint-plugin": "5.59.7",
9399
"@typescript-eslint/parser": "5.59.7",
94100
"babel-loader": "9.1.2",
101+
"chromatic": "^7.4.0",
95102
"eslint": "8.41.0",
96103
"eslint-config-prettier": "8.8.0",
97104
"eslint-plugin-prettier": "4.2.1",
@@ -144,6 +151,9 @@
144151
"moduleNameMapper": {
145152
"~/(.*)": "<rootDir>/src/$1"
146153
},
154+
"modulePathIgnorePatterns": [
155+
"<rootDir>/e2e/"
156+
],
147157
"transformIgnorePatterns": [
148158
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$"
149159
],
@@ -162,5 +172,6 @@
162172
"jest-watch-typeahead/filename",
163173
"jest-watch-typeahead/testname"
164174
]
165-
}
175+
},
176+
"readme": "ERROR: No README data found!"
166177
}

playwright.config.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { defineConfig, devices } from '@playwright/test';
2+
3+
/**
4+
* Read environment variables from file.
5+
* https://github.com/motdotla/dotenv
6+
*/
7+
// require('dotenv').config();
8+
9+
/**
10+
* See https://playwright.dev/docs/test-configuration.
11+
*/
12+
export default defineConfig({
13+
testDir: './e2e',
14+
/* Run tests in files in parallel */
15+
fullyParallel: true,
16+
/* Fail the build on CI if you accidentally left test.only in the source code. */
17+
forbidOnly: !!process.env.CI,
18+
/* Retry on CI only */
19+
retries: process.env.CI ? 2 : 0,
20+
/* Opt out of parallel tests on CI. */
21+
workers: process.env.CI ? 1 : undefined,
22+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
23+
reporter: 'html',
24+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
25+
use: {
26+
/* Base URL to use in actions like `await page.goto('/')`. */
27+
// baseURL: 'http://127.0.0.1:3000',
28+
29+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
30+
trace: 'on-first-retry',
31+
},
32+
33+
/* Configure projects for major browsers */
34+
projects: [
35+
{
36+
name: 'chromium',
37+
use: { ...devices['Desktop Chrome'] },
38+
},
39+
40+
{
41+
name: 'firefox',
42+
use: { ...devices['Desktop Firefox'] },
43+
},
44+
45+
{
46+
name: 'webkit',
47+
use: { ...devices['Desktop Safari'] },
48+
},
49+
50+
/* Test against mobile viewports. */
51+
// {
52+
// name: 'Mobile Chrome',
53+
// use: { ...devices['Pixel 5'] },
54+
// },
55+
// {
56+
// name: 'Mobile Safari',
57+
// use: { ...devices['iPhone 12'] },
58+
// },
59+
60+
/* Test against branded browsers. */
61+
// {
62+
// name: 'Microsoft Edge',
63+
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
64+
// },
65+
// {
66+
// name: 'Google Chrome',
67+
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
68+
// },
69+
],
70+
71+
/* Run your local dev server before starting the tests */
72+
webServer: {
73+
command: 'npm run start',
74+
url: 'http://localhost:6006',
75+
reuseExistingServer: !process.env.CI,
76+
},
77+
});

src/components/ModalCloseButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const ModalCloseButton = ({ onClose }: ModalCloseButtonProps) => {
2929
aria-label="Close modal"
3030
icon={<CgClose />}
3131
color="white"
32-
position="absolute"
32+
position="fixed"
3333
transform="translate(50%, -50%)"
3434
onClick={() => setShowModal(true)}
3535
zIndex="toast"

0 commit comments

Comments
 (0)