test(e2e): 🧪 Update marketplace frontend test page objects for E2E tests
This commit is contained in:
parent
9e36812527
commit
e088acffec
15 changed files with 41 additions and 30 deletions
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue