Topic on Talk:Quality Assurance/Writing feature descriptions

Karima Rafes (talkcontribs)

Hi

It's a great job... All works and now, I try to do some tests for my extension but Ruby is not my friend for the moment. May be can you help me ?

I describe a little example there : http://www.mediawiki.org/wiki/Quality_Assurance/Browser_testing/Test_backlog#Table

And my class is :

class PageResult
  include PageObject
  include URL
  table(:tableResult, class: 'wikitable')
end 

And the steps :

When(/^I enter article table :$/) do |tableWikitext|  
  on(EditPage).article_text = tableWikitext
end
Then(/^table should be there:$/) do |table|
  # table is a Cucumber::Ast::Table  
  tableResult = on(PageResult).tableResult
  #DRAGON IS THERE ?
  # tableResult ??DIFF?? table
end

Can you implement this rules ? It will be a good example for newbies.

Thanks karima

ZFilipin (WMF) (talkcontribs)
Karima Rafes (talkcontribs)

Hi

I found :

When(/^I enter article table:$/) do |tableWikiText|  
  on(EditPage).article_text = tableWikiText
end

Then(/^table should be there:$/) do |table|
   nodesTR = Nokogiri::HTML(@browser.html).css(".wikitable tr")
   tableResult = nodesTR.map {|tr| tr.css("th,td").map {|cell| cell.text.strip}}
   table.diff!(tableResult)
end

Bye Karima