gz-laya-pilot 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/readiness.ts CHANGED
@@ -1,92 +1,92 @@
1
- // Adapted from anthonyli/laya-pilot lib/readiness.mjs (MIT).
2
- import type { Page } from 'playwright';
3
- type Failure = { status: number; path: string; resourceType: string };
4
- type ReadyOptions = { timeout?: number; minimum?: number; failures?: () => Failure[] };
5
-
6
- // Wait for the application, not merely the outer document's DOMContentLoaded.
7
- export async function waitForReady(
8
- page: Page,
9
- { timeout = 18000, minimum = 600, failures = () => [] }: ReadyOptions = {},
10
- ) {
11
- const start = Date.now();
12
- let stableSince = Date.now(),
13
- previous = '',
14
- last;
15
- while (Date.now() - start < timeout) {
16
- const errors = failures().filter(
17
- (x) =>
18
- x.status >= 500 && (/\.html?$|\.js$|\.css$/i.test(x.path) || x.resourceType === 'document'),
19
- );
20
- const states = [];
21
- for (const frame of page.frames())
22
- try {
23
- states.push(
24
- await frame.evaluate(() => {
25
- const visible = (e: Element) => {
26
- const r = e.getBoundingClientRect(),
27
- s = getComputedStyle(e);
28
- return (
29
- r.width > 0 &&
30
- r.height > 0 &&
31
- s.display !== 'none' &&
32
- s.visibility !== 'hidden' &&
33
- !e.closest('[aria-hidden="true"],[inert]')
34
- );
35
- };
36
- const body = document.body;
37
- if (!body) return { controls: 0, busy: true, text: '' };
38
- const text = body.innerText.trim(),
39
- controls = [
40
- ...document.querySelectorAll(
41
- 'button,input:not([type=hidden]),select,textarea,a[href],[role=tab],[role=combobox],[role=menuitem]',
42
- ),
43
- ].filter(visible);
44
- const loading =
45
- [
46
- ...document.querySelectorAll(
47
- '[aria-busy=true],.ant-spin-spinning,.el-loading-mask,[role=progressbar]',
48
- ),
49
- ].some(visible) ||
50
- text
51
- .split('\n')
52
- .some((x) => /^(?:loading\.{0,3}|加载中[.。…]*|正在加载[.。…]*)$/i.test(x.trim()));
53
- return {
54
- controls: controls.length,
55
- busy: loading,
56
- text: text.slice(0, 240),
57
- signature: controls
58
- .slice(0, 60)
59
- .map((x) =>
60
- [
61
- x.getAttribute('role'),
62
- x.tagName,
63
- x.getAttribute('placeholder'),
64
- x.getAttribute('aria-label'),
65
- x.textContent?.trim().slice(0, 25),
66
- ].join(':'),
67
- )
68
- .join('|'),
69
- };
70
- }),
71
- );
72
- } catch { /* A frame can detach while the page is settling. */ }
73
- const count = states.reduce((n, s) => n + s.controls, 0),
74
- busy = states.some((s) => s.busy),
75
- fingerprint = states.map((s) => s.signature || '').join('|');
76
- last = { count, busy };
77
- // A shell may preload unrelated microfrontends. Their errors must not block
78
- // an already usable page; only correlate critical errors with an unready UI.
79
- if (errors.length && (busy || count === 0))
80
- throw new Error(errors.map((x) => x.path + ' HTTP ' + x.status).join(';'));
81
- if (fingerprint !== previous || busy || count === 0) {
82
- previous = fingerprint;
83
- stableSince = Date.now();
84
- }
85
- if (count > 0 && !busy && Date.now() - stableSince >= minimum)
86
- return { duration_ms: Date.now() - start, controls: count };
87
- await page.waitForTimeout(150);
88
- }
89
- throw new Error(
90
- `等待${timeout}ms后页面仍为空白或加载中(控件${last?.count || 0},loading=${last?.busy}),停止本次会话,不继续刷新后续用例`,
91
- );
92
- }
1
+ // Adapted from anthonyli/laya-pilot lib/readiness.mjs (MIT).
2
+ import type { Page } from 'playwright';
3
+ type Failure = { status: number; path: string; resourceType: string };
4
+ type ReadyOptions = { timeout?: number; minimum?: number; failures?: () => Failure[] };
5
+
6
+ // Wait for the application, not merely the outer document's DOMContentLoaded.
7
+ export async function waitForReady(
8
+ page: Page,
9
+ { timeout = 18000, minimum = 600, failures = () => [] }: ReadyOptions = {},
10
+ ) {
11
+ const start = Date.now();
12
+ let stableSince = Date.now(),
13
+ previous = '',
14
+ last;
15
+ while (Date.now() - start < timeout) {
16
+ const errors = failures().filter(
17
+ (x) =>
18
+ x.status >= 500 && (/\.html?$|\.js$|\.css$/i.test(x.path) || x.resourceType === 'document'),
19
+ );
20
+ const states = [];
21
+ for (const frame of page.frames())
22
+ try {
23
+ states.push(
24
+ await frame.evaluate(() => {
25
+ const visible = (e: Element) => {
26
+ const r = e.getBoundingClientRect(),
27
+ s = getComputedStyle(e);
28
+ return (
29
+ r.width > 0 &&
30
+ r.height > 0 &&
31
+ s.display !== 'none' &&
32
+ s.visibility !== 'hidden' &&
33
+ !e.closest('[aria-hidden="true"],[inert]')
34
+ );
35
+ };
36
+ const body = document.body;
37
+ if (!body) return { controls: 0, busy: true, text: '' };
38
+ const text = body.innerText.trim(),
39
+ controls = [
40
+ ...document.querySelectorAll(
41
+ 'button,input:not([type=hidden]),select,textarea,a[href],[role=tab],[role=combobox],[role=menuitem]',
42
+ ),
43
+ ].filter(visible);
44
+ const loading =
45
+ [
46
+ ...document.querySelectorAll(
47
+ '[aria-busy=true],.ant-spin-spinning,.el-loading-mask,[role=progressbar]',
48
+ ),
49
+ ].some(visible) ||
50
+ text
51
+ .split('\n')
52
+ .some((x) => /^(?:loading\.{0,3}|加载中[.。…]*|正在加载[.。…]*)$/i.test(x.trim()));
53
+ return {
54
+ controls: controls.length,
55
+ busy: loading,
56
+ text: text.slice(0, 240),
57
+ signature: controls
58
+ .slice(0, 60)
59
+ .map((x) =>
60
+ [
61
+ x.getAttribute('role'),
62
+ x.tagName,
63
+ x.getAttribute('placeholder'),
64
+ x.getAttribute('aria-label'),
65
+ x.textContent?.trim().slice(0, 25),
66
+ ].join(':'),
67
+ )
68
+ .join('|'),
69
+ };
70
+ }),
71
+ );
72
+ } catch { /* A frame can detach while the page is settling. */ }
73
+ const count = states.reduce((n, s) => n + s.controls, 0),
74
+ busy = states.some((s) => s.busy),
75
+ fingerprint = states.map((s) => s.signature || '').join('|');
76
+ last = { count, busy };
77
+ // A shell may preload unrelated microfrontends. Their errors must not block
78
+ // an already usable page; only correlate critical errors with an unready UI.
79
+ if (errors.length && (busy || count === 0))
80
+ throw new Error(errors.map((x) => x.path + ' HTTP ' + x.status).join(';'));
81
+ if (fingerprint !== previous || busy || count === 0) {
82
+ previous = fingerprint;
83
+ stableSince = Date.now();
84
+ }
85
+ if (count > 0 && !busy && Date.now() - stableSince >= minimum)
86
+ return { duration_ms: Date.now() - start, controls: count };
87
+ await page.waitForTimeout(150);
88
+ }
89
+ throw new Error(
90
+ `等待${timeout}ms后页面仍为空白或加载中(控件${last?.count || 0},loading=${last?.busy}),停止本次会话,不继续刷新后续用例`,
91
+ );
92
+ }
package/src/replay.ts CHANGED
@@ -2,7 +2,15 @@ import type { Page, BrowserContext, LaunchOptions, BrowserContextOptions } from
2
2
  import { openBrowser } from './browser.js';
