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

                    1928 у кіно

                    Захаров Федір Захарович

                    Ель Греко