This repository has been archived on 2025-04-22. You can view files and clone it, but cannot push or open issues or pull requests.
playwright-demo/tests/hlk/pom/touchLoginPage.js
rsgltzyd db0603dcfd
Some checks failed
Playwright Tests / test (push) Has been cancelled
init
2024-11-07 22:00:35 +08:00

23 lines
799 B
JavaScript

const { expect } = require('@playwright/test');
class TouchLoginPage {
constructor(page) {
this.page = page;
this.$account = this.page.getByRole('textbox', { name: '请输入您的手机号码' });
this.$password = this.page.getByRole('textbox', { name: '请输入登录密码' });
this.$loginBtn = this.page.getByRole('button', { name: /登\s录/ });
}
login = async (account, password) => {
await this.$account.fill(account);
const phoneStatsIcon = this.page
.locator('.ant-row', { has: this.$account })
.locator('.pass_svg');
await this.$password.fill(password);
await this.page.getByLabel('请同意慧来客隐私政策和用户协议').check();
await expect(phoneStatsIcon).toBeVisible();
await this.$loginBtn.click();
};
}
module.exports = { TouchLoginPage };