feat(admin): 添加用户管理相关文件
添加用户管理视图、API和状态管理文件
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import { Page, Locator } from '@playwright/test';
|
||||
|
||||
export class SearchPage {
|
||||
readonly page: Page;
|
||||
readonly searchInput: Locator;
|
||||
readonly searchButton: Locator;
|
||||
readonly searchResults: Locator;
|
||||
readonly searchHistory: Locator;
|
||||
readonly navigationBar: Locator;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
this.searchInput = page.locator('[data-testid="search-input"], .search-input, input[type="search"]');
|
||||
this.searchButton = page.locator('[data-testid="search-button"], .search-button, button[type="submit"]');
|
||||
this.searchResults = page.locator('[data-testid="search-results"], .search-results');
|
||||
this.searchHistory = page.locator('[data-testid="search-history"], .search-history');
|
||||
this.navigationBar = page.locator('.uni-tabbar, [class*="tabbar"]');
|
||||
}
|
||||
|
||||
async goto() {
|
||||
await this.page.goto('/#/pages/almanac-search/index');
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async isSearchInputVisible(): Promise<boolean> {
|
||||
return await this.searchInput.isVisible().catch(() => false);
|
||||
}
|
||||
|
||||
async fillSearchInput(text: string) {
|
||||
await this.searchInput.fill(text);
|
||||
}
|
||||
|
||||
async clickSearchButton() {
|
||||
await this.searchButton.click();
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async getSearchResultsCount(): Promise<number> {
|
||||
return await this.searchResults.locator('[data-testid="search-result-card"], .search-result-card').count();
|
||||
}
|
||||
|
||||
async isSearchResultsVisible(): Promise<boolean> {
|
||||
return await this.searchResults.isVisible().catch(() => false);
|
||||
}
|
||||
|
||||
async isSearchHistoryVisible(): Promise<boolean> {
|
||||
return await this.searchHistory.isVisible().catch(() => false);
|
||||
}
|
||||
|
||||
async navigateToTab(tabName: string) {
|
||||
await this.navigationBar.locator(`text=${tabName}`).click();
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async takeScreenshot(path: string) {
|
||||
await this.page.screenshot({ path, fullPage: true });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user