Comments (8)
You could add this to the defaultMapElements in the formFiller species
var defaultMapElements = {
'input[type="text"]': fillTextElement,
'input[type="textarea"]': fillTextElement,
'input[type="password"]': fillTextElement,
'input[type="number"]': fillNumberElement,
'select': fillSelect,
'input[type="radio"]': fillRadio,
'input[type="checkbox"]': fillCheckbox,
'input[type="email"]': fillEmail,
'input:not([type])': fillTextElement
};
The only issue with that though is that it will only do single characters there. Really TextArea's are best suited for large content areas that it expects a lot of typing.
What I think @marmelab should do is implement https://github.com/marak/Faker.js/ Faker.js for all formFiller elements. This would allow random unique data every time that it runs.
from gremlins.js.
Ah! Faker. Interesting topic, which I know a bit about. Faker.js has a critical limitation in my mind: it doesn't support seeding. Chance.js, on the other hand, does support seeding, and it's bundled with Gremlins. So what you imagine isn't very difficult to achieve.
I think the best option would be to update the formFiller
gremlin to make its 'fill' function customizable, so that you could easily type more than one character.
from gremlins.js.
Also, typing more than one letter at a time may be problematic for apps listening to key events.
from gremlins.js.
Good to get to meet you @fzaninotto I thought your icon looked familiar! I didn't know you were a maintainer on this project.
Yeah, I like the idea of having it customizable so if someone wants to prefill with Faker (or a finite set of data from a JSON file).
from gremlins.js.
That's exactly what I was thinking for a moment. I've hooked up a markdown parser to a text area on some admin pages which listens to key events.
I don't suppose it'd make a huge difference if blocks were added, It'd make me rework how I listen for changes which is probably a good thing.
from gremlins.js.
The fact that gremlins should fill text inputs and textareas using keyboard events (I've just opened #34 about that by the way) doesn't mean that the formFiller should only type one key at a time. So the fill functions should repeat a certain number of times before exiting.
from gremlins.js.
Perhaps worth noting that there's a bug in the code that @hppycoder has put forward. The selector should not be an input.
var defaultMapElements = {
'input[type="text"]': fillTextElement,
'textarea': fillTextElement,
'input[type="password"]': fillTextElement,
'input[type="number"]': fillNumberElement,
'select': fillSelect,
'input[type="radio"]': fillRadio,
'input[type="checkbox"]': fillCheckbox,
'input[type="email"]': fillEmail,
'input:not([type])': fillTextElement
};
from gremlins.js.
oops, good catch.
from gremlins.js.
Related Issues (20)
- Current project status HOT 4
- Example of bugs? HOT 3
- Roadmap to Gremlins.js 2.0 HOT 3
- Bug: Uncaught RangeError: Chance: Min cannot be greater than Max. HOT 4
- Bug: Input with `type="number"` breaks gremlins HOT 3
- Bug: Gremlins won't execute in Cypress test HOT 2
- Incorrect params for `customGremlin` in README HOT 2
- Command line interface? HOT 2
- How to test a website? HOT 1
- Detailed logs HOT 3
- Using Within Playwright HOT 3
- the newly opened windows also be monkey tested
- Unable to capture the result /log HOT 1
- Bug: gremlins is not defined in some page HOT 2
- Add support for right click (or in general other buttons) HOT 1
- Interactions not completely deterministic despite seeding the randomizer HOT 4
- Bug: gremlins.js aborts too early.
- Running gremlins.js on a webview
- Is there an example of successfully finding a bug or error? HOT 1
- Bug:
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gremlins.js.