ruby on rails - Testing Morris.js graphs with rspec -
i use morris.js graphs in ruby on rails , find useful. however, not sure how test graphs using feature specs in rspec capybara. @ least test following
- the graph displaying on page
- the right type of graph e.g. line graph
- there data being plotted, e.g. check there 2 lines in graph.
how do this?
i can answer first 2 parts of question. if graph working, javascript code inserts html svg element in page. using feature spec js: true, can test with: page.should have_css 'svg'
if have different graphs on same page, can wrap each in div , test like: within :css, 'div#first_chart' page.should have_css 'svg' end not tell you have right type of morris graph in there, should suffice purposes.
i still not know how check more detailed features number of lines appearing on graph.
Comments
Post a Comment