Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-138701: CAAS tests on page load #367

Merged
merged 13 commits into from
Jun 12, 2024
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
16 changes: 16 additions & 0 deletions features/milo/caas.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
FeatureName: 'CAAS Feature',
features: [
{
tcid: '0',
name: '@Card Collection',
path: '/drafts/nala/features/caas/caascollection',
data: {
cardsPerPage: 4,
caasTitle: 'Consonant Card Collection Title',
paginator: '1 - 4 of 8 results',
},
tags: '@caas @smoke @regression @milo',
},
],
};
10 changes: 10 additions & 0 deletions selectors/milo/caas.feature.page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default class Caas {
constructor(page) {
this.page = page;

// caas locators
this.caasCards = this.page.locator('.consonant-Card');
this.caasTitle = this.page.locator('.consonant-FiltersInfo-title');
this.caasPaginator = this.page.locator('.consonant-Pagination-summary');
}
}
43 changes: 43 additions & 0 deletions tests/milo/caas.feature.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { expect, test } from '@playwright/test';
import { features } from '../../features/milo/caas.spec.js';
import Caas from '../../selectors/milo/caas.feature.page.js';

let caas;
let consoleErrors = [];

test.describe('Milo CAAS Feature test suite', () => {
test.beforeEach(async ({ page }) => {
caas = new Caas(page);

page.on('console', (exception) => {
if (exception.type() === 'error') {
consoleErrors.push(exception.text());
}
});
});

test.afterEach(async () => {
consoleErrors = [];
});

// Test 0 : Card Collection
test(`${features[0].name},${features[0].tags}`, async ({ page, baseURL }) => {
console.info(`[Test Page]: ${baseURL}${features[0].path}`);
const { data } = features[0];

await test.step('step-1: Go to CAAS collection test page', async () => {
await page.goto(`${baseURL}${features[0].path}`);
await page.waitForLoadState('domcontentloaded');
await expect(page).toHaveURL(`${baseURL}${features[0].path}`);
});

await test.step('step-2: Verify CAAS collection content/specs', async () => {
// verify number of cards in the collection
await expect(await caas.caasCards).toHaveCount(data.cardsPerPage);

// verify caas title and paginator
await expect(await caas.caasTitle).toContainText(data.caasTitle);
await expect(await caas.caasPaginator).toContainText(data.paginator);
});
});
});
Loading