forked from boostcampwm-2024/web15-OctoDocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperformance-test.ts
35 lines (31 loc) · 1.3 KB
/
performance-test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
async function performanceTest(page) {
await page.goto("https://octodocs.local");
const element = await page.getByTestId("rf__node-4");
// tanstack이 띄워져 있으면 제거
const tanstackClose = await page.locator(
'button[aria-label="Close tanstack query devtools"]'
);
if (tanstackClose) {
await tanstackClose.click();
}
await element.scrollIntoViewIfNeeded();
await element.click();
const document = await page.locator('div[contenteditable="true"]');
await document.waitFor({ state: "visible" }); // 요소가 보일 때까지 기다림
await document.click();
// "hello world"를 차례대로 입력
await page.keyboard.type("h", { delay: 100 });
await page.keyboard.type("e", { delay: 100 });
await page.keyboard.type("l", { delay: 100 });
await page.keyboard.type("l", { delay: 100 });
await page.keyboard.type("o", { delay: 100 });
await page.keyboard.type(" ");
await page.keyboard.type("w", { delay: 100 });
await page.keyboard.type("o", { delay: 100 });
await page.keyboard.type("r", { delay: 100 });
await page.keyboard.type("l", { delay: 100 });
await page.keyboard.type("d", { delay: 100 });
// await page.locator('input[type="text"]').fill(""); // 기존 값 지우기
// Expect a title "to contain" a substring.
}
module.exports = { performanceTest };