RSpec + Capybara: How do I test a Bootstrap progress bar -


I'm testing a page that has the bootstrap progress bar using RSPC. How can I test various Aria features in Div?

  & lt; Div class = "progress-time progress-time-success" role = "progress bar" aria-valuenow = "40" aria-value = "0" area-valuemax = "100" style = "width: 40%" & gt; ; & Lt; / Div & gt;  

I appreciate your help.

Thank you!

You get the attribute value of an element using the [] method You can. For example:

  find ('div.progress-bar') ['aria-valuenow'] # = & gt; Search for "40" ('div.progress-bar') ['aria-valuemax'] # = & gt; "100"  

You can test values ​​by doing this:

  Hope ('div.progress-bar') ['aria-valuenow 'Eq' ('100')  

However eq ('40 ') is expected (' div.progress-bar ') [' aria-valuemax ']). , Which will not use Capebara's built-in waiting methods If you are comfortable using the wait method, then you should do this:

  Hope (page). CSS ('div.progress-bar [aria-valuenow = "40"]') 'is expected (page). To HKSSS ('div.progress-bar [aria-valuemax = "100"]')  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -