Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pages/MarketplacePage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { expect, Locator, Page } from '@playwright/test';

export class MarketplacePage {
readonly page: Page;
readonly mainContent: Locator;

constructor(page: Page) {
this.page = page;
this.mainContent = page.locator('main, [role="main"], body').first();
}

async goto(): Promise<void> {
await this.page.goto('/sell/list', {
waitUntil: 'domcontentloaded',
});
}

async expectPageLoaded(): Promise<void> {
await expect(this.page).toHaveURL(/\/(sell\/list|marketplace)(\?|\/|$)/);
await expect(this.page).toHaveTitle(/Discogs|Shop|Marketplace/i);
await expect(this.mainContent).toBeVisible();
}

async expectMarketplaceContentVisible(): Promise<void> {
await expect(this.mainContent).toContainText(
/marketplace|shop|for sale|vinyl|records|cds/i,
{ timeout: 10000 }
);
}

async expectNoApplicationError(): Promise<void> {
await expect(this.mainContent).not.toContainText(
/server error|something went wrong|application error|internal error|404/i
);
}
}
18 changes: 18 additions & 0 deletions tests/marketplace/marketplace.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test } from '@playwright/test';
import { MarketplacePage } from '../../pages/MarketplacePage';

test.describe('Discogs marketplace', () => {
test('@smoke @marketplace marketplace browse page loads', async ({ page }) => {
const marketplacePage = new MarketplacePage(page);

await test.step('Navigate to Discogs marketplace browse page', async () => {
await marketplacePage.goto();
});

await test.step('Validate marketplace page loads successfully', async () => {
await marketplacePage.expectPageLoaded();
await marketplacePage.expectMarketplaceContentVisible();
await marketplacePage.expectNoApplicationError();
});
});
});
Loading