| 12345678910111213141516171819202122232425262728293031323334353637 |
- import { test, expect, Page } from '@playwright/test';
- test.describe('人才小程序登录页面验证', () => {
- test('截图并验证登录页面', async ({ page }) => {
- // 使用移动端视口
- await page.setViewportSize({ width: 375, height: 667 });
- console.log('导航到人才小程序登录页面...');
- await page.goto('http://localhost:10087', {
- waitUntil: 'networkidle',
- timeout: 30000
- });
- // 等待页面加载
- await page.waitForTimeout(3000);
- console.log('截取页面截图...');
- await page.screenshot({
- path: '/mnt/code/188-179-template-6/talent-login-screenshot.png',
- fullPage: true
- });
- // 获取页面文本内容
- const bodyText = await page.evaluate(() => document.body.innerText);
- console.log('页面文本内容预览:', bodyText.substring(0, 500));
- // 检查是否有用户协议和隐私政策相关文字
- const hasUserAgreement = bodyText.includes('用户协议');
- const hasPrivacyPolicy = bodyText.includes('隐私政策');
- console.log('包含"用户协议":', hasUserAgreement);
- console.log('包含"隐私政策":', hasPrivacyPolicy);
- // 验证用户协议和隐私政策不应该出现(应该被注释掉了)
- expect(hasUserAgreement).toBe(false);
- expect(hasPrivacyPolicy).toBe(false);
- });
- });
|