剧作家打字稿中的页面对象模型出现解析错误的 Linting 错误:意外的标记

问题描述 投票:0回答:0

我是剧作家的新手,我正在使用打字稿做页面对象模型。除非运行检查 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

javascript typescript automation playwright
© www.soinside.com 2019 - 2024. All rights reserved.