A Playwright library for Salesforce Omnistudio automation.
To install the library, run:
npm install omniplay
The omnistudioHelpers.ts
module provides helper functions for OmniStudio interactions.
import { Page } from '@playwright/test';
import { OmniStudioHelpers } from './omnistudioHelpers';
// Select from typeahead
await OmniStudioHelpers.selectFromTypeahead('typeahead-name', 'value', page, true);
The salesforceHelpers.ts
module provides helper functions for Salesforce interactions.
import { Page } from '@playwright/test';
import { SalesforceHelpers } from './salesforceHelpers';
// Navigate to a tab
await SalesforceHelpers.navigateToTab('tab-name', page);
// Click a button
await SalesforceHelpers.clickButton('button-name', page);
// Open an application
await SalesforceHelpers.openApplication('app-name', page, true);
The securityHelpers.ts
module provides helper functions for login operations.
import { Page } from '@playwright/test';
import { SecurityHelpers } from './securityHelpers';
// Perform login
await SecurityHelpers.login(page, 'https://login.salesforce.com', 'username', 'password');
The clickHelpers.ts
module includes functions to safely click on elements with retries and capture snapshots on failure.
import { Page, Locator } from '@playwright/test';
import { safeClick, safeClickTypeahead, safeClickTypeaheadValue, safeClickAppLauncher, safeClickAppLauncherValue } from './clickHelpers';
// Safe click with retries
await safeClick(element, page, 'click_failure');
// Safe click for typeahead elements
await safeClickTypeahead(element, page);
// Safe click for specific value in typeahead
await safeClickTypeaheadValue(element, 'value', page);
// Safe click for app launcher
await safeClickAppLauncher(element, page);
// Safe click for specific value in app launcher
await safeClickAppLauncherValue(element, 'value', page, true);
The captureSnapshots.ts
module provides functions to capture HTML snapshots and screenshots.
import { Page } from '@playwright/test';
import { captureHtmlSnapshot, captureScreenshot, captureFailureSnapshotAndScreenshot } from './captureSnapshots';
// Capture HTML snapshot
await captureHtmlSnapshot(page, 'snapshot.html');
// Capture screenshot
await captureScreenshot(page, 'snapshot.png');
// Capture both HTML snapshot and screenshot on failure
await captureFailureSnapshotAndScreenshot(page, 'failure_snapshot');
-
build
: Compiles TypeScript to JavaScript -
lint
: Lints TypeScript files -
format
: Formats TypeScript files using Prettier -
prepare
: Runs build script
Direct contributions are not accepted for this repository. To ensure consistency and maintain the quality of this library, all modifications are handled solely by the original author.
However, we value your feedback! If you have any bug reports or feature suggestions, please use the repository issues section. Your input is appreciated and will be considered for future updates.
This project is licensed under the MIT License. Redistribution is allowed, but modifications are not permitted.