Skip to content

Commit dbee190

Browse files
authored
add UI test for codegen (#244)
Signed-off-by: Yue, Wenjiao <wenjiao.yue@intel.com> Signed-off-by: Sun, Xuehao <xuehao.sun@intel.com>
1 parent 3237ee4 commit dbee190

32 files changed

Lines changed: 1145 additions & 247 deletions
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[*]
2+
indent_style = tab
3+
4+
[package.json]
5+
indent_style = space
6+
indent_size = 2
7+
8+
[*.md]
9+
indent_style = space
10+
indent_size = 2

CodeGen/docker/ui/svelte/.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
BASIC_URL = 'http://xxx.xxx.xxx.xxx:yyyy'
1+
BASIC_URL = 'http://backend_address:7778/v1/codegen'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example
9+
10+
# Ignore files for PNPM, NPM and YARN
11+
pnpm-lock.yaml
12+
package-lock.json
13+
yarn.lock
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) 2024 Intel Corporation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
module.exports = {
16+
root: true,
17+
parser: "@typescript-eslint/parser",
18+
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
19+
plugins: ["svelte3", "@typescript-eslint", "neverthrow"],
20+
ignorePatterns: ["*.cjs"],
21+
overrides: [{ files: ["*.svelte"], processor: "svelte3/svelte3" }],
22+
settings: {
23+
"svelte3/typescript": () => require("typescript"),
24+
},
25+
parserOptions: {
26+
sourceType: "module",
27+
ecmaVersion: 2020,
28+
},
29+
env: {
30+
browser: true,
31+
es2017: true,
32+
node: true,
33+
},
34+
};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DS_Store
2+
node_modules
3+
/build
4+
/.svelte-kit
5+
/package
6+
.env
7+
.env.*
8+
!.env.example
9+
10+
# Ignore files for PNPM, NPM and YARN
11+
pnpm-lock.yaml
12+
package-lock.json
13+
yarn.lock
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"pluginSearchDirs": [
3+
"."
4+
],
5+
"overrides": [
6+
{
7+
"files": "*.svelte",
8+
"options": {
9+
"parser": "svelte"
10+
}
11+
}
12+
]
13+
}

CodeGen/docker/ui/svelte/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Here're some of the project's features:
1818

