Skip to content

Commit

Permalink
test: add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
quanru committed Sep 5, 2024
1 parent 6b942fe commit 78aecc8
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
16 changes: 14 additions & 2 deletions packages/web-integration/tests/ai/appium/android.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,29 @@ const ANDROID_DEFAULT_OPTIONS = {

describe(
'appium integration',
() => {
it('Android settings page demo', async () => {
async () => {
await it('Android settings page demo for input', async () => {
const page = await launchPage(ANDROID_DEFAULT_OPTIONS);
const mid = new AppiumAgent(page);

await mid.aiAction('输入框中输入“123”');
await mid.aiAction('输入框中输入“456”');
await mid.aiAction('输入框中输入“789”');
});
await it('Android settings page demo for scroll', async () => {
const page = await launchPage(ANDROID_DEFAULT_OPTIONS);
const mid = new AppiumAgent(page);

await mid.aiAction('滑动列表到底部');
await mid.aiAction('打开"更多设置"');
await mid.aiAction('滑动列表到底部');
await mid.aiAction('滑动列表到顶部');
await mid.aiAction('向下滑动一屏');
await mid.aiAction('向上滑动一屏');
});
},
{
timeout: 360 * 1000,
},
);

15 changes: 13 additions & 2 deletions packages/web-integration/tests/ai/appium/ios.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,26 @@ const IOS_DEFAULT_OPTIONS = {

describe(
'appium integration',
() => {
it('iOS settings page demo', async () => {
async () => {
await it('iOS settings page demo for input', async () => {
const page = await launchPage(IOS_DEFAULT_OPTIONS);
const mid = new AppiumAgent(page);

await mid.aiAction('输入框中输入“123”');
await mid.aiAction('输入框中输入“456”');
await mid.aiAction('输入框中输入“789”');
});
await it('iOS settings page demo for scroll', async () => {
const page = await launchPage(IOS_DEFAULT_OPTIONS);
const mid = new AppiumAgent(page);

await mid.aiAction('滑动列表到底部');
await mid.aiAction('打开"开发者"');
await mid.aiAction('滑动列表到底部');
await mid.aiAction('滑动列表到顶部');
await mid.aiAction('向下滑动一屏');
await mid.aiAction('向上滑动一屏');
});
},
{
timeout: 360 * 1000,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { generateExtractData, generateTestDataPath } from '@/debug';
import { test } from '@playwright/test';
import { PlaywrightPage } from '../../../src/playwright';
import { PlaywrightPage } from '@/playwright';

function sleep(time: number) {
return new Promise((resolve) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/web-integration/tests/ai/playright/tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'node:path';
import type { WebPage } from '@/common/page';
import { resizeImg, saveBase64Image } from '@midscene/core/image';
import { processImageElementInfo } from '@midscene/shared/img';
import { getElementInfos } from '../../../src/debug';
import { getElementInfos } from '@/debug';

export async function generateExtractData(
page: WebPage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { describe, expect, it } from 'vitest';

import { AppiumPage } from '../../src/appium';
import { AppiumPage } from '@/appium';

const iosXmlPath = join(
__dirname,
Expand Down

0 comments on commit 78aecc8

Please sign in to comment.