3
3
  import { waitForReady } from './readiness.js';
4
4
  import { runAssertion } from './assertions.js';
5
- import { parseCase, type RunStatus, type AssertionResult, type Target } from './schema.js';
5
+ import {
6
+ isRequestAssertion,
7
+ parseCase,
8
+ type Assertion,
9
+ type RunStatus,
10
+ type AssertionResult,
11
+ type Target,
12
+ } from './schema.js';
13
+ import { observeActionRequests } from './request-assertions.js';
6
14
 
7
15
  export interface ReplayOptions {
8
16
  origin: string;
@@ -83,6 +91,7 @@ export async function runCase(value: unknown, options: ReplayOptions): Promise<R
83
91
  void browser.close().catch(() => {});
84
92
  };
85
93
  options.signal?.addEventListener('abort', stop, { once: true });
94
+ let requests: ReturnType<typeof observeActionRequests> | undefined;
86
95
  try {
87
96
  if (options.signal?.aborted) throw Error('已停止');
88
97
  await context.route('**/*', (route) =>
@@ -113,18 +122,25 @@ export async function runCase(value: unknown, options: ReplayOptions): Promise<R
113
122
  expected: step.value,
114
123
  timeout: 10000,
115
124
  };
116
- const result = await runAssertion(
117
- page,
118
- assertion,
119
- index + 1,
120
- () => options.signal?.aborted === true,
121
- );
125
+ const result = isRequestAssertion(assertion.source)
126
+ ? await requests!.check(assertion, index + 1, options.signal)
127
+ : await runAssertion(page, assertion, index + 1, () => options.signal?.aborted === true);
122
128
  assertions.push(result);
123
129
  report({});
124
130
  if (!result.passed) throw Error(`第 ${index + 1} 步断言失败:${assertion.name}`);
125
131
  } else {
126
132
  if (step.kind === 'unsupported' || !step.target) throw Error('请先补充未支持的步骤');
127
133
  const target = await resolveTarget(page, step.target);
134
+ requests?.close();
135
+ const upcoming: Assertion[] = [];
136
+ for (const next of testCase.steps.slice(index + 1)) {
137
+ if (next.kind !== 'assert' && next.kind !== 'assert-text') break;
138
+ if (next.assertion && isRequestAssertion(next.assertion.source))
139
+ upcoming.push(next.assertion);
140
+ }
141
+ requests = upcoming.length
142
+ ? observeActionRequests(page, origin.origin, upcoming)
143
+ : undefined;
128
144
  if (step.kind === 'click') await target.click();
129
145
  else if (step.kind === 'fill') await target.fill(step.value!);
130
146
  else if (step.kind === 'select') await target.selectOption(step.value!);
@@ -147,6 +163,7 @@ export async function runCase(value: unknown, options: ReplayOptions): Promise<R
147
163
  : (error instanceof Error ? error.message : String(error)).slice(0, 1500),
148
164
  });
