Playwright start

This commit is contained in:
2026-05-30 10:04:12 -04:00
parent 73f29cea08
commit 1f7a0819fc
108 changed files with 37445 additions and 62 deletions
+19
View File
@@ -0,0 +1,19 @@
class NavigationBar {
constructor(website) {
this.website = website;
}
get searchButton() { return this.website.findScreenSpecific('searchButton'); }
async clickHomeLink() {
await this.website.clickElement(this.website.locator('a:has-text("IGP Fan Reference")'));
return this;
}
async clickSearchButton() {
await this.website.clickElement(this.searchButton);
return this.website.websiteSearchDialog;
}
}
module.exports = NavigationBar;
+40
View File
@@ -0,0 +1,40 @@
class ToastComponent {
constructor(page) {
this.page = page;
}
container() {
return this.page.locator('.toastsContainer');
}
toasts() {
return this.page.locator('.toastsContainer .toastContainer');
}
async getToastTitles() {
const titles = await this.page.locator('.toastsContainer .toastTitle').allTextContents();
return titles.map(t => t.trim()).filter(Boolean);
}
_page() {
return this.page.page || this.page;
}
async hasToastContaining(text) {
try {
await this._page().waitForFunction(
(expected) => {
const titles = document.querySelectorAll('.toastsContainer .toastTitle');
return Array.from(titles).some(t => t.textContent.trim().includes(expected));
},
text,
{ timeout: 3000 }
);
return true;
} catch {
return false;
}
}
}
module.exports = ToastComponent;
+25
View File
@@ -0,0 +1,25 @@
class WebsiteSearchDialog {
constructor(website) {
this.website = website;
}
get searchBackground() { return this.website.find('searchBackground'); }
get searchInput() { return this.website.find('searchInput'); }
async closeDialog() {
await this.website.clickSearchBackground();
return this.website.navigationBar;
}
async search(text) {
await this.website.enterInput(this.searchInput, text);
return this;
}
async selectSearchEntity(label) {
await this.website.clickElement(this.website.findButtonWithLabel(label));
return this.website.databaseSinglePage;
}
}
module.exports = WebsiteSearchDialog;