external@serenity-js/web
@serenity-js/web provides a
unified, Screenplay Pattern–based library for interacting
with web applications,
enabling maintainable end-to-end and component-level tests across multiple automation engines, including Playwright and
WebdriverIO.
Learn more about web testing with Serenity/JS!
Features
- Offers a consistent API for web interactions across different automation engines, making your tests maintainable and portable.
- Supports both end-to-end and component-level testing of web applications.
- Integrates seamlessly with popular test runners like Playwright Test, WebdriverIO, Mocha, Jasmine, and Cucumber.js.
- Supports all Serenity/JS reporting features
- TypeScript-first design with strong typing for safer and more predictable test code.
Installation
npm install --save-dev @serenity-js/core @serenity-js/web
See the Serenity/JS Installation Guide.
Quick Start
Usage with Playwright Test
import { describe, it } from '@serenity-js/playwright-test'
import { Navigate, Page } from '@serenity-js/web'
import { Ensure, startsWith } from '@serenity-js/assertions'
describe('Website', () => {
it('should have a title', async ({ actor }) => {
await actor.attemptsTo(
Navigate.to('https://serenity-js.org/'),
Ensure.that(Page.current().title(), startsWith('Serenity/JS')),
)
})
})
Usage with WebdriverIO and Mocha
import { describe, it } from 'mocha'
import { Navigate, Page } from '@serenity-js/web'
import { Ensure, startsWith } from '@serenity-js/assertions'
describe('Website', () => {
it('should have a title', async () => {
await actorCalled('Alice').attemptsTo(
Navigate.to('https://serenity-js.org/'),
Ensure.that(Page.current().title(), startsWith('Serenity/JS')),
)
})
})
Documentation
- API Reference
- Screenplay Pattern Guide
- Serenity/JS Project Templates
- More examples and reference implementations
- Tutorial: First Web Scenario
- Tutorial: First API Scenario
Contributing
Contributions of all kinds are welcome! Get started with the Contributing Guide.
Community
- Community Chat
- Discussions Forum
- Visit the 💡How to... ? section for answers to common questions
If you enjoy using Serenity/JS, make sure to star ⭐️ Serenity/JS on GitHub to help others discover the framework!
License
The Serenity/JS code base is licensed under the Apache-2.0 license, while its documentation and the Serenity/JS Handbook are licensed under the Creative Commons BY-NC-SA 4.0 International.
See the Serenity/JS License.
Support
Support ongoing development through GitHub Sponsors. Sponsors gain access to Serenity/JS Playbooks and priority help in the Discussions Forum.
For corporate sponsorship or commercial support, please contact Jan Molak.
Index
Abilities
Activities
Errors
Expectations
Models
- ArgumentDehydrator
- BrowserCapabilities
- BrowsingSession
- Cookie
- CookieData
- Key
- Locator
- Page
- PageElement
- PageElements
- PageElementsLocator
- RootLocator
- SelectOption
- Switchable
- SwitchableOrigin
- AbsentModalDialog
- AcceptedModalDialog
- DismissedModalDialog
- ModalDialog
- ModalDialogHandler
- By
- ByCss
- ByCssContainingText
- ByDeepCss
- ById
- ByRoleSelectorValue
- ByRole
- ByRoleSelectorOptions
- ByTagName
- ByXPath
- Selector