init
This commit is contained in:
44
tests/mes/login.test.ts
Normal file
44
tests/mes/login.test.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
import { assert } from "chai";
|
||||
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))
|
||||
assert.equal('/dashboard',await path.jsonValue());
|
||||
|
||||
after(async function(){
|
||||
await context.close();
|
||||
await browser.close();
|
||||
})
|
||||
// ---------------------
|
||||
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user