Skip to content

Commit

Permalink
workflow(ci): distinguish between ai tests and ordinary single tests (#6
Browse files Browse the repository at this point in the history
)

* chore: add ai test command

* chore: optimize test case
  • Loading branch information
zhoushaw authored Jul 25, 2024
1 parent 49cb1ac commit 3444a7d
Show file tree
Hide file tree
Showing 31 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/midscene/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"new": "modern new",
"upgrade": "modern upgrade",
"test": "vitest --run",
"test:all": "AITEST=true vitest --run",
"prepublishOnly": "npm run build"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
],
"error": [],
"prompt": "Switch language(包括中文、english内容)",
"prompt": "Switch language(include:中文、english text)",
},
{
"elements": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export async function runTestCases(


export const repeat = (times: number, fn: (index: number) => void) => {
for (let i = 0; i < times; i++) {
for (let i = 1; i <= times; i++) {
fn(i);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const testCases = [
multi: false,
},
{
description: 'Switch language(包括中文、english内容)',
description: 'Switch language(include:中文、english text)',
multi: false,
},
{
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ exports[`image utils > imageInfo 1`] = `

exports[`image utils > jpeg + base64 + imageInfo 1`] = `
{
"height": 905,
"width": 400,
"height": 720,
"width": 1280,
}
`;

Expand Down
5 changes: 3 additions & 2 deletions packages/midscene/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { defineConfig } from 'vitest/config';
import path from 'path';

const disableAiTest = true;
const aiModelTest = disableAiTest? ['tests/inspector/*.test.ts', 'tests/openai.test.ts', 'tests/showcase.test.ts']: [];
const enableTest = process.env.AITEST;

const aiModelTest = enableTest !== 'true' ? ['tests/ai-model/**/*.test.ts']: [];

export default defineConfig({
test: {
Expand Down
2 changes: 1 addition & 1 deletion packages/web-integration/tests/e2e/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function generateTestData(page: PlaywrightPage, targetDir: string,
export function generateTestDataPath(testDataName: string) {
// `dist/lib/index.js` Is the default export path
const modulePath = require.resolve('@midscene/core').replace('dist/lib/index.js', '');
const midsceneTestDataPath = path.join(modulePath, `tests/inspector/test-data/${testDataName}`);
const midsceneTestDataPath = path.join(modulePath, `tests/ai-model/inspector/test-data/${testDataName}`);

return midsceneTestDataPath;
}
Expand Down

0 comments on commit 3444a7d

Please sign in to comment.