import { describe, it, expect } from '@jest/globals' import { chromium } from "playwright"; describe("mes登录", function () { it('login', async function () { const browser = await chromium.launch({ // headless: false }); const context = await browser.newContext(); // Open new page const page = await context.newPage(); // Go to http://sc.ihome6.cf/ await page.goto('http://sc.ihome6.cf/'); // Click [placeholder="账号"] await page.click('[placeholder="账号"]'); // Fill [placeholder="账号"] await page.fill('[placeholder="账号"]', 'dj'); // Press Tab await page.press('[placeholder="账号"]', 'Tab'); // Fill [placeholder="密码"] await page.fill('[placeholder="密码"]', '123456'); // Click button:has-text("登录") await page.click('button:has-text("登录")'); await page.waitForTimeout(1000) let path = await page.evaluateHandle(()=>window.location.hash.substr(1)) expect(await path.jsonValue()).toEqual('/dashboard') // --------------------- await context.close(); await browser.close(); }) })