get-element-by-id.test.js 681 字节
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3 4 5
const PAGE_PATH = "/pages/API/get-element-by-id/get-element-by-id";
let page;

describe("getElementById", () => {
  beforeAll(async () => {
6
    page = await program.reLaunch(PAGE_PATH);
7
    await page.waitFor('view');
DCloud-WZF's avatar
DCloud-WZF 已提交
8 9 10
  });
  it("getElementByNotExistId", async () => {
    const res = await page.callMethod("getElementByNotExistId");
11
    expect(res).toBe(null);
DCloud-WZF's avatar
DCloud-WZF 已提交
12 13 14 15 16
  });
  it("changeStyle", async () => {
    await page.callMethod("changePageHeadBackgroundColor");
    await page.callMethod("changeTextColor");
    await page.callMethod("changeViewStyle");
17
    await page.waitFor(500);
DCloud-WZF's avatar
DCloud-WZF 已提交
18 19 20 21
    const image = await program.screenshot();
    expect(image).toMatchImageSnapshot();
  });
});