Trouble interacting with Bootstrap modals via Capybara (v2)

前端 未结 4 2125
无人及你
无人及你 2021-01-01 22:07

In a Rails application I\'m trying to test a Bootstrap modal with a jQuery TokenInput field in Rspec using Capybara with the capybara-webkit driver. The portion

4条回答
  •  渐次进展
    2021-01-01 22:28

    I suggest to add falowing css in test env:

      div, a, span, footer, header {
          -webkit-transition: none !important;
          -moz-transition: none !important;
          -ms-transition: none !important;
          -o-transition: none !important;
          transition: none !important;
      }
    
      .modal {
        display: none !important;
      }
    
      .modal.in {
        display: block !important;
      }
    
      .modal-backdrop {
        display: none !important;
      }
    

    Add this js in the and of body:

    $(".fade").removeClass("fade");
    

    That has solved most of my problems with capybara and bootstrap.

提交回复
热议问题