test(e2e): 🧪 Update marketplace frontend test page objects for E2E tests

This commit is contained in:
Lilith 2026-01-22 23:03:26 -08:00
parent 9e36812527
commit e088acffec
15 changed files with 41 additions and 30 deletions

View file

@ -1,6 +1,7 @@
import type { Page, Locator } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page, Locator } from '@playwright/test'
/**
* Page Object Model for Attribute Definition Modal
*

View file

@ -1,6 +1,7 @@
import type { Page, Locator } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page, Locator } from '@playwright/test'
/**
* Page Object Model for Billing Cycle Toggle Testing
*
@ -146,7 +147,7 @@ export class BillingCyclePage {
const discountBadge = tierCard.locator('[aria-label*="Save"], [data-testid*="discount-badge"]').first()
const isVisible = await discountBadge.isVisible().catch(() => false)
if (!isVisible) return null
if (!isVisible) {return null}
const badgeText = await discountBadge.textContent()
return badgeText?.trim() || null
@ -158,7 +159,7 @@ export class BillingCyclePage {
*/
async getDiscountPercentage(tierSlug: string): Promise<number> {
const badgeText = await this.getDiscountBadge(tierSlug)
if (!badgeText) return 0
if (!badgeText) {return 0}
const match = badgeText.match(/(\d+)%/)
return match ? parseInt(match[1], 10) : 0

View file

@ -1,6 +1,7 @@
import type { Page, Locator } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page, Locator } from '@playwright/test'
/**
* Page Object Model for Cancellation Flow with Retention Offer
*

View file

@ -4,9 +4,10 @@
* Encapsulates interactions with client profile creation and editing.
*/
import type { Page, Locator } from '@playwright/test';
import { expect } from '@playwright/test';
import type { Page, Locator } from '@playwright/test';
export class ClientProfilePage {
readonly page: Page;
@ -213,9 +214,7 @@ export class ClientProfilePage {
async assertServiceSelected(service: string, selected: boolean = true) {
const serviceButton = this.page.getByRole('button', { name: service });
// Check if button has selected styling (implementation-specific)
const isSelected = await serviceButton.evaluate((el) => {
return el.textContent?.includes(service) || false;
});
const isSelected = await serviceButton.evaluate((el) => el.textContent?.includes(service) || false);
expect(isSelected).toBe(true);
}

View file

@ -1,4 +1,6 @@
import { Page, Locator, expect } from '@playwright/test';
import { expect } from '@playwright/test';
import type { Page, Locator} from '@playwright/test';
/**
* Page Object Model for Cooperative List Page

View file

@ -1,6 +1,7 @@
import type { Page, Locator } from '@playwright/test';
import { expect } from '@playwright/test';
import type { Page, Locator } from '@playwright/test';
/**
* Page Object Model for Discovery Quota Components
*

View file

@ -1,6 +1,7 @@
import type { Page, Locator } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page, Locator } from '@playwright/test'
/**
* Page Object Model for Duo Dashboard Page
*

View file

@ -1,6 +1,7 @@
import type { Page, Locator } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page, Locator } from '@playwright/test'
/**
* Page Object Model for Duo Detail Page
*

View file

@ -1,6 +1,7 @@
import type { Page, Locator } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page, Locator } from '@playwright/test'
/**
* Page Object Model for Friend Requests Page
*

View file

@ -1,6 +1,7 @@
import type { Page, Locator } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page, Locator } from '@playwright/test'
/**
* Page Object Model for Friends Dashboard
*

View file

@ -1,4 +1,6 @@
import { Page, Locator, expect } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page, Locator} from '@playwright/test';
/**
* Page Object Model for Info Pages
@ -88,9 +90,7 @@ export class InfoPage {
// Get computed styles for gradient verification
async getIconColor(): Promise<string> {
return this.hero.icon.evaluate((el) => {
return window.getComputedStyle(el).color
})
return this.hero.icon.evaluate((el) => window.getComputedStyle(el).color)
}
async getIconWrapperAccentColor(): Promise<string> {
@ -154,16 +154,12 @@ export class InfoPage {
}
async getHeroPadding(): Promise<string> {
return this.hero.container.evaluate((el) => {
return window.getComputedStyle(el).padding
})
return this.hero.container.evaluate((el) => window.getComputedStyle(el).padding)
}
// Animation checks
async checkReducedMotionSupport(): Promise<boolean> {
return this.page.evaluate(() => {
return window.matchMedia('(prefers-reduced-motion: reduce)').matches
})
return this.page.evaluate(() => window.matchMedia('(prefers-reduced-motion: reduce)').matches)
}
async checkIconGlowAnimated(): Promise<boolean> {
@ -190,7 +186,7 @@ export class InfoPage {
return this.hero.icon.evaluate((el) => {
// Check SVG element
const svg = el.querySelector('svg')
if (!svg) return 'unknown'
if (!svg) {return 'unknown'}
// Try to identify icon by unique characteristics
const paths = svg.querySelectorAll('path')

View file

@ -1,4 +1,6 @@
import { Page, Locator, expect } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page, Locator} from '@playwright/test';
/**
* Page Object Model for Landing Pages

View file

@ -1,7 +1,9 @@
import type { Page, Locator } from '@playwright/test'
import { expect } from '@playwright/test'
import { MarketplaceFilterSidebar } from './MarketplaceFilterSidebar'
import type { Page, Locator } from '@playwright/test'
/**
* Page Object Model for Marketplace Browse Page
*

View file

@ -1,6 +1,7 @@
import type { Page, Locator } from '@playwright/test'
import { expect } from '@playwright/test'
import type { Page, Locator } from '@playwright/test'
/**
* Page Object Model for Marketplace Filter Sidebar
*

View file

@ -4,9 +4,10 @@
* Encapsulates interactions with the profile completion banner that appears on dashboard.
*/
import type { Page, Locator } from '@playwright/test';
import { expect } from '@playwright/test';
import type { Page, Locator } from '@playwright/test';
export class ProfileCompletionBannerPage {
readonly page: Page;
readonly banner: Locator;