omniplay
v1.0.7
Published
A Playwright library for Salesforce Omnistudio automation
Downloads
15
Maintainers
Readme
Omniplay
A Playwright library for Salesforce Omnistudio automation.
Installation
To install the library, run:
npm install omniplay
Usage
OmniStudio Helpers
The omnistudioHelpers.ts
module provides helper functions for OmniStudio interactions.
Example
import { Page } from '@playwright/test';
import { OmniStudioHelpers } from './omnistudioHelpers';
// Select from typeahead
await OmniStudioHelpers.selectFromTypeahead('typeahead-name', 'value', page, true);
Salesforce Helpers
The salesforceHelpers.ts
module provides helper functions for Salesforce interactions.
Example
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);
Security Helpers
The securityHelpers.ts
module provides helper functions for login operations.
Example
import { Page } from '@playwright/test';
import { SecurityHelpers } from './securityHelpers';
// Perform login
await SecurityHelpers.login(page, 'https://login.salesforce.com', 'username', 'password');
Safe Click Helpers
The clickHelpers.ts
module includes functions to safely click on elements with retries and capture snapshots on failure.
Example
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);
Capturing Snapshots
The captureSnapshots.ts
module provides functions to capture HTML snapshots and screenshots.
Example
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');
Scripts
build
: Compiles TypeScript to JavaScriptlint
: Lints TypeScript filesformat
: Formats TypeScript files using Prettierprepare
: Runs build script
Contributing
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.
License
This project is licensed under the MIT License. Redistribution is allowed, but modifications are not permitted.