Skip to content

Commit 722c745

Browse files
authored
[UI] Set playwright for e2e tests (#628)
1 parent 1220e60 commit 722c745

17 files changed

Lines changed: 264 additions & 93 deletions

Dockerfile.app

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
FROM node:19-alpine
1+
FROM node:16
2+
FROM mcr.microsoft.com/playwright:focal
23

34
WORKDIR /app
45

6+
ENV PATH /app/node_modules/.bin:$PATH
7+
8+
RUN apt-get update && apt-get -y install libnss3 libatk-bridge2.0-0 libdrm-dev libxkbcommon-dev libgbm-dev libasound-dev libatspi2.0-0 libxshmfence-dev
9+
510
COPY web/client/package*.json .
611

712
RUN npm install -g npm@latest && \

web/client/.eslintrc.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ module.exports = {
3636
},
3737
],
3838
},
39-
ignorePatterns: ['src/api/client.ts'],
39+
ignorePatterns: [
40+
'src/api/client.ts',
41+
'test-results',
42+
'playwright',
43+
'playwright-report',
44+
'dist',
45+
],
4046
settings: {
4147
react: {
4248
version: '18.2',

web/client/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
/test-results/
3+
/playwright-report/
4+
/playwright/.cache/
5+
dist
6+
tsconfig.tsbuildinfo

web/client/.prettierignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
**/*.py
2-
.prettierignore
2+
.prettierignore
3+
.gitignore
4+
node_modules/
5+
/test-results/
6+
/playwright-report/
7+
/playwright/.cache/
8+
dist
9+
tsconfig.tsbuildinfo

web/client/package-lock.json

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

web/client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"lint:fix": "eslint --fix .",
1010
"format": "npm run prettier && npm run lint:fix",
1111
"test": "vitest",
12+
"test:e2e": "playwright test",
1213
"generate:api": "orval --config ./orval.config.ts"
1314
},
1415
"dependencies": {
@@ -37,6 +38,7 @@
3738
"zustand": "^4.3.6"
3839
},
3940
"devDependencies": {
41+
"@playwright/test": "^1.32.1",
4042
"@testing-library/jest-dom": "^5.16.5",
4143
"@testing-library/react": "^14.0.0",
4244
"@testing-library/user-event": "^14.4.3",

web/client/playwright.config.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
const URL = 'http://127.0.0.1:8005'
10+
11+
/**
12+
* See https://playwright.dev/docs/test-configuration.
13+
*/
14+
export default defineConfig({
15+
testDir: './tests',
16+
/* Run tests in files in parallel */
17+
fullyParallel: true,
18+
/* Fail the build on CI if you accidentally left test.only in the source code. */
19+
forbidOnly: process.env.CI != null,
20+
/* Retry on CI only */
21+
retries: process.env.CI != null ? 2 : 0,
22+
/* Opt out of parallel tests on CI. */
23+
workers: process.env.CI != null ? 1 : undefined,
24+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
25+
reporter: 'html',
26+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
27+
use: {
28+
/* Base URL to use in actions like `await page.goto('/')`. */
29+
baseURL: URL,
30+
31+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
32+
trace: 'on-first-retry',
33+
},
34+
35+
/* Configure projects for major browsers */
36+
projects: [
37+
{
38+
name: 'chromium',
39+
use: { ...devices['Desktop Chrome'] },
40+
},
41+
42+
{
43+
name: 'firefox',
44+
use: { ...devices['Desktop Firefox'] },
45+
},
46+
47+
{
48+
name: 'webkit',
49+
use: { ...devices['Desktop Safari'] },
50+
},
51+
],
52+
53+
/* Run your local dev server before starting the tests */
54+
webServer: {
55+
command: 'npm run build && npm run preview',
56+
url: URL,
57+
reuseExistingServer: process.env.CI == null,
58+
},
59+
})

web/client/src/library/components/logo/SqlMesh.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ function LogoSqlMesh({
2828
style={style}
2929
className={className}
3030
viewBox="0 0 240 72"
31-
fill="none"
3231
xmlns="http://www.w3.org/2000/svg"
3332
>
33+
<title>SQLMesh logo</title>
3434
<path
3535
d="M60 41V33.2222C60 20.9492 49.2548 11 36 11C22.7452 11 12 20.9492 12 33.2222V41"
3636
stroke={strokeDarker}

web/client/src/library/components/logo/Tobiko.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function LogoTobiko({ style, className }: PropsLogoTobiko): JSX.Element {
1111
fill="none"
1212
xmlns="http://www.w3.org/2000/svg"
1313
>
14+
<title>Tobiko Data logo</title>
1415
<path
1516
fillRule="evenodd"
1617
clipRule="evenodd"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
export default function Footer(): JSX.Element {
2+
return (
3+
<footer className="px-2 py-1 text-xs flex justify-between">
4+
<small className="text-xs">
5+
© {new Date().getFullYear()}
6+
&nbsp;
7+
<a
8+
href="https://tobikodata.com/"
9+
target="_blank"
10+
rel="noopener noreferrer"
11+
className="underline"
12+
title="Tobiko Data website"
13+
>
14+
Tobiko&nbsp;Data,&nbsp;Inc.
15+
</a>
16+
&nbsp; All rights reserved.
17+
</small>
18+
</footer>
19+
)
20+
}

0 commit comments

Comments
 (0)