const { processAndRecognizeCaptcha } = require('../../utils/helper'); class H5LoginPage { constructor(page) { this.page = page; this.$account = this.page.getByPlaceholder('此处请输入手机号'); this.$GraphCode = this.page.getByRole('textbox', { name: '请输入图形验证码' }); this.$SmsCode = this.page.getByRole('textbox', { name: '验证码', exact: true }); this.$loginBtn = this.page.locator('uni-button').filter({ hasText: /^登录$/ }); } sendSmsCode = async (account) => { const imagePath = '.images/captcha.png'; const outputImagePath = '.images/output-captcha.png'; await this.$account.fill(account); const $graph = this.page.getByRole('img', { name: '图形验证码' }); await $graph.waitFor(); await $graph.screenshot({ path: imagePath }); return await processAndRecognizeCaptcha(imagePath, outputImagePath); }; } module.exports = { H5LoginPage };