Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base test arch #76

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ resources/docs/scriptApi
resources/lib/kerneldlls/devices_property/*.xml
ecb_cli.exe
resources/examples/**/tsconfig.json
resources/examples/**/*.code-workspace
resources/examples/**/*.code-workspace
resources/examples/**/*.html
815 changes: 612 additions & 203 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"@electron-toolkit/preload": "^3.0.0",
"@electron-toolkit/utils": "^3.0.0",
"@element-plus/icons-vue": "^2.3.1",
"@iconify/icons-grommet-icons": "^1.2.5",
"@joint/core": "^4.0.4",
"@vitejs/plugin-vue-jsx": "^3.1.0",
"@vueuse/core": "^10.7.2",
Expand Down Expand Up @@ -106,9 +107,7 @@
"@electron-toolkit/eslint-config-ts": "^1.0.1",
"@electron-toolkit/tsconfig": "^1.0.1",
"@electron/rebuild": "^3.7.0",
"@iconify-icons/icon-park": "^1.2.11",
"@iconify/icons-ep": "^1.2.12",
"@iconify/icons-icon-park": "^1.2.11",
"@iconify/icons-material-symbols": "^1.2.58",
"@iconify/icons-ph": "^1.2.5",
"@iconify/vue": "^4.1.1",
Expand All @@ -126,7 +125,7 @@
"dotenv": "^16.4.5",
"electron": "^32.2.3",
"electron-builder": "24.13.3",
"electron-vite": "^2.3.0",
"electron-vite": "^3.0.0",
"eslint": "^8.57.1",
"eslint-plugin-vue": "^9.32.0",
"husky": "^9.1.7",
Expand Down
1 change: 1 addition & 0 deletions resources/examples/test_simple/node.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Util.Init(async () => {})
143 changes: 143 additions & 0 deletions resources/examples/test_simple/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test Report - Test Config 01</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
background: #f5f7fa;
}
.container {
background: white;
border-radius: 8px;
box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
padding: 20px;
}
.header {
border-bottom: 1px solid #ebeef5;
padding-bottom: 20px;
margin-bottom: 20px;
}
.title {
font-size: 24px;
color: #303133;
margin: 0;
}
.timestamp {
color: #909399;
font-size: 14px;
margin-top: 8px;
}
.test-case {
margin: 8px 0;
}
.test-header {
display: flex;
align-items: center;
font-size: 14px;
padding: 8px;
border-radius: 4px;
background: #f8f9fb;
}
.icon {
margin-right: 8px;
}
.name {
flex: 1;
}
.time {
color: #909399;
font-size: 12px;
margin-left: 8px;
}
.children {
margin-left: 20px;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1 class="title">Test Report - Test Config 01</h1>
<div class="timestamp">Generated at: 2025/2/20 22:27:44</div>
</div>
<div class="test-cases">

<div class="test-case" style="margin-left: 0px">
<div class="test-header" style="color: #F56C6C">
<span class="icon">❌</span>
<span class="name">Test Suite</span>
<span class="time">(6.014s)</span>
</div>
</div>
<div class="children">

<div class="test-case" style="margin-left: 0px">
<div class="test-header" style="color: #67C23A">
<span class="icon">✅</span>
<span class="name">Test subSuite</span>
<span class="time">(3.002s)</span>
</div>
</div>
<div class="children">

<div class="test-case" style="margin-left: 0px">
<div class="test-header" style="color: #67C23A">
<span class="icon">✅</span>
<span class="name">Test xxx</span>
<span class="time">(3.002s)</span>
</div>
</div>

</div>
<div class="test-case" style="margin-left: 0px">
<div class="test-header" style="color: #67C23A">
<span class="icon">✅</span>
<span class="name">Test 1</span>
<span class="time">(0.000s)</span>
</div>
</div>

<div class="test-case" style="margin-left: 0px">
<div class="test-header" style="color: #F56C6C">
<span class="icon">❌</span>
<span class="name">Test 2</span>
<span class="time">(3.010s)</span>
</div>
</div>

<div class="test-case" style="margin-left: 0px">
<div class="test-header" style="color: #909399">
<span class="icon">⏭️</span>
<span class="name">Test 3</span>
<span class="time">(0.000s)</span>
</div>
</div>

</div>
<div class="test-case" style="margin-left: 0px">
<div class="test-header" style="color: #67C23A">
<span class="icon">✅</span>
<span class="name">Test Suite 2</span>
<span class="time">(0.000s)</span>
</div>
</div>
<div class="children">

<div class="test-case" style="margin-left: 0px">
<div class="test-header" style="color: #67C23A">
<span class="icon">✅</span>
<span class="name">Test 4</span>
<span class="time">(0.000s)</span>
</div>
</div>

</div>
</div>
</div>
</body>
</html>
46 changes: 46 additions & 0 deletions resources/examples/test_simple/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { describe, test, assert, CanMessage } from 'ECB'

const TestWaitForMessage = async (id: number | true, timeout: number = 1000) => {
return new Promise<CanMessage>((resolve, reject) => {
const timer = setTimeout(() => {
reject(new Error('timeout'))
}, timeout)
Util.OnCanOnce(id, (msg) => {
clearTimeout(timer)
resolve(msg)
})
})
}

const delay = async (ms: number) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve(true)
}, ms)
})
}

