mirror of
https://github.com/web-infra-dev/midscene.git
synced 2025-07-06 16:41:38 +00:00
27 lines
729 B
TypeScript
27 lines
729 B
TypeScript
![]() |
import { join } from 'node:path';
|
||
|
import { parseContextFromWebPage } from '@/common/utils';
|
||
|
import { describe, expect, it } from 'vitest';
|
||
|
import { launchPage } from '../ai/puppeteer/utils';
|
||
|
|
||
|
const pagePath = join(__dirname, './fixtures/extractor.html');
|
||
|
describe.skipIf(typeof process.env.CI !== 'undefined')(
|
||
|
'extractor',
|
||
|
() => {
|
||
|
it('basic', async () => {
|
||
|
const page = await launchPage(`file://${pagePath}`);
|
||
|
|
||
|
const { content } = await parseContextFromWebPage(page);
|
||
|
const list = content.map((item) => {
|
||
|
return {
|
||
|
content: item.content,
|
||
|
attributes: item.attributes,
|
||
|
};
|
||
|
});
|
||
|
expect(list).toMatchSnapshot();
|
||
|
});
|
||
|
},
|
||
|
{
|
||
|
timeout: 90 * 1000,
|
||
|
},
|
||
|
);
|