1.0.2 • Published 6 years ago

screener-script-sanitizer v1.0.2

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

What's this for?

Screener can't handle class names generated by Styled-components because of the ever changing hashes. This causes screener scripts to break everytime a new version of the app is deployed. Unfortunaly the fix for this is expensive on the app side, but this package will help us mitigate the issue from the screener side

This package takes a selinium script (basically a list of events, like click here, type this in) and replaces all fragile styled-component class selectors for more resiliant wildcard selectors.

In short, it turns Selectors like this: div:nth-of-type(5) > div.ListItem__Item-s1ecg881-1 > a.Link__StyledLink-dvftiw-0 Into something this: div:nth-of-type(5) > div[class^=\"ListItem__Item-\"] > a[class^=\"Link__StyledLink-\"]

This prevents the hash changes from breaking the selector

How to use!

install this module globally with npm install -g screener-script-sanitizer

Now you should be able to run screener-script-sanitizer <path/to/file> from your terminal

1) export your script, save it to a file: scriptName.json 2) run screener-script-sanitizer./path/to/scriptName.json3) Creates a file called./scriptName-sanitized.json` 4) Now re-upload that sanitized version in place of the one you exported (edited)

You'll have to run this same process on every Script made in screener. I also believe that edits to already converted scripts might require you to export and re-run the sanatizer.