@cypress-brightspot/cypress-brightspot v2.1.5
cypress-brightspot
Get started writing Cypress test cases in the Brightspot CMS 🎉
Table Of Contents
Installation
Prerequisites
- Determine what Brightspot version your project is on. It can be found in your project's
settings.gradle
. - Make sure you are using node version required for your project. This can be found in your frontend bundle's
package.json
.
Using the install.sh script
Manually download install.sh but eventually this should get refined to allow for curl or wget ...
chmod +x ./install.sh && ./install.sh
curl -o- https://raw.githubusercontent.com/perfectsense/cypress-brightspot/install.sh | bash
wget -qO- https://raw.githubusercontent.com/perfectsense/cypress-brightspot/install.sh | bash
Additional manual instructions are here: Manual Installation Instructions
Validation
Let's take some steps to verify we installed everything correctly, and run our first shared test. 1. Start your local docker environment following instructions in your project root's README.
In your
e2e
folder, run:npx cypress run --spec './node_modules/@cypress-brightspot/cypress-brightspot/src/shared-tests/e2e/loginPageCmsTest.cy.js'
The test should pass succesfully!
Usage
cypress-brightspot
provides extendable classes, ready-made page objects, useful custom commands to be used for writing quick Brightspot CMS Cypress tests.
An example test using an imported page object straight from our library might look like:
import { loginPage, sitesPage } from '@cypress-brightspot/cypress-brightspot'
describe('Example Spec', () => {
it('should login and navigate to Sites and Settings', () => {
cy.visit('/cms')
loginPage.login(username, password)
sitesPage.openSiteSettings()
// And we can go on to publish Site Settings, Articles, etc...
})
})
If you're interested in changing some of our existing functionality by extending or overriding our exported objects or classes, it might look like:
// Extend All Page class from cypress-brightspot package
import { BaseCmsPage } from "@cypress-brightspot/cypress-brightspot";
class Example extends BaseCmsPage {
constructor(){
super();
this.elements.newPageElement = '.selector'
}
getNewPageElement(){
cy.log('Extending imported cypress-brightspot class');
return cy.get(this.elements.newPageElement);
}
}
// Export example page object
export const onExamplePage = new Example()
If you're interested in just updating field selectors without overriding existing logic use setElementSelector(element, value)
utility method and pass the element name and update value you need to set
it('Should successfully allow the user to update page elements from spec file', () => {
loginPageExt.visit();
expect(loginPageExt.elements.loginButton).to.equal('LOGIN BUTTON ELEMENT SELECTOR');
loginPageExt.setElementSelector('loginButton', 'UPDATED MID TEST');
expect(loginPageExt.elements.loginButton).to.equal('UPDATED MID TEST');
});
Shared Tests
Shared Tests are tests that should be compatible out-of-the-box across all BSP versions and customizations. In the installation instructions, we set the specPattern
attribute in our cypress.config.js
to automatically pull in Shared Tests from cypress-brightspot.
This is a new expiramental feature currently in development.
Page Objects
Class Name | Page Object |
---|---|
BasePage | |
BaseCmsPage | |
HomePage | homePage |
LoginPage | loginPage |
UsersAndRolesPage | usersPage |
ThemesPage | themesPage |
SitesAndSettingsPage | sitesPage |
ChangePasswordPage | changePasswordPage |
Preview | preview |
VanityUrlRedirectPage | vanityUrlRedirectPage |
WorkflowPage | workflowPage |
BaseContentTypePage | |
AttachmentType | articleEditPage |
AuthorEditPage | authorEditPage |
BlogEditPage | blogEditPage |
HomepageEditPage | homepageEditPage |
ImageEditPage | imageEditPage |
ListicleEditPage | listicleEditPage |
LogoEditPage | logoEditPage |
PageEditPage | pageEditPage |
SectionEditPage | sectionEditPage |
TagEditPage | tagEditPage |
BannerEditPage | bannerEditPage |
GalleryEditPage | galleryEditPage |
SharedContainerPage | sharedContainerPage |
SiteSearchPage | siteSearchPage |
BaseFEPage | |
ArticleFEPage | articleFEPage |
HomeFEPage | homeFEPage |
PageFEPage | pageFEPage |
ListicleFEPage | listicleFEPage |
TagFEPage | tagFEPage |
BlogFEPage | blogFEPage |
Dependencies
We recommend you use Cypress version 12.0 or above. We also recommend your Brightspot version be greater than 4.5.0 for certain features.
This package relies on the following dependencies:
If your project is on BSP version 4.5, you should be using the latest 1.x release of cypress-brightspot. If your project is on BSP version 4.7, you should be using the latest 2.x release of cypress-brightspot.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Roadmap
- Building out Shared Tests
- Automatic content type E2E test generation
License
10 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
11 months ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago