set-navigation-bar-title.test.js 1.1 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
const CURRENT_PAGE_PATH =
  "/pages/API/set-navigation-bar-title/set-navigation-bar-title";

describe("setNavigationBarColor", () => {
  let page;
  let originLifeCycleNum;
  beforeAll(async () => {
    page = await program.navigateTo(CURRENT_PAGE_PATH);
    await page.waitFor(1000);
    originLifeCycleNum = await page.callMethod("getLifeCycleNum");
  });

  afterAll(async () => {
    await page.callMethod("setLifeCycleNum", originLifeCycleNum);
    const lifeCycleNum = await page.callMethod("getLifeCycleNum");
    expect(lifeCycleNum).toBe(originLifeCycleNum);
  });

19 20
  it("setNavigationBarNewTitle", async () => {
    await page.callMethod("setNavigationBarNewTitle");
DCloud-WZF's avatar
DCloud-WZF 已提交
21
    const image = await program.screenshot();
22
    expect(image).toSaveImageSnapshot();
DCloud-WZF's avatar
DCloud-WZF 已提交
23 24 25
    const lifeCycleNum = await page.callMethod("getLifeCycleNum");
    expect(lifeCycleNum - originLifeCycleNum).toBe(2);
  });
26 27 28
  it("setNavigationBarLongTitle", async () => {
    await page.callMethod("setNavigationBarLongTitle");
    const image = await program.screenshot();
29
    expect(image).toSaveImageSnapshot();
30
  });
DCloud-WZF's avatar
DCloud-WZF 已提交
31
});