1.0.0 • Published 2 years ago

cypress-pseudo-localization v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

A plugin that allows to transform regular strings into their pseudo-localized variant. It's a wrapper around a small fork of https://github.com/tryggvigy/pseudo-localization.

We highly recommend using this plugin in addition to a visual regression testing tool.

A pseudo localized Cypress test showing the variant

Installation

$ yarn add cypress-pseudo-localization

# or

$ npm i --save cypress-pseudo-localization

In your code

Inside the cypress/support/commands.js file, add the following at the top:

import "cypress-pseudo-localization";

And then, in your cypress tests:

beforeEach(() => {
  cy.visit("https://your-page-some-where.com/");
  cy.pseudoLocalize();
});

// Make sure to cleanup to localization after the tests
// Needed, because there's a mutation observer used under the hood
afterEach(cy.stopPseudoLocalize);