2.1.5 • Published 10 months ago

@cypress-brightspot/cypress-brightspot v2.1.5

Weekly downloads
-
License
Apache 2.0
Repository
github
Last release
10 months ago

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.

  1. In your e2e folder, run:

    npx cypress run --spec './node_modules/@cypress-brightspot/cypress-brightspot/src/shared-tests/e2e/loginPageCmsTest.cy.js'
  2. 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 NamePage Object
BasePage
BaseCmsPage
HomePagehomePage
LoginPageloginPage
UsersAndRolesPageusersPage
ThemesPagethemesPage
SitesAndSettingsPagesitesPage
ChangePasswordPagechangePasswordPage
Previewpreview
VanityUrlRedirectPagevanityUrlRedirectPage
WorkflowPageworkflowPage
BaseContentTypePage
AttachmentTypearticleEditPage
AuthorEditPageauthorEditPage
BlogEditPageblogEditPage
HomepageEditPagehomepageEditPage
ImageEditPageimageEditPage
ListicleEditPagelisticleEditPage
LogoEditPagelogoEditPage
PageEditPagepageEditPage
SectionEditPagesectionEditPage
TagEditPagetagEditPage
BannerEditPagebannerEditPage
GalleryEditPagegalleryEditPage
SharedContainerPagesharedContainerPage
SiteSearchPagesiteSearchPage
BaseFEPage
ArticleFEPagearticleFEPage
HomeFEPagehomeFEPage
PageFEPagepageFEPage
ListicleFEPagelisticleFEPage
TagFEPagetagFEPage
BlogFEPageblogFEPage

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

Apache License 2.0

2.1.5

10 months ago

1.1.1

1 year ago

2.1.2

12 months ago

2.0.3

1 year ago

2.1.1

1 year ago

2.0.2

1 year ago

2.1.4

11 months ago

2.0.5

1 year ago

2.1.3

11 months ago

2.0.4

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.1.0

1 year ago

1.1.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago