feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { Page } from '@playwright/test';
|
||||
|
||||
export class BottomNavigation {
|
||||
private readonly selectors = {
|
||||
bottomNavigation: '.bottom-navigation',
|
||||
tabButton: '.tab-button',
|
||||
tabText: '.tab-text',
|
||||
activeTab: '.tab-button.active',
|
||||
};
|
||||
|
||||
constructor(private page: Page) {
|
||||
}
|
||||
|
||||
async clickTab(tabName: 'calendar' | 'almanac' | 'user') {
|
||||
const tabs = await this.page.$$(this.selectors.tabButton);
|
||||
for (const tab of tabs) {
|
||||
const text = await tab.textContent();
|
||||
if (text?.includes(tabName === 'calendar' ? '万年历' : tabName === 'almanac' ? '黄历' : '我的')) {
|
||||
await tab.click();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async getActiveTab(): Promise<string> {
|
||||
const activeTab = await this.page.$(this.selectors.activeTab);
|
||||
return await activeTab?.textContent() || '';
|
||||
}
|
||||
|
||||
async isTabActive(tabName: 'calendar' | 'almanac' | 'user'): Promise<boolean> {
|
||||
const activeTab = await this.getActiveTab();
|
||||
const expectedText = tabName === 'calendar' ? '万年历' : tabName === 'almanac' ? '黄历' : '我的';
|
||||
return activeTab.includes(expectedText);
|
||||
}
|
||||
|
||||
async getAllTabTexts(): Promise<string[]> {
|
||||
const tabs = await this.page.$$(this.selectors.tabText);
|
||||
const texts: string[] = [];
|
||||
for (const tab of tabs) {
|
||||
texts.push(await tab.textContent() || '');
|
||||
}
|
||||
return texts;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user