describe('Test Suite', () => {
describe('Test subSuite', () => {
test('Test xxx', async () => {
await delay(3000)
assert(true)
})
})
test('Test 1', async () => {
await TestWaitForMessage(0x1, 1000)
assert(true)
})
test('Test 2', async () => {
await delay(3000)
assert(false)
})
test.skip('Test 3', async () => {
assert(true)
})
})
describe('Test Suite 2', () => {
test('Test 4', () => {
assert(true)
})
})
164 changes: 164 additions & 0 deletions resources/examples/test_simple/test_simple.ecb
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"data": {
"devices": {
"b283da7b-1165-4e62-a609-b0eac40cb8a8": {
"type": "can",
"canDevice": {
"id": "b283da7b-1165-4e62-a609-b0eac40cb8a8",
"name": "SIMULATE_0",
"handle": 0,
"vendor": "simulate",
"canfd": false,
"database": "",
"bitrate": {
"sjw": 1,
"timeSeg1": 13,
"timeSeg2": 2,
"preScaler": 10,
"freq": 500000,
"clock": "80",
"_X_ROW_KEY": "row_16"
}
}
}
},
"ia": {
"1e1f0b3f-a46b-45e9-848f-ed899671cd5e": {
"name": "Can IA",
"type": "can",
"id": "1e1f0b3f-a46b-45e9-848f-ed899671cd5e",
"devices": [
"b283da7b-1165-4e62-a609-b0eac40cb8a8"
],
"action": [
{
"trigger": {
"type": "periodic"
},
"name": "",
"id": "1",
"channel": "b283da7b-1165-4e62-a609-b0eac40cb8a8",
"type": "can",
"dlc": 8,
"data": [],
"_X_ROW_KEY": "row_24"
}
]
}
},
"tester": {},
"subFunction": {},
"nodes": {
"b6e943fd-f8f4-44b0-aa6b-f5d4fd7a3018": {
"name": "Node 1",
"type": "can",
"id": "b6e943fd-f8f4-44b0-aa6b-f5d4fd7a3018",
"channel": [
"b283da7b-1165-4e62-a609-b0eac40cb8a8"
],
"workNode": "",
"script": "node.ts"
}
},
"database": {
"lin": {},
"can": {}
},
"graphs": {},
"tests": {
"8e639030-23ea-45f1-a906-82c4bb4fb192": {
"id": "8e639030-23ea-45f1-a906-82c4bb4fb192",
"name": "Test Config 01",
"script": "test.ts",
"reportPath": "./report",
"channel": [
"SIMULATE_0"
]
}
}
},
"project": {
"wins": {
"message": {
"pos": {
"x": 383,
"y": 219,
"w": 2562,
"h": 356
},
"options": {
"params": {}
},
"title": "message",
"label": "Message",
"id": "message",
"layoutType": "bottom"
},
"hardware": {
"pos": {
"x": 329,
"y": 158.5,
"w": 600,
"h": 400
},
"title": "hardware",
"label": "Devices",
"id": "hardware",
"options": {}
},
"network": {
"pos": {
"x": 55,
"y": 30.5,
"w": 600,
"h": 400
},
"title": "network",
"label": "Network",
"id": "network",
"options": {}
},
"test": {
"pos": {
"x": 769.5,
"y": 32,
"w": 600,
"h": 400
},
"title": "test",
"label": "Test",
"id": "test",
"options": {}
},
"1e1f0b3f-a46b-45e9-848f-ed899671cd5e_ia": {
"pos": {
"x": 503.5,
"y": 52,
"w": 700,
"h": 400
},
"title": "cani",
"label": "IA",
"id": "1e1f0b3f-a46b-45e9-848f-ed899671cd5e_ia",
"options": {
"params": {
"edit-index": "1e1f0b3f-a46b-45e9-848f-ed899671cd5e"
},
"name": "Can IA"
}
},
"trace": {
"pos": {
"x": 686.5,
"y": 163,
"w": 700,
"h": 400
},
"title": "trace",
"label": "Trace",
"id": "trace",
"options": {}
}
}
}
}
Loading