149
165
  } finally {
166
+ requests?.close();
150
167
  options.signal?.removeEventListener('abort', stop);
151
168
  await browser.close();
152
169
  }
@@ -0,0 +1,83 @@
1
+ import type { Page, Request, Response } from 'playwright';
2
+ import type { Assertion, AssertionResult } from './schema.js';
3
+
4
+ export function observeActionRequests(page: Page, origin: string, assertions: Assertion[]) {
5
+ const started = performance.now();
6
+ const deadlines = assertions.map((a) => started + a.timeout);
7
+ const matches = assertions.map(() => ({ count: 0, succeeded: 0, failed: 0 }));
8
+ const pending = new Map<Request, { indexes: number[]; status?: number }>();
9
+ const request = (req: Request) => {
10
+ if (!['fetch', 'xhr'].includes(req.resourceType())) return;
11
+ const url = new URL(req.url());
12
+ if (url.origin !== origin) return;
13
+ const now = performance.now();
14
+ const indexes: number[] = [];
15
+ assertions.forEach((a, index) => {
16
+ if (now <= deadlines[index] && req.method() === a.method && url.pathname === a.pathname) {
17
+ matches[index].count++;
18
+ indexes.push(index);
19
+ }
20
+ });
21
+ if (indexes.length) pending.set(req, { indexes });
22
+ };
23
+ const response = (res: Response) => {
24
+ const current = pending.get(res.request());
25
+ if (current) current.status = res.status();
26
+ };
27
+ const finish = (req: Request, failed: boolean) => {
28
+ const current = pending.get(req);
29
+ if (!current) return;
30
+ pending.delete(req);
31
+ const completed = performance.now();
32
+ for (const index of current.indexes) {
33
+ if (completed > deadlines[index]) continue;
34
+ const status = failed ? 0 : (current.status ?? 0);
35
+ if (status >= 200 && status < 300) matches[index].succeeded++;
36
+ else matches[index].failed++;
37
+ }
38
+ };
39
+ const finished = (req: Request) => void finish(req, false);
40
+ const failed = (req: Request) => void finish(req, true);
41
+ page
42
+ .on('request', request)
43
+ .on('response', response)
44
+ .on('requestfinished', finished)
45
+ .on('requestfailed', failed);
46
+
47
+ return {
48
+ close() {
49
+ page
50
+ .off('request', request)
51
+ .off('response', response)
52
+ .off('requestfinished', finished)
53
+ .off('requestfailed', failed);
54
+ pending.clear();
55
+ },
56
+ async check(
57
+ assertion: Assertion,
58
+ step: number,
59
+ signal?: AbortSignal,
60
+ ): Promise<AssertionResult> {
61
+ const index = assertions.indexOf(assertion);
62
+ const deadline = deadlines[index];
63
+ while (performance.now() < deadline) {
64
+ if (signal?.aborted) throw Error('已停止');
65
+ await page.waitForTimeout(Math.min(50, Math.max(1, deadline - performance.now())));
66
+ }
67
+ if (signal?.aborted) throw Error('已停止');
68
+ const { count, succeeded, failed } = matches[index];
69
+ const name = `${assertion.method} ${assertion.pathname}`;
70
+ const exact = assertion.source === 'request-count';
71
+ return {
72
+ step,
73
+ name: assertion.name,
74
+ passed: exact ? count === Number(assertion.expected) : count > 0 && count === succeeded,
75
+ expected: exact
76
+ ? `${name} 调用 ${assertion.expected} 次`
77
+ : `${name} 至少调用一次且全部 HTTP 2xx`,
78
+ actual: `${name} · 调用 ${count} 次 · 成功 ${succeeded} · 失败 ${failed} · 未完成 ${count - succeeded - failed}`,
79
+ duration: assertion.timeout,
80
+ };
81
+ },
82
+ };
83
+ }
package/src/schema.ts CHANGED
@@ -18,6 +18,8 @@ export const assertionSources = {
18
18
  'element-value': '输入框值',
19
19
  'element-state': '元素可见性',
20
20
  'element-count': '元素数量',
21
+ 'request-count': '接口调用次数',
22
+ 'request-success': '接口成功',
21
23
  } as const;
