How do interact correctly with a range input (slider) in Cypress?2019 Community Moderator ElectionHow do I correctly clone a JavaScript object?How to sort an array of integers correctlyHow do I get the value of text input field using JavaScript?.val on input adjusting HTML but not changing value in consolejQuery and range inputHow to test file inputs with Cypress?Change color gradient of input slider using js?Input range sliders are not displaying correctlyHow to initiate a cypress pluginTalkback on Android is announcing change in html5 ' input type=“range” ' in percent instead on aria-valuetext which is provided

What is the orbit and expected lifetime of Crew Dragon trunk?

Who has more? Ireland or Iceland?

Tabular environment - text vertically positions itself by bottom of tikz picture in adjacent cell

Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?

A running toilet that stops itself

Was this cameo in Captain Marvel computer generated?

What should I do when a paper is published similar to my PhD thesis without citation?

Is there a math expression equivalent to the conditional ternary operator?

How to educate team mate to take screenshots for bugs with out unwanted stuff

Help! My Character is too much for her story!

Are small insurances worth it?

How to distinguish easily different soldier of ww2?

Where is the License file location for Identity Server in Sitecore 9.1?

Professor forcing me to attend a conference, I can't afford even with 50% funding

Has a sovereign Communist government ever run, and conceded loss, on a fair election?

Inorganic chemistry handbook with reaction lists

Should I apply for my boss's promotion?

Why aren't there more Gauls like Obelix?

What exactly is the meaning of "fine wine"?

What is the purpose of a disclaimer like "this is not legal advice"?

Did Amazon pay $0 in taxes last year?

Create chunks from an array

Is divide-by-zero a security vulnerability?

Cycles on the torus



How do interact correctly with a range input (slider) in Cypress?



2019 Community Moderator ElectionHow do I correctly clone a JavaScript object?How to sort an array of integers correctlyHow do I get the value of text input field using JavaScript?.val on input adjusting HTML but not changing value in consolejQuery and range inputHow to test file inputs with Cypress?Change color gradient of input slider using js?Input range sliders are not displaying correctlyHow to initiate a cypress pluginTalkback on Android is announcing change in html5 ' input type=“range” ' in percent instead on aria-valuetext which is provided










2















I'm writing my bachelor thesis about e2e testing in javascript althought I'm not familiar with testing or javascript.



So I have this the range input "slider" from the src



<input id="sum_slider" class="input-range js-inv-calc-input-sum-range js-input-range" type="range" name="investmentsum" min="20000" max="150000" value="20000" step="1000" title="Investitionsbetrag" style="background: -webkit-linear-gradient(left, rgb(255, 196, 0) 0%, rgb(255, 196, 0) 0%, rgb(119, 119, 119) 0%) no-repeat;">


Cypress Documentation suggests this



cy.get('input[type=range]').as('range')
.invoke('val', 25)
.trigger('change')

cy.get('@range').siblings('p').should('have.text', '25')


I tried:



 cy.get('#sum_slider[type=range]').as('range')
.invoke('val', 0%)
.trigger('change')


I choose the percent values because the two last percent values are the only one, which changes by using the slider manually.
Has someone same problems with that slider shit out there?
thank you for your help!