1919
3. Modify the required .env variables.
2020
```
21-
BASIC_URL = ''
21+
BASE_URL = ''
2222
```
2323
4. Execute `npm install` to install the corresponding dependencies.
2424

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,62 @@
11
{
2-
"name": "doc-summary",
2+
"name": "sveltekit-auth-example",
33
"version": "0.0.1",
4+
"private": true,
45
"scripts": {
56
"dev": "vite dev",
6-
"build": "vite build && npm run package",
7+
"build": "vite build",
78
"preview": "vite preview",
8-
"package": "svelte-kit sync && svelte-package && publint",
9-
"prepublishOnly": "npm run package",
109
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
11-
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
12-
},
13-
"exports": {
14-
".": {
15-
"types": "./dist/index.d.ts",
16-
"svelte": "./dist/index.js"
17-
}
18-
},
19-
"files": [
20-
"dist",
21-
"!dist/**/*.test.*",
22-
"!dist/**/*.spec.*"
23-
],
24-
"peerDependencies": {
25-
"svelte": "^4.0.0"
10+
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
11+
"lint": "prettier --check . && eslint .",
12+
"format": "prettier --write ."
2613
},
2714
"devDependencies": {
28-
"@sveltejs/adapter-auto": "^3.0.0",
29-
"@sveltejs/kit": "^2.0.0",
30-
"@sveltejs/package": "^2.0.0",
31-
"@sveltejs/vite-plugin-svelte": "^3.0.0",
32-
"autoprefixer": "^10.4.16",
33-
"flowbite": "^2.3.0",
34-
"flowbite-svelte": "^0.44.24",
35-
"flowbite-svelte-icons": "^1.4.5",
36-
"postcss": "^8.4.32",
37-
"postcss-load-config": "^5.0.2",
38-
"publint": "^0.1.9",
39-
"svelte": "^4.2.7",
40-
"svelte-check": "^3.6.0",
41-
"tailwindcss": "^3.3.6",
42-
"tslib": "^2.4.1",
43-
"typescript": "^5.0.0",
44-
"vite": "^5.0.11"
15+
"@fortawesome/free-solid-svg-icons": "6.2.0",
16+
"@playwright/test": "^1.44.1",
17+
"@sveltejs/adapter-auto": "^1.0.0-next.75",
18+
"@sveltejs/kit": "^1.20.1",
19+
"@tailwindcss/typography": "0.5.7",
20+
"@types/debug": "4.1.7",
21+
"@typescript-eslint/eslint-plugin": "^5.27.0",
22+
"@typescript-eslint/parser": "^5.27.0",
23+
"autoprefixer": "^10.4.7",
24+
"daisyui": "3.5.1",
25+
"date-picker-svelte": "^2.6.0",
26+
"debug": "4.3.4",
27+
"eslint": "^8.16.0",
28+
"eslint-config-prettier": "^8.3.0",
29+
"eslint-plugin-neverthrow": "1.1.4",
30+
"eslint-plugin-svelte3": "^4.0.0",
31+
"postcss": "^8.4.23",
32+
"postcss-load-config": "^4.0.1",
33+
"postcss-preset-env": "^8.3.2",
34+
"prettier": "^2.8.8",
35+
"prettier-plugin-svelte": "^2.7.0",
36+
"prettier-plugin-tailwindcss": "^0.3.0",
37+
"svelte": "^3.59.1",
38+
"svelte-check": "^2.7.1",
39+
"svelte-fa": "3.0.3",
40+
"svelte-highlight": "^7.6.1",
41+
"svelte-loading-spinners": "^0.3.6",
42+
"svelte-preprocess": "^4.10.7",
43+
"tailwindcss": "^3.1.5",
44+
"tslib": "^2.3.1",
45+
"typescript": "^4.7.4",
46+
"vite": "^4.3.9"
4547
},
46-
"svelte": "./dist/index.js",
47-
"types": "./dist/index.d.ts",
4848
"type": "module",
4949
"dependencies": {
50-
"highlight.js": "^11.9.0",
50+
"date-fns": "^2.30.0",
51+
"driver.js": "^1.3.0",
52+
"flowbite-svelte": "^0.38.5",
53+
"flowbite-svelte-icons": "^1.4.0",
54+
"fuse.js": "^6.6.2",
55+
"lodash": "^4.17.21",
56+
"marked": "^12.0.2",
57+
"ramda": "^0.29.0",
5158
"sse.js": "^0.6.1",
52-
"svelte-notifications": "^0.9.98"
59+
"svelte-notifications": "^0.9.98",
60+
"svrollbar": "^0.12.0"
5361
}
5462
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright (C) 2024 Intel Corporation
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
import { defineConfig, devices } from "@playwright/test";
5+
6+
/**
7+
* Read environment variables from file.
8+
* https://github.com/motdotla/dotenv
9+
*/
10+
// require('dotenv').config();
11+
12+
/**
13+
* See https://playwright.dev/docs/test-configuration.
14+
*/
15+
export default defineConfig({
16+
testDir: "./tests",
17+
/* Maximum time one test can run for. */
18+
timeout: 30 * 1000,
19+
expect: {
20+
/**
21+
* Maximum time expect() should wait for the condition to be met.
22+
* For example in `await expect(locator).toHaveText();`
23+
*/
24+
timeout: 5000,
25+
},
26+
/* Run tests in files in parallel */
27+
fullyParallel: true,
28+
/* Fail the build on CI if you accidentally left test.only in the source code. */
29+
forbidOnly: !!process.env.CI,
30+
/* Retry on CI only */
31+
retries: process.env.CI ? 2 : 0,
32+
/* Opt out of parallel tests on CI. */
33+
workers: process.env.CI ? 1 : undefined,
34+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
35+
reporter: [["html", { open: "never" }]],
36+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
37+
use: {
38+
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
39+
actionTimeout: 0,
40+
/* Base URL to use in actions like `await page.goto('/')`. */
41+
baseURL: "http://localhost:5173",
42+
43+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
44+
trace: "on-first-retry",
45+
},
46+
47+
/* Configure projects for major browsers */
48+
projects: [
49+
{
50+
name: "webkit",
51+
use: { ...devices["Desktop Safari"] },
52+
},
53+
],
54+
});
Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1+
// Copyright (c) 2024 Intel Corporation
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
const tailwindcss = require("tailwindcss");
216
const autoprefixer = require("autoprefixer");
317

418
const config = {
5-
plugins: [
6-
//Some plugins, like tailwindcss/nesting, need to run before Tailwind,
7-
tailwindcss(),
8-
//But others, like autoprefixer, need to run after,
9-
autoprefixer,
10-
],
19+
plugins: [
20+
//Some plugins, like tailwindcss/nesting, need to run before Tailwind,
21+
tailwindcss(),
22+
//But others, like autoprefixer, need to run after,
23+
autoprefixer,
24+
],
1125
};
1226

1327
module.exports = config;

0 commit comments

Comments
 (0)