Licence
Apache-2.0
Version
5.0.2
Deps
0
Size
17.3 MB
Vulns
0
Weekly
0
playwright-brightspot
Library to support Brightspot Playwright tests. Sister package to @cypress-brightspot/cypress-brightspot.
Status
Scaffold (v0.0.1). Public API surface is defined in src/index.js. Page objects and helpers currently re-export from the consumer repo's e2e-playwright/ tree; they will be migrated into src/pages/ and src/helpers/ as the package matures.
Install
npm install @playwright-brightspot/playwright-brightspot
Peer deps: @playwright/test >= 1.40, playwright >= 1.40.
Usage
const { loginPage, sitesPage, articleEditPage } = require('@playwright-brightspot/playwright-brightspot');
test('login and open sites', async ({ page }) => {
await page.goto('/cms');
await loginPage.login(page, username, password);
await sitesPage.openSiteSettings(page);
});
Override / extend
Override a fixture
Place a JSON file at <repo>/fixtures/overrides/<fileName>.json (or set PWB_OVERRIDES_DIR). The override-aware loaders pick it up automatically:
const { getCMSTestData } = require('@playwright-brightspot/playwright-brightspot');
const theme = getCMSTestData('themeData.json'); // override if present, else bundled default
Extend a page object
const { BaseContentTypePage } = require('@playwright-brightspot/playwright-brightspot');
class ArticleEditPage50 extends BaseContentTypePage {
getContentTypeLabel(page) {
// Override the 5.0-specific selector that would otherwise pick up
// the "Saved..." toast.
return page.locator('.ContentEdit-status--v5, .ContentEdit-revisionLabel').first();
}
}
module.exports = new ArticleEditPage50();
Roadmap
- Migrate page objects from
../../e2e-playwright/page-objects/intosrc/pages/ - Migrate helpers (excluding
global-setup,global-teardown,testDataFactory— those stay in consumer) - Bundle generic CMS fixtures under
src/shared-tests/fixtures/entities/{cms,contentTypes}/ - Ship a starter pack of
shared-tests/e2e/*.spec.jsconsumers can run via--config - Provide
examples/playwright.config.jstemplate +install.sh - Expose page-object classes (not just singletons) for
extends-based overrides - Decouple
playwright.configreads inSitesAndSettingsPage.jsandBaseFEPage.jsbehind aconfigure({ baseUrl, env })factory - Fixture override directory configurable via
PWB_OVERRIDES_DIRenv var (already supported in the helper)
License
Apache 2.0