GithubHelp home page GithubHelp logo

Comments (8)

hppycoder avatar hppycoder commented on May 2, 2024

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.

fzaninotto avatar fzaninotto commented on May 2, 2024

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.

fzaninotto avatar fzaninotto commented on May 2, 2024

Also, typing more than one letter at a time may be problematic for apps listening to key events.

from gremlins.js.

hppycoder avatar hppycoder commented on May 2, 2024

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.

chrisivens avatar chrisivens commented on May 2, 2024

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.

fzaninotto avatar fzaninotto commented on May 2, 2024

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.

chrisivens avatar chrisivens commented on May 2, 2024

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.

hppycoder avatar hppycoder commented on May 2, 2024

oops, good catch.

from gremlins.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.