2024-08-08 15:39:07 +08:00
|
|
|
import { execa } from 'execa';
|
2024-11-25 16:05:01 +08:00
|
|
|
import { describe, test, vi } from 'vitest';
|
2024-08-08 15:39:07 +08:00
|
|
|
|
|
|
|
const cliBin = require.resolve('../bin/midscene');
|
|
|
|
vi.setConfig({
|
2024-11-25 16:05:01 +08:00
|
|
|
testTimeout: 120 * 1000,
|
2024-08-08 15:39:07 +08:00
|
|
|
});
|
|
|
|
|
2024-11-25 16:05:01 +08:00
|
|
|
const shouldRunAITest =
|
|
|
|
process.platform !== 'linux' || process.env.AITEST === 'true';
|
|
|
|
|
|
|
|
describe.skipIf(!shouldRunAITest)('bin', () => {
|
|
|
|
test('run yaml scripts', async () => {
|
|
|
|
const params = ['./tests/midscene_scripts'];
|
|
|
|
await execa(cliBin, params);
|
|
|
|
});
|
2024-08-08 15:39:07 +08:00
|
|
|
|
2024-11-25 16:05:01 +08:00
|
|
|
test('run yaml scripts with keepWindow', async () => {
|
|
|
|
const params = ['./tests/midscene_scripts', '--keep-window'];
|
|
|
|
await execa(cliBin, params);
|
2024-08-08 15:39:07 +08:00
|
|
|
});
|
2024-11-12 11:54:40 +08:00
|
|
|
|
2024-11-25 16:05:01 +08:00
|
|
|
test('run yaml scripts with headed, put options before path', async () => {
|
|
|
|
const params = ['--headed', './tests/midscene_scripts'];
|
|
|
|
await execa(cliBin, params);
|
2024-11-12 11:54:40 +08:00
|
|
|
});
|
2024-08-08 15:39:07 +08:00
|
|
|
});
|