优化
This commit is contained in:
26
client/web/e2e/playwright/tests/utils/user.ts
Normal file
26
client/web/e2e/playwright/tests/utils/user.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { BrowserContext, expect, Page } from '@playwright/test';
|
||||
|
||||
const storagePath = './auth.json';
|
||||
|
||||
/**
|
||||
* 登录到测试账号
|
||||
*
|
||||
* 需要提前注册
|
||||
*/
|
||||
export async function loginToDemoUser(page: Page, context: BrowserContext) {
|
||||
await page.goto('/entry/login');
|
||||
await page
|
||||
.locator('input[name="login-email"]')
|
||||
.fill('tailchat-demo@msgbyte.com');
|
||||
await page.locator('input[name="login-password"]').fill('tailchat-demo');
|
||||
await page.locator('button:has-text("登录")').click();
|
||||
|
||||
await expect(page).toHaveURL('/main/personal/friends'); // should with redirect
|
||||
|
||||
await context.storageState({
|
||||
path: storagePath,
|
||||
});
|
||||
|
||||
// Click text=跳过引导
|
||||
await page.locator('text=跳过引导').click();
|
||||
}
|
||||
Reference in New Issue
Block a user