21 lines
		
	
	
		
			906 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			906 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| const { test: setup, expect } = require('@playwright/test');
 | |
| const path = require('path');
 | |
| const zhbAuthFile = path.join(process.cwd(), '.auth', 'zhb.json');
 | |
| 
 | |
| setup('zhb总部管理员登录', async ({ page, baseURL }) => {
 | |
|   const account = process.env.ZHB_ACCOUNT;
 | |
|   const password = process.env.ZHB_PASSWORD;
 | |
| 
 | |
|   await page.goto(baseURL);
 | |
|   await page.getByText('账号登录').click();
 | |
|   await page.getByPlaceholder('用户名').fill(account);
 | |
|   await page.getByPlaceholder('密码', { exact: true }).fill(password);
 | |
|   await page.getByText('登录', { exact: true }).click();
 | |
|   await expect(page.getByText('演示一店')).toBeVisible();
 | |
|   await expect(page.getByText('演示二店')).toBeVisible();
 | |
| 
 | |
|   await page.getByText('演示一店').click();
 | |
|   await expect(page.locator('#tab_main li').filter({ hasText: '营业' })).toBeVisible();
 | |
|   await page.context().storageState({ path: zhbAuthFile });
 | |
| });
 |