https://github.com/mfrachet/cypress-pseudo-localization
Switch all the text content to a pseudo localized variant of it
https://github.com/mfrachet/cypress-pseudo-localization
Last synced: about 1 month ago
JSON representation
Switch all the text content to a pseudo localized variant of it
- Host: GitHub
- URL: https://github.com/mfrachet/cypress-pseudo-localization
- Owner: mfrachet
- Created: 2021-12-29T15:47:36.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-01-09T08:04:27.000Z (over 3 years ago)
- Last Synced: 2025-01-29T21:57:25.541Z (3 months ago)
- Language: JavaScript
- Size: 303 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A plugin that allows to transform regular strings into their [pseudo-localized](https://en.wikipedia.org/wiki/Pseudolocalization) 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](https://docs.cypress.io/plugins/directory#Visual%20Testing).

## Installation
```sh
$ 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:
```js
import "cypress-pseudo-localization";
```And then, in your cypress tests:
```js
beforeEach(() => {
cy.visit("https://your-page-some-where.com/");
cy.pseudoLocalize();
});// Make sure to cleanup the localization after the tests
// Needed, because there's a mutation observer used under the hood
afterEach(cy.stopPseudoLocalize);
```