share|improve this question


























    2















    I'm writing my bachelor thesis about e2e testing in javascript althought I'm not familiar with testing or javascript.



    So I have this the range input "slider" from the src



    <input id="sum_slider" class="input-range js-inv-calc-input-sum-range js-input-range" type="range" name="investmentsum" min="20000" max="150000" value="20000" step="1000" title="Investitionsbetrag" style="background: -webkit-linear-gradient(left, rgb(255, 196, 0) 0%, rgb(255, 196, 0) 0%, rgb(119, 119, 119) 0%) no-repeat;">


    Cypress Documentation suggests this



    cy.get('input[type=range]').as('range')
    .invoke('val', 25)
    .trigger('change')

    cy.get('@range').siblings('p').should('have.text', '25')


    I tried:



     cy.get('#sum_slider[type=range]').as('range')
    .invoke('val', 0%)
    .trigger('change')


    I choose the percent values because the two last percent values are the only one, which changes by using the slider manually.
    Has someone same problems with that slider shit out there?
    thank you for your help!










    share|improve this question
























      2












      2








      2








      I'm writing my bachelor thesis about e2e testing in javascript althought I'm not familiar with testing or javascript.



      So I have this the range input "slider" from the src



      <input id="sum_slider" class="input-range js-inv-calc-input-sum-range js-input-range" type="range" name="investmentsum" min="20000" max="150000" value="20000" step="1000" title="Investitionsbetrag" style="background: -webkit-linear-gradient(left, rgb(255, 196, 0) 0%, rgb(255, 196, 0) 0%, rgb(119, 119, 119) 0%) no-repeat;">


      Cypress Documentation suggests this



      cy.get('input[type=range]').as('range')
      .invoke('val', 25)
      .trigger('change')

      cy.get('@range').siblings('p').should('have.text', '25')


      I tried:



       cy.get('#sum_slider[type=range]').as('range')
      .invoke('val', 0%)
      .trigger('change')


      I choose the percent values because the two last percent values are the only one, which changes by using the slider manually.
      Has someone same problems with that slider shit out there?
      thank you for your help!










      share|improve this question














      I'm writing my bachelor thesis about e2e testing in javascript althought I'm not familiar with testing or javascript.



      So I have this the range input "slider" from the src



      <input id="sum_slider" class="input-range js-inv-calc-input-sum-range js-input-range" type="range" name="investmentsum" min="20000" max="150000" value="20000" step="1000" title="Investitionsbetrag" style="background: -webkit-linear-gradient(left, rgb(255, 196, 0) 0%, rgb(255, 196, 0) 0%, rgb(119, 119, 119) 0%) no-repeat;">


      Cypress Documentation suggests this



      cy.get('input[type=range]').as('range')
      .invoke('val', 25)
      .trigger('change')

      cy.get('@range').siblings('p').should('have.text', '25')


      I tried:



       cy.get('#sum_slider[type=range]').as('range')
      .invoke('val', 0%)
      .trigger('change')


      I choose the percent values because the two last percent values are the only one, which changes by using the slider manually.
      Has someone same problems with that slider shit out there?
      thank you for your help!







      javascript testing slider cypress






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      Kristi SuliKristi Suli

      294




      294






















          1 Answer
          1






          active

          oldest

          votes


















          1














          You must set the value to a number not a percent. You should take a look at the element and see what values are valid. Usually there is a min and max attribute on the element.



          Notice those attributes on your element



          <input id="sum_slider" class="input-range js-inv-calc-input-sum-range js-input-range" type="range" name="investmentsum" min="20000" max="150000" value="20000" step="1000" title="Investitionsbetrag" style="background: -webkit-linear-gradient(left, rgb(255, 196, 0) 0%, rgb(255, 196, 0) 0%, rgb(119, 119, 119) 0%) no-repeat;">


          So with your element, the value you set must be between 20000 and 150000. The following should work:



          cy.get('input[type=range]')
          .invoke('val', 20001)
          .trigger('change')





          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023428%2fhow-do-interact-correctly-with-a-range-input-slider-in-cypress%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You must set the value to a number not a percent. You should take a look at the element and see what values are valid. Usually there is a min and max attribute on the element.



            Notice those attributes on your element



            <input id="sum_slider" class="input-range js-inv-calc-input-sum-range js-input-range" type="range" name="investmentsum" min="20000" max="150000" value="20000" step="1000" title="Investitionsbetrag" style="background: -webkit-linear-gradient(left, rgb(255, 196, 0) 0%, rgb(255, 196, 0) 0%, rgb(119, 119, 119) 0%) no-repeat;">


            So with your element, the value you set must be between 20000 and 150000. The following should work:



            cy.get('input[type=range]')
            .invoke('val', 20001)
            .trigger('change')





            share|improve this answer





























              1














              You must set the value to a number not a percent. You should take a look at the element and see what values are valid. Usually there is a min and max attribute on the element.



              Notice those attributes on your element



              <input id="sum_slider" class="input-range js-inv-calc-input-sum-range js-input-range" type="range" name="investmentsum" min="20000" max="150000" value="20000" step="1000" title="Investitionsbetrag" style="background: -webkit-linear-gradient(left, rgb(255, 196, 0) 0%, rgb(255, 196, 0) 0%, rgb(119, 119, 119) 0%) no-repeat;">


              So with your element, the value you set must be between 20000 and 150000. The following should work:



              cy.get('input[type=range]')
              .invoke('val', 20001)
              .trigger('change')





              share|improve this answer



























                1












                1








                1







                You must set the value to a number not a percent. You should take a look at the element and see what values are valid. Usually there is a min and max attribute on the element.



                Notice those attributes on your element



                <input id="sum_slider" class="input-range js-inv-calc-input-sum-range js-input-range" type="range" name="investmentsum" min="20000" max="150000" value="20000" step="1000" title="Investitionsbetrag" style="background: -webkit-linear-gradient(left, rgb(255, 196, 0) 0%, rgb(255, 196, 0) 0%, rgb(119, 119, 119) 0%) no-repeat;">


                So with your element, the value you set must be between 20000 and 150000. The following should work:



                cy.get('input[type=range]')
                .invoke('val', 20001)
                .trigger('change')





                share|improve this answer















                You must set the value to a number not a percent. You should take a look at the element and see what values are valid. Usually there is a min and max attribute on the element.



                Notice those attributes on your element



                <input id="sum_slider" class="input-range js-inv-calc-input-sum-range js-input-range" type="range" name="investmentsum" min="20000" max="150000" value="20000" step="1000" title="Investitionsbetrag" style="background: -webkit-linear-gradient(left, rgb(255, 196, 0) 0%, rgb(255, 196, 0) 0%, rgb(119, 119, 119) 0%) no-repeat;">


                So with your element, the value you set must be between 20000 and 150000. The following should work:



                cy.get('input[type=range]')
                .invoke('val', 20001)
                .trigger('change')






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 2 days ago

























                answered 2 days ago









                bkucerabkucera

                1,485317




                1,485317





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55023428%2fhow-do-interact-correctly-with-a-range-input-slider-in-cypress%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

                    Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

                    Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved