mardi 28 avril 2015

Testing svg charts in Watir-webdriver

I am trying test if a chart has the correct title of 'Revenue'. I am using watir-webdriver to automate these test. Can anyone help?

HTML code:

<nvd3-multi-bar-chart data="chartData" id="revenueChart" class="chart-render ng-isolate-scope" showxaxis="true" showyaxis="true" color="colorFunction()" interactive="true" xaxistickformat="xAxisTickFormat()" yaxistickformat="yAxisTickFormat()" yaxisshowmaxmin="false" callback="chartCreatedCallbackFunction()" nodata="">

<text x="20" y="20" text-anchor="start" class="statistics-title">Revenue</text>

<text x="20" y="40" text-anchor="start" class="statistics-title-total">Total: 1,222,140 USD</text>

All i could come up with is this:

if @browser.div(:xpath, '//*[@id="revenueChart"]/svg/text[1]').class == 'Revenue'
    print_green('Revenue Chart title           --- Pass')

end

Aucun commentaire:

Enregistrer un commentaire