22
24
  export const assertionOperators = {
23
25
  contains: '包含',
@@ -26,6 +28,7 @@ export const assertionOperators = {
26
28
  'not-equals': '不等于',
27
29
  visible: '可见',
28
30
  hidden: '不可见或不存在',
31
+ successful: '全部成功',
29
32
  } as const;
30
33
  export interface Assertion {
31
34
  name: string;
@@ -33,13 +36,20 @@ export interface Assertion {
33
36
  operator: keyof typeof assertionOperators;
34
37
  selector?: string;
35
38
  expected?: string;
39
+ method?: string;
40
+ pathname?: string;
36
41
  timeout: number;
37
42
  }
38
43
  export function operatorsFor(source: Assertion['source']): Assertion['operator'][] {
44
+ if (source === 'request-count') return ['equals'];
45
+ if (source === 'request-success') return ['successful'];
39
46
  if (source === 'element-state') return ['visible', 'hidden'];
40
47
  if (source === 'element-count') return ['equals', 'not-equals'];
41
48
  return ['contains', 'not-contains', 'equals', 'not-equals'];
42
49
  }
50
+ export const isRequestAssertion = (source: Assertion['source']) =>
51
+ source === 'request-count' || source === 'request-success';
52
+
43
53
  export function parseAssertion(value: unknown): Assertion {
44
54
  const a = value as Assertion;
45
55
  if (!a || typeof a.name !== 'string' || !a.name.trim() || a.name.length > 100)
@@ -48,6 +58,36 @@ export function parseAssertion(value: unknown): Assertion {
48
58
  throw Error('不支持的断言对象或条件');
49
59
  if (!Number.isInteger(a.timeout) || a.timeout < 500 || a.timeout > 30000)
50
60
  throw Error('断言等待时间应为 500–30,000 毫秒');
61
+ if (isRequestAssertion(a.source)) {
62
+ const method = typeof a.method === 'string' ? a.method.trim().toUpperCase() : '';
63
+ const pathname = a.pathname;
64
+ if (!/^[A-Z]{1,16}$/.test(method)) throw Error('请填写 HTTP 方法');
65
+ if (
66
+ typeof pathname !== 'string' ||
67
+ pathname.length > 2000 ||
68
+ !pathname.startsWith('/') ||
69
+ pathname.startsWith('//') ||
70
+ /[?#\\\s\x00-\x1f\x7f]/.test(pathname) ||
71
+ new URL(pathname, 'http://localhost').pathname !== pathname
72
+ )
73
+ throw Error('请填写站内接口路径,勿包含查询参数或片段');
74
+ if (
75
+ a.source === 'request-count' &&
76
+ (typeof a.expected !== 'string' ||
77
+ !/^\d{1,6}$/.test(a.expected) ||
78
+ Number(a.expected) > 100000)
79
+ )
80
+ throw Error('调用次数应为 0–100,000 的整数');
81
+ return {
82
+ name: a.name.trim(),
83
+ source: a.source,
84
+ operator: a.operator,
85
+ timeout: a.timeout,
86
+ method,
87
+ pathname,
88
+ ...(a.source === 'request-count' ? { expected: a.expected } : {}),
89
+ };
90
+ }
51
91
  if (
52
92
  a.source !== 'page-text' &&
53
93
  (typeof a.selector !== 'string' || !a.selector.trim() || a.selector.length > 2000)
@@ -172,6 +212,12 @@ export function parseCase(value: unknown): TestCase {
172
212
  ...(step.supplemented === true ? { supplemented: true } : {}),
173
213
  };
174
214
  });
215
+ let hasAction = false;
216
+ for (const step of steps) {
217
+ if (step.assertion && isRequestAssertion(step.assertion.source) && !hasAction)
218
+ throw Error('接口断言必须放在一次操作之后');
219
+ if (step.target) hasAction = true;
220
+ }
175
221
  let timeline: TestCase['timeline'];
176
222
  if (input.timeline !== undefined) {
177
223
  if (
package/src/targets.ts CHANGED
@@ -1,61 +1,61 @@
1
- import { computeAccessibleName, getRole } from 'dom-accessibility-api';
2
- import type { Target } from './schema.js';
3
-
4
- export const excluded = '[data-research-assistant],.research-assistant,[data-private],.rr-block';
5
- export const controls =
6
- 'button,a[href],input,textarea,select,[role="button"],[role="tab"],[role="option"],[role="menuitem"],[role="checkbox"],[role="combobox"],summary';
7
- export const normalizeText = (value: string) => value.replace(/\s+/g, ' ').trim();
8
-
9
- /** Accessible names follow the W3C AccName algorithm, including labelledby and label-for. */
10
- export function describeControl(element: Element) {
11
- const role = getRole(element) ?? undefined;
12
- const explicit = element.getAttribute('data-assistant-label');
13
- const accessible = computeAccessibleName(element, { computedStyleSupportsPseudoElements: false });
14
- const fallback =
15
- element.getAttribute('placeholder') ||
16
- element.getAttribute('name') ||
17
- role ||
18
- element.tagName.toLowerCase();
19
- return {
20
- role,
21
- label: normalizeText(explicit || accessible || fallback).slice(0, 200),
22
- labelSource: explicit ? 'business-label' : accessible ? 'accessible-name' : 'attribute',
23
- testId: element.getAttribute('data-testid') ?? undefined,
24
- };
25
- }
26
- export function privateInput(element: Element) {
27
- return (
28
- Boolean(element.closest('[data-private],.rr-block')) ||
29
- /password|passwd|token|secret|credential|验证码|密码|密钥|口令/i.test(
30
- ['type', 'name', 'id', 'autocomplete', 'aria-label', 'placeholder']
31
- .map((key) => element.getAttribute(key))
32
- .join(' ') +
33
- ' ' +
34
- computeAccessibleName(element, { computedStyleSupportsPseudoElements: false }),
35
- )
36
- );
37
- }
38
- export function locate(element: Element): Target {
39
- const { label, role, labelSource } = describeControl(element);
40
- const semantic = role && labelSource === 'accessible-name' ? { role } : {};
41
- const doc = element.ownerDocument;
42
- for (const attribute of ['data-testid', 'id', 'aria-label', 'placeholder', 'name']) {
43
- const value = element.getAttribute(attribute);
44
- const selector = `${element.tagName.toLowerCase()}[${attribute}=${JSON.stringify(value ?? '')}]`;
45
- if (value && doc.querySelectorAll(selector).length === 1)
46
- return { selector, label, ...semantic };
47
- }
48
- const path: string[] = [];
49
- for (
50
- let current: Element | null = element;
51
- current && current !== doc.body;
52
- current = current.parentElement
53
- ) {
54
- const parent: Element | null = current.parentElement;
55
- if (!parent) break;
56
- const index =
57
- [...parent.children].filter((e) => e.tagName === current!.tagName).indexOf(current) + 1;
58
- path.unshift(`${current.tagName.toLowerCase()}:nth-of-type(${index})`);
59
- }
60
- return { selector: `body > ${path.join(' > ')}`, label, ...semantic };
61
- }
1
+ import { computeAccessibleName, getRole } from 'dom-accessibility-api';
2
+ import type { Target } from './schema.js';
3
+
4
+ export const excluded = '[data-research-assistant],.research-assistant,[data-private],.rr-block';
5
+ export const controls =
6
+ 'button,a[href],input,textarea,select,[role="button"],[role="tab"],[role="option"],[role="menuitem"],[role="checkbox"],[role="combobox"],summary';
7
+ export const normalizeText = (value: string) => value.replace(/\s+/g, ' ').trim();
8
+
9
+ /** Accessible names follow the W3C AccName algorithm, including labelledby and label-for. */
10
+ export function describeControl(element: Element) {
11
+ const role = getRole(element) ?? undefined;
12
+ const explicit = element.getAttribute('data-assistant-label');
13
+ const accessible = computeAccessibleName(element, { computedStyleSupportsPseudoElements: false });
14
+ const fallback =
15
+ element.getAttribute('placeholder') ||
16
+ element.getAttribute('name') ||
17
+ role ||
18
+ element.tagName.toLowerCase();
19
+ return {
20
+ role,
21
+ label: normalizeText(explicit || accessible || fallback).slice(0, 200),
22
+ labelSource: explicit ? 'business-label' : accessible ? 'accessible-name' : 'attribute',
23
+ testId: element.getAttribute('data-testid') ?? undefined,
24
+ };
25
+ }
26
+ export function privateInput(element: Element) {
27
+ return (
28
+ Boolean(element.closest('[data-private],.rr-block')) ||
29
+ /password|passwd|token|secret|credential|验证码|密码|密钥|口令/i.test(
30
+ ['type', 'name', 'id', 'autocomplete', 'aria-label', 'placeholder']
31
+ .map((key) => element.getAttribute(key))
32
+ .join(' ') +
33
+ ' ' +
34
+ computeAccessibleName(element, { computedStyleSupportsPseudoElements: false }),
35
+ )
36
+ );
37
+ }
38
+ export function locate(element: Element): Target {
39
+ const { label, role, labelSource } = describeControl(element);
40
+ const semantic = role && labelSource === 'accessible-name' ? { role } : {};
41
+ const doc = element.ownerDocument;
42
+ for (const attribute of ['data-testid', 'id', 'aria-label', 'placeholder', 'name']) {
43
+ const value = element.getAttribute(attribute);
44
+ const selector = `${element.tagName.toLowerCase()}[${attribute}=${JSON.stringify(value ?? '')}]`;
45
+ if (value && doc.querySelectorAll(selector).length === 1)
46
+ return { selector, label, ...semantic };
47
+ }
48
+ const path: string[] = [];
49
+ for (
50
+ let current: Element | null = element;
51
+ current && current !== doc.body;
52
+ current = current.parentElement
53
+ ) {
54
+ const parent: Element | null = current.parentElement;
55
+ if (!parent) break;
56
+ const index =
57
+ [...parent.children].filter((e) => e.tagName === current!.tagName).indexOf(current) + 1;
58
+ path.unshift(`${current.tagName.toLowerCase()}:nth-of-type(${index})`);
59
+ }
60
+ return { selector: `body > ${path.join(' > ')}`, label, ...semantic };
61
+ }
@@ -1,5 +1,5 @@
1
- # Preserve upstream Git blob bytes for provenance checks on every platform.
2
- laya-pilot/** -text
3
- patches/** text eol=lf
4
- patches/*.patch whitespace=-blank-at-eol
5
- UPSTREAM.json text eol=lf
1
+ # Preserve upstream Git blob bytes for provenance checks on every platform.
2
+ laya-pilot/** -text
3
+ patches/** text eol=lf
4
+ patches/*.patch whitespace=-blank-at-eol
5
+ UPSTREAM.json text eol=lf