Skip to content

Commit 85e1aca

Browse files
authored
fix: test case (#185)
* fix: test case * revert: revert code * test: 增加测试中的等待时间从10ms到60ms --------- Co-authored-by: huang yao <5945154+kirakiray@users.noreply.github.com>
1 parent 56c8e8c commit 85e1aca

File tree

13 files changed

+44
-44
lines changed

13 files changed

+44
-44
lines changed

test/cases/230810/230810.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { test, expect } = require("@playwright/test");
33
test("bug: x-if the first time it renders multiple", async ({ page }) => {
44
await page.goto("http://localhost:3398/test/cases/230810/x-if-bug.html");
55

6-
await page.waitForTimeout(10);
6+
await page.waitForTimeout(60);
77

88
const childsLen = await page.$eval("#condition-container", (node) => {
99
return node.children.length;

test/cases/230816/230816.spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { test, expect } from "@playwright/test";
22

33
test("bug: x-fill in x-if", async ({ page }) => {
44
await page.goto("http://localhost:3398/test/cases/230816/fill-in-if.html");
5-
await page.waitForTimeout(10);
5+
await page.waitForTimeout(60);
66

77
await page.getByTestId("item-0").click();
88
await page.getByTestId("item-1").click();
@@ -12,14 +12,14 @@ test("bug: x-fill in x-if", async ({ page }) => {
1212
expect(!!(await page.$('[data-testid="item-1-span"]'))).toBe(true);
1313

1414
await page.getByRole("button", { name: "switch" }).click();
15-
await page.waitForTimeout(10);
15+
await page.waitForTimeout(60);
1616

1717
expect(await page.$('[data-testid="item-0"]')).toBe(null);
1818
expect(await page.$('[data-testid="item-1"]')).toBe(null);
1919
expect(await page.$('[data-testid="other-item"]')).toBe(null);
2020

2121
await page.getByRole("button", { name: "switch" }).click();
22-
await page.waitForTimeout(10);
22+
await page.waitForTimeout(60);
2323

2424
expect(!!(await page.$('[data-testid="item-0-span"]'))).toBe(true);
2525
expect(!!(await page.$('[data-testid="item-1-span"]'))).toBe(true);
@@ -30,13 +30,13 @@ test("bug: x-fill in x-if", async ({ page }) => {
3030
test("x-if in x-fill", async ({ page }) => {
3131
await page.goto("http://localhost:3398/test/cases/230816/if-in-fill.html");
3232

33-
await page.waitForTimeout(10);
33+
await page.waitForTimeout(60);
3434

3535
expect((await page.$$("d-item")).length).toBe(4);
3636
expect((await page.$$("a[olink]")).length).toBe(3);
3737

3838
await page.getByRole("button", { name: "Add Item" }).click();
39-
await page.waitForTimeout(10);
39+
await page.waitForTimeout(60);
4040

4141
expect((await page.$$("d-item")).length).toBe(5);
4242
expect((await page.$$("a[olink]")).length).toBe(4);
@@ -45,23 +45,23 @@ test("x-if in x-fill", async ({ page }) => {
4545
test("x-if in x-if", async ({ page }) => {
4646
await page.goto("http://localhost:3398/test/cases/230816/if-in-if.html");
4747

48-
await page.waitForTimeout(10);
48+
await page.waitForTimeout(60);
4949

5050
expect((await page.getByTestId("target").textContent()).trim()).toBe(
5151
"length not ok - 1"
5252
);
5353

5454
await page.getByTestId("additem").click();
5555

56-
await page.waitForTimeout(10);
56+
await page.waitForTimeout(60);
5757

5858
expect((await page.getByTestId("target").textContent()).trim()).toBe(
5959
"length ok - 2"
6060
);
6161

6262
await page.getByTestId("additem").click();
6363

64-
await page.waitForTimeout(10);
64+
await page.waitForTimeout(60);
6565

6666
expect((await page.getByTestId("target").textContent()).trim()).toBe(
6767
"length ok - 3"

test/cases/230904/replace-temp.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@ import { test, expect } from "@playwright/test";
33
test("test replace temp", async ({ page }) => {
44
await page.goto("http://localhost:3398/test/cases/230904/fill-option.html");
55

6-
await page.waitForTimeout(10);
6+
await page.waitForTimeout(60);
77

88
await expect(await page.$$eval("option", (nodes) => nodes.length)).toBe(4);
99
await expect(await page.$eval("#comp-val", (node) => node.textContent)).toBe(
1010
"t-cn"
1111
);
1212

1313
await page.getByRole("combobox").selectOption("cn");
14-
await page.waitForTimeout(10);
14+
await page.waitForTimeout(60);
1515

1616
await expect(await page.$eval("#comp-val", (node) => node.textContent)).toBe(
1717
"cn"
1818
);
1919

2020
await page.getByRole("combobox").selectOption("a");
21-
await page.waitForTimeout(10);
21+
await page.waitForTimeout(60);
2222
await expect(await page.$eval("#comp-val", (node) => node.textContent)).toBe(
2323
"a"
2424
);
2525
await expect(await page.$$eval("option", (nodes) => nodes.length)).toBe(3);
2626

2727

2828
await page.getByRole("combobox").selectOption("t-cn");
29-
await page.waitForTimeout(10);
29+
await page.waitForTimeout(60);
3030

3131
await expect(await page.$eval("#comp-val", (node) => node.textContent)).toBe(
3232
"t-cn"

test/cases/230928/230928.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { test, expect } from "@playwright/test";
33
test("fill string item", async ({ page }) => {
44
await page.goto("http://localhost:3398/test/cases/230928/fill-link.html");
55

6-
await page.waitForTimeout(10);
6+
await page.waitForTimeout(60);
77

88
expect(await page.$eval("li", (node) => node.textContent)).toBe(
99
"en/index.html"

test/cases/code/code.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { test, expect } from "@playwright/test";
33
test("normal recovery", async ({ page }) => {
44
await page.goto("http://localhost:3398/test/cases/code/demo.html");
55

6-
await page.waitForTimeout(10);
6+
await page.waitForTimeout(60);
77

88
expect(await page.$eval("code", (node) => node.textContent.trim())).toBe(
99
`<div class:code="asdasd">{{count}}</div>`

test/cases/fill-index/fill-index.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ test("fill index", async ({ page }) => {
55
"http://localhost:3398/test/cases/fill-index/fill-index.html"
66
);
77

8-
await page.waitForTimeout(10);
8+
await page.waitForTimeout(60);
99

1010
const { _preview: arrData1 } = await page.waitForFunction(async () => {
1111
return $("temp-demo")

test/cases/memory-recovery/recovery.spec.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ test("normal recovery", async ({ page }) => {
88
);
99

1010
await page.getByRole("button", { name: "refresh length" }).click();
11-
await page.waitForTimeout(10);
11+
await page.waitForTimeout(60);
1212
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("3");
1313

1414
await page.getByRole("button", { name: "remove demo" }).click();
1515
await page.getByRole("button", { name: "refresh length" }).click();
16-
await page.waitForTimeout(10);
16+
await page.waitForTimeout(60);
1717
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("2");
1818

1919
await page.getByRole("button", { name: "remove demo" }).click();
2020
await page.getByRole("button", { name: "remove demo" }).click();
2121
await page.getByRole("button", { name: "refresh length" }).click();
22-
await page.waitForTimeout(10);
22+
await page.waitForTimeout(60);
2323
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("0");
2424
});
2525

@@ -28,28 +28,28 @@ test("transmit data recovery", async ({ page }) => {
2828
"http://localhost:3398/test/cases/memory-recovery/demo2.html"
2929
);
3030

31-
await page.waitForTimeout(10);
31+
await page.waitForTimeout(60);
3232
const { _preview: beforeSize } = await page.waitForFunction(async () => {
3333
return outerData.sub.owner.size;
3434
});
3535
expect(beforeSize).toBe("4");
3636

3737
await page.getByRole("button", { name: "refresh length" }).click();
38-
await page.waitForTimeout(10);
38+
await page.waitForTimeout(60);
3939
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("6");
4040

4141
await page.getByRole("button", { name: "remove demo" }).click();
4242
await page.getByRole("button", { name: "refresh length" }).click();
43-
await page.waitForTimeout(10);
43+
await page.waitForTimeout(60);
4444
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("4");
4545

4646
await page.getByRole("button", { name: "remove demo" }).click();
4747
await page.getByRole("button", { name: "remove demo" }).click();
4848
await page.getByRole("button", { name: "refresh length" }).click();
49-
await page.waitForTimeout(10);
49+
await page.waitForTimeout(60);
5050
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("0");
5151

52-
await page.waitForTimeout(10);
52+
await page.waitForTimeout(60);
5353
const { _preview: afterSize } = await page.waitForFunction(async () => {
5454
return outerData.sub.owner.size;
5555
});
@@ -61,7 +61,7 @@ test("fill data recovery", async ({ page }) => {
6161
"http://localhost:3398/test/cases/memory-recovery/demo3.html"
6262
);
6363

64-
await page.waitForTimeout(10);
64+
await page.waitForTimeout(60);
6565

6666
const { _preview: beforeSize } = await page.waitForFunction(async () => {
6767
return outerData.arr.owner.size;
@@ -70,7 +70,7 @@ test("fill data recovery", async ({ page }) => {
7070
expect(beforeSize).toBe("2");
7171

7272
await page.getByRole("button", { name: "remove demo" }).click();
73-
await page.waitForTimeout(10);
73+
await page.waitForTimeout(60);
7474

7575
const { _preview: afterSize } = await page.waitForFunction(async () => {
7676
return outerData.arr.owner.size;
@@ -84,7 +84,7 @@ test("condition data recovery", async ({ page }) => {
8484
"http://localhost:3398/test/cases/memory-recovery/demo4.html"
8585
);
8686

87-
await page.waitForTimeout(10);
87+
await page.waitForTimeout(60);
8888

8989
const { _preview: beforeSize } = await page.waitForFunction(async () => {
9090
return outerData.owner.size;
@@ -95,7 +95,7 @@ test("condition data recovery", async ({ page }) => {
9595
await page.getByRole("button", { name: "add count" }).click();
9696
await page.getByRole("button", { name: "add count" }).click();
9797
await page.getByRole("button", { name: "add count" }).click();
98-
await page.waitForTimeout(10);
98+
await page.waitForTimeout(60);
9999

100100
await page.getByRole("button", { name: "remove demo" }).click();
101101

@@ -110,23 +110,23 @@ test("component data owner size", async ({ page }) => {
110110
"http://localhost:3398/test/cases/memory-recovery/demo5.html"
111111
);
112112

113-
await page.waitForTimeout(10);
113+
await page.waitForTimeout(60);
114114

115115
await page.getByRole("button", { name: "refresh owner size" }).click();
116116
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("10");
117117
await page.getByRole("button", { name: "refresh arr owner size" }).click();
118118
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("4,4,4");
119119

120120
await page.getByRole("button", { name: "add count" }).click();
121-
await page.waitForTimeout(10);
121+
await page.waitForTimeout(60);
122122

123123
await page.getByRole("button", { name: "refresh owner size" }).click();
124124
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("10");
125125
await page.getByRole("button", { name: "refresh arr owner size" }).click();
126126
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("4,4,4");
127127

128128
await page.getByRole("button", { name: "add count" }).click();
129-
await page.waitForTimeout(10);
129+
await page.waitForTimeout(60);
130130

131131
await page.getByRole("button", { name: "refresh owner size" }).click();
132132
expect(await page.$eval("#logger", (node) => node.textContent)).toBe("1");

test/cases/style-data/style-data.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const getData = async ({ page }) => {
1515
test("style data", async ({ page }) => {
1616
await page.goto("http://localhost:3398/test/cases/style-data/demo.html");
1717

18-
await page.waitForTimeout(10); // 增加等待时间以确保 DOM 更新
18+
await page.waitForTimeout(60); // 增加等待时间以确保 DOM 更新
1919

2020
const data1 = await getData({ page });
2121

@@ -25,15 +25,15 @@ test("style data", async ({ page }) => {
2525

2626
await page.getByRole("button", { name: "weight:600" }).click();
2727

28-
await page.waitForTimeout(10);
28+
await page.waitForTimeout(60);
2929

3030
const data2 = await getData({ page });
3131
expect(data2.weight).toBe("400"); // default is 400
3232
expect(data2.size).toBe("20px");
3333

3434
await page.getByRole("button", { name: "weight:850" }).click();
3535

36-
await page.waitForTimeout(10);
36+
await page.waitForTimeout(60);
3737

3838
const data3 = await getData({ page });
3939
expect(data3.weight).toBe("850");

test/cases/sync-uppercase/sync.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ test("sync uppercase", async ({ page }) => {
1212

1313
await page.getByRole("button", { name: "AddCount" }).click();
1414

15-
await page.waitForTimeout(10);
15+
await page.waitForTimeout(60);
1616

1717
await expect((await page.getByTestId("t1").textContent()).trim()).toBe(
1818
"t-one: 1"
@@ -23,7 +23,7 @@ test("sync uppercase", async ({ page }) => {
2323

2424
await page.getByTestId("t2").click();
2525

26-
await page.waitForTimeout(10);
26+
await page.waitForTimeout(60);
2727

2828
await expect((await page.getByTestId("t1").textContent()).trim()).toBe(
2929
"t-one: 2"

test/form-test.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ test("get formData", async ({ page }) => {
4949
test("set formData", async ({ page }) => {
5050
await page.goto("http://localhost:3398/test/statics/form-test.html");
5151

52-
await page.waitForTimeout(10);
52+
await page.waitForTimeout(60);
5353

5454
await page.waitForFunction(async () => {
5555
return Object.assign(data, {
@@ -62,7 +62,7 @@ test("set formData", async ({ page }) => {
6262
});
6363
});
6464

65-
await page.waitForTimeout(10);
65+
await page.waitForTimeout(60);
6666

6767
await expect(
6868
await page.$eval('[data-testid="input1"]', (node) => node.value)

0 commit comments

Comments
 (0)