Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c5a2e95

Browse files
committed
feat(ui): integrate cypress with tabs scenario, resolve svg issues with compiler, update types
1 parent b6a0c7a commit c5a2e95

File tree

65 files changed

+2460
-490
lines changed

Some content is hidden

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

65 files changed

+2460
-490
lines changed

‎ui/.gitlab-ci.yml‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ include:
22
- local: 'ui/packages/ce/.gitlab-ci.yml'
33
- local: 'ui/packages/platform/.gitlab-ci.yml'
44

5-
.code_style: &code_style
5+
.ui_checks: &ui_checks
66
rules:
77
- if: $CI_COMMIT_TAG =~ /^ui\/[0-9.]+$/
88
- if: $CI_COMMIT_TAG =~ /^v[a-zA-Z0-9_.-]*/
@@ -14,11 +14,12 @@ include:
1414
cache: &cache
1515
key: "$CI_COMMIT_REF_SLUG"
1616
paths:
17+
- cache/Cypress
1718
- .pnpm-store
1819
policy: pull
1920

2021
check-code-style:
21-
<<: *code_style
22+
<<: *ui_checks
2223
<<: *ui_cache
2324
stage: test
2425
before_script:
@@ -38,7 +39,7 @@ check-code-style:
3839
semgrep-sast:
3940
stage: test
4041
image: returntocorp/semgrep
41-
<<: *code_style
42+
<<: *ui_checks
4243
<<: *ui_cache
4344
variables:
4445
# See more at semgrep.dev/explore.
@@ -55,3 +56,19 @@ semgrep-sast:
5556
artifacts:
5657
reports:
5758
sast: gl-sast-report.json
59+
60+
test:
61+
<<: *ui_checks
62+
<<: *ui_cache
63+
image: node:latest
64+
stage: test
65+
before_script:
66+
- apt update && apt install curl
67+
- apt install -y libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
68+
- npm install -g wait-on
69+
- npm install -g pnpm
70+
- pnpm config set store-dir /builds/postgres-ai/database-lab/.pnpm-store/
71+
script:
72+
- pnpm --dir ui/ i --no-frozen-lockfile
73+
- pnpm --dir ui/ --filter @postgres.ai/ce start & wait-on http://localhost:3001
74+
- pnpm --dir ui/ --filter @postgres.ai/ce cy:run

‎ui/packages/ce/cypress.config.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { defineConfig } from "cypress";
2+
3+
export default defineConfig({
4+
e2e: {
5+
testIsolation: false,
6+
supportFile: false,
7+
baseUrl: 'http://localhost:3001',
8+
screenshotOnRunFailure: false,
9+
video: false,
10+
},
11+
12+
component: {
13+
devServer: {
14+
framework: "create-react-app",
15+
bundler: "webpack",
16+
},
17+
},
18+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* eslint-disable no-undef */
2+
3+
describe('Instance page should have "Configuration" tab with content', () => {
4+
beforeEach(() => {
5+
cy.visit('/')
6+
})
7+
8+
it('should have token in local storage', () => {
9+
cy.window().then((win) => {
10+
if (!win.localStorage.getItem('token')) {
11+
window.localStorage.setItem('token', 'demo-token')
12+
}
13+
})
14+
})
15+
16+
it('should have "Configuration" tab with content', () => {
17+
cy.once('uncaught:exception', () => false)
18+
cy.get('.MuiTabs-flexContainer').contains('Configuration')
19+
cy.get('.MuiBox-root').contains('p').should('have.length.greaterThan', 0)
20+
})
21+
})

‎ui/packages/ce/package.json‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"@material-ui/styles": "^4.11.4",
1313
"@monaco-editor/react": "^4.4.5",
1414
"@mui/material": "^5.10.12",
15-
"@postgres.ai/shared": "link:../shared",
1615
"@postgres.ai/ce": "link:../ce",
16+
"@postgres.ai/shared": "link:../shared",
1717
"@types/node": "^12.20.33",
1818
"@types/react": "^17.0.30",
1919
"@types/react-dom": "^17.0.10",
@@ -25,7 +25,9 @@
2525
"copy-to-clipboard": "^3.3.1",
2626
"create-file-webpack": "^1.0.2",
2727
"crypto-browserify": "^3.12.0",
28+
"cypress": "^12.15.0",
2829
"date-fns": "^2.22.1",
30+
"eslint-plugin-cypress": "^2.13.3",
2931
"formik": "^2.2.9",
3032
"get-user-locale": "^1.4.0",
3133
"mobx": "^6.3.5",
@@ -51,7 +53,13 @@
5153
"lint": "pnpm run lint:code && pnpm run lint:styles && pnpm run lint:spelling",
5254
"lint:code": "eslint --cache './src'",
5355
"lint:styles": "stylelint './src/**/*.scss'",
54-
"lint:spelling": "cspell './src/**/*' --no-progress --no-summary"
56+
"lint:spelling": "cspell './src/**/*' --no-progress --no-summary",
57+
"cy:run": "pnpm cypress run"
58+
},
59+
"eslintConfig": {
60+
"extends": [
61+
"plugin:cypress/recommended"
62+
]
5563
},
5664
"browserslist": {
5765
"production": [

‎ui/packages/ce/src/App/Menu/Header/icons/index.tsx‎

Lines changed: 111 additions & 0 deletions
Large diffs are not rendered by default.

‎ui/packages/ce/src/App/Menu/Header/icons/logo.svg‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎ui/packages/ce/src/App/Menu/Header/icons/stars.svg‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎ui/packages/ce/src/App/Menu/Header/index.tsx‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ import { Button } from '@postgres.ai/shared/components/MenuButton'
66

77
import { ROUTES } from 'config/routes'
88

9-
import logoIconUrl from './icons/logo.svg'
10-
import { ReactComponent as StarsIcon } from './icons/stars.svg'
11-
129
import styles from './styles.module.scss'
13-
import { DLEEdition } from "helpers/edition";
10+
import { DLEEdition } from 'helpers/edition'
11+
import { LogoIcon, StarsIcon } from './icons'
1412

1513
type Props = {
1614
isCollapsed: boolean
@@ -23,7 +21,7 @@ export const Header = (props: Props) => {
2321
to={ROUTES.path}
2422
className={cn(styles.header, props.isCollapsed && styles.collapsed)}
2523
>
26-
<img className={styles.logo}src={logoIconUrl}alt="Database Lab logo" />
24+
<LogoIcon className={styles.logo} />
2725

2826
{!props.isCollapsed && (
2927
<h1 className={styles.title}>

‎ui/packages/ce/src/App/Menu/icons/arrow-left.svg‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎ui/packages/ce/src/App/Menu/icons/arrow-right.svg‎

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /