mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-04-26 01:10:16 +08:00
fix:通过E2E测试
This commit is contained in:
@@ -222,16 +222,16 @@ app.on("will-quit", () => {
|
||||
// 获取图标路径
|
||||
function getIconPath() {
|
||||
let iconPath = "";
|
||||
const iconFile =
|
||||
process.platform === "win32" ? "amber-pm-logo.ico" : "spark-store.svg"; // 图标文件名,linux下需要png格式,不然会不显示
|
||||
const iconName =
|
||||
process.platform === "win32" ? "amber-pm-logo.ico" : "amber-pm-logo.png"; // 图标文件名,linux下需要png格式,不然会不显示
|
||||
// 判断是否在打包模式
|
||||
if (app.isPackaged) {
|
||||
// 打包模式
|
||||
iconPath = path.join(process.resourcesPath, "icons", iconFile); // 路径根据自身情况调整
|
||||
iconPath = path.join(process.resourcesPath, "icons", iconName); // 路径根据自身情况调整
|
||||
} else {
|
||||
// 开发模式
|
||||
const projectRoot = path.join(__dirname, "../.."); // __dirname 指向 dist-electron/main,但资源在项目根目录,所以..指向上一级
|
||||
iconPath = path.join(projectRoot, "icons", iconFile);
|
||||
iconPath = path.join(projectRoot, "icons", iconName);
|
||||
}
|
||||
|
||||
// 检查文件是否存在
|
||||
|
||||
@@ -11,7 +11,7 @@ export default defineConfig({
|
||||
["json", { outputFile: "test-results.json" }],
|
||||
],
|
||||
use: {
|
||||
baseURL: "http://127.0.0.1:3344",
|
||||
baseURL: "http://127.0.0.1:5173",
|
||||
trace: "on-first-retry",
|
||||
screenshot: "only-on-failure",
|
||||
video: "retain-on-failure",
|
||||
@@ -24,7 +24,7 @@ export default defineConfig({
|
||||
],
|
||||
webServer: {
|
||||
command: "npm run dev",
|
||||
url: "http://127.0.0.1:3344",
|
||||
url: "http://127.0.0.1:5173",
|
||||
reuseExistingServer: !process.env.CI,
|
||||
timeout: 120 * 1000,
|
||||
stdout: "pipe",
|
||||
|
||||
@@ -368,8 +368,10 @@ const closeScreenPreview = () => {
|
||||
};
|
||||
|
||||
// Home data
|
||||
const homeLinks = ref<any[]>([]);
|
||||
const homeLists = ref<Array<{ title: string; apps: any[] }>>([]);
|
||||
const homeLinks = ref<Record<string, unknown>[]>([]);
|
||||
const homeLists = ref<
|
||||
Array<{ title: string; apps: Record<string, unknown>[] }>
|
||||
>([]);
|
||||
const homeLoading = ref(false);
|
||||
const homeError = ref("");
|
||||
|
||||
@@ -405,7 +407,7 @@ const loadHome = async () => {
|
||||
const appsJson = await r.json();
|
||||
const rawApps = appsJson || [];
|
||||
const apps = await Promise.all(
|
||||
rawApps.map(async (a: any) => {
|
||||
rawApps.map(async (a: Record<string, unknown>) => {
|
||||
const baseApp = {
|
||||
name: a.Name || a.name || a.Pkgname || a.PkgName || "",
|
||||
pkgname: a.Pkgname || a.pkgname || "",
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { describe, it, expect, beforeEach } from "vitest";
|
||||
import {
|
||||
downloads,
|
||||
addDownload,
|
||||
removeDownloadItem,
|
||||
} from "@/global/downloadStatus";
|
||||
import { downloads, removeDownloadItem } from "@/global/downloadStatus";
|
||||
import type { DownloadItem } from "@/global/typedefinition";
|
||||
|
||||
describe("downloadStatus", () => {
|
||||
@@ -31,7 +27,7 @@ describe("downloadStatus", () => {
|
||||
retry: false,
|
||||
};
|
||||
|
||||
addDownload(mockDownload);
|
||||
downloads.value.push(mockDownload);
|
||||
|
||||
expect(downloads.value).toHaveLength(1);
|
||||
expect(downloads.value[0].pkgname).toBe("test-app");
|
||||
|
||||
@@ -51,15 +51,15 @@
|
||||
import AppCard from "./AppCard.vue";
|
||||
import { APM_STORE_BASE_URL } from "../global/storeConfig";
|
||||
|
||||
const props = defineProps<{
|
||||
links: Array<any>;
|
||||
lists: Array<{ title: string; apps: any[] }>;
|
||||
defineProps<{
|
||||
links: Array<Record<string, unknown>>;
|
||||
lists: Array<{ title: string; apps: Record<string, unknown>[] }>;
|
||||
loading: boolean;
|
||||
error: string;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: "open-detail", app: any): void;
|
||||
defineEmits<{
|
||||
(e: "open-detail", app: Record<string, unknown>): void;
|
||||
}>();
|
||||
|
||||
const computedImgUrl = (imgUrl: string) => {
|
||||
@@ -68,7 +68,7 @@ const computedImgUrl = (imgUrl: string) => {
|
||||
return `${APM_STORE_BASE_URL}/${window.apm_store.arch}${imgUrl}`;
|
||||
};
|
||||
|
||||
const onLinkClick = (link: any) => {
|
||||
const onLinkClick = (link: Record<string, unknown>) => {
|
||||
if (link.type === "_blank") {
|
||||
window.open(link.url, "_blank");
|
||||
} else {
|
||||
|
||||
@@ -41,10 +41,6 @@ const handleUpdate = () => {
|
||||
emit("update");
|
||||
};
|
||||
|
||||
const handleList = () => {
|
||||
emit("list");
|
||||
};
|
||||
|
||||
const handleSettings = () => {
|
||||
emit("open-install-settings");
|
||||
};
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"target": "ESNext",
|
||||
"useDefineForClassFields": true,
|
||||
"module": "ESNext",
|
||||
@@ -9,12 +15,19 @@
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"lib": [
|
||||
"ESNext",
|
||||
"DOM"
|
||||
],
|
||||
"skipLibCheck": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"include": [
|
||||
"src"
|
||||
],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -13,6 +13,7 @@ export default defineConfig({
|
||||
globals: true,
|
||||
environment: "jsdom",
|
||||
setupFiles: ["./src/__tests__/setup.ts"],
|
||||
include: ["src/__tests__/unit/**/*.test.ts", "src/__tests__/unit/**/*.spec.ts"],
|
||||
coverage: {
|
||||
provider: "v8",
|
||||
reporter: ["text", "json", "html", "lcov"],
|
||||
@@ -28,10 +29,12 @@ export default defineConfig({
|
||||
"**/*.test.ts",
|
||||
"electron/",
|
||||
],
|
||||
thresholds: {
|
||||
statements: 70,
|
||||
branches: 70,
|
||||
functions: 70,
|
||||
lines: 70,
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user