data_magic icon indicating copy to clipboard operation
data_magic copied to clipboard

[Feature Request] To use data in yaml file individually

Open anilreddy opened this issue 10 years ago • 1 comments

Hi @cheezy

Currently in the methods if we have please waits & conditions likes if, else etc. I am unable to use data magic.

Say if I have methods that have if else conditions like this:

I cannot use populate_page_with data_for instead it would be great if you can implement like this:

yaml file:

comment_details:
  test_comment: Test comment details
  report_comment: Report comment details
  def enter_comment_details(data = {})
    if report_comment.nil?
      if category == $category[:test].to_s
        if want_date_radio == $confirm[:yes].to_s
          select_want_date_radio
          wait_until_page_loads
          self.want_date = current_date
        elsif test_comment_radio == $confirm[:yes].to_s
          select_test_comment_radio
          wait_until_page_loads
          self.test_comment = test_comment # use here
        end
        self.report_comment = report_comment
      elsif category == $category[:report].to_s
        self.report_comment == report_comment # use here
    end
  end 

anilreddy avatar Jul 26 '15 07:07 anilreddy

 def enter_comment_details(data = {})
    comments = data_for(:comment_details)
    if report_comment.nil?
      if category == $category[:test].to_s
        if want_date_radio == $confirm[:yes].to_s
          select_want_date_radio
          wait_until_page_loads
          self.want_date = current_date
        elsif test_comment_radio == $confirm[:yes].to_s
          select_test_comment_radio
          wait_until_page_loads
          self.test_comment =  comments['test_comment'] # use here
        end
        self.report_comment = report_comment
      elsif category == $category[:report].to_s
        self.report_comment == comments['report_comment'] # use here
    end
  end 

What's wrong with that ?!

vveliev avatar Sep 04 '15 05:09 vveliev