我是剧作家的新手,我正在使用打字稿做页面对象模型。除非运行检查 linting,否则该脚本工作正常。在 github 中,linting 是 Pull Request Check 的一部分,因此它在那里失败。
这是我的登录页面,在 linting 检查中失败
import { Page } from "@playwright/test";
export class LoginPage {
readonly page: Page;
readonly userName: any;
readonly password: any;
readonly loginButton: any;
constructor(page: Page) {
this.page = page;
this.userName = this.page.locator('[data-qa="login-input-email"]');
this.password = this.page.locator('[data-qa="login-input-password"]');
this.loginButton = this.page.locator('[data-qa="login-button"]');
}
/**
* @param {string} text
*/
async enterUsername(text) {
await this.userName.fill(text);
}
/**
* @param {string} text
*/
async enterPassword(text) {
await this.password.fill(text);
}
async clickLoginBtn() {
await this.loginButton.click();
}
}
在终端中运行下面的 lint 命令时
npx eslint“./src/**”--cache
这是出现的错误
C:\Users\path\Desktop\path\Workspace\path\path\src\portal\locator