using send to validate my data from populate_page with

27 views Asked by At

I'm trying to use a hash of data that obtain from data_magic to set values on page, do a refresh and then use that same set of data to validate that the page loaded back with that which was set.

getting an error when trying to use the send

any pointers?

    visit MyPage do |page|
        my_data = page.data_for :address_set
        page.populate_page_with my_data
        page.refresh

        #
        # verify page loads with data set

        keys = my_data.keys 
        keys.each do |key|
          expect(send("page.#{key}")).to eq my_data[:key]
        end
end 
1

There are 1 answers

0
niartseoj On

figured it out so sharing in case anyone finds of value. Found it helpful to build in some test of the page-objects being created.

  my_data = page.data_for :address_set
  page.populate_page my_data
 
  page.refresh
  
  # match the input with the screen refresh to ensure that save works
  #
  my_data.keys.each do |key|
     expect(page.send("#{key}")).to eq my_data["#{key}"]
  end