0

我需要一些关于剧作家和黄瓜的帮助

我设置了一个小黄瓜并对其进行了一些测试,但是我在使用 expect 命令时遇到了问题。

这是我的进口:

import { ICustomWorld } from "../support/custom-world";
import { Given, When, Then } from "@cucumber/cucumber";
import { expect } from "@playwright/test";

这是问题的一个示例:

Then(
  "The Menu Niederlassungsdaten is default",
  async function (this: ICustomWorld) {
    const { page } = this;
    const TitleLabel = await page?.locator('#app > div.container-fluid > div.row.content.justify-content-center > div > div > div > div.col-12.col-md-3.col-lg-2.tabs > div > a.list-group-item.text-center.router-link-exact-active.active');
    await expect(TitleLabel).toHaveAttribute("aria-current","page");
  }
);

这个 expect.toHaveAttribute 在没有黄瓜的情况下工作得很好。但是在给定的时间里,黄瓜是行不通的。错误是:

Error: toHaveAttribute must be called during the test

因此,expect 命令似乎缺少这个 playwright 测试命令。我该怎么做才能让这个在黄瓜中起作用?

4

0 回答 0