I'm writing automated tests using Cucumber, Capybara, WebDriver, SitePrism, and Faker. I am new to this and need some help.
I have the following steps..
Given (/^I have created a new active product$/) do
@page = AdminProductCreationPage.new
@page.should be_displayed
@page.producttitle.set Faker::Name.title
@page.product_sku.set Faker::Number.number(8)
click @page.product_save
@page.should have_growl text: 'Save Successful.'
end
When (/^I navigate to that product detail page) do
pending
end
Then (/^All the data should match that which was initially entered$/) do
pending
end
In config/env_config.rb I have set up an empty hash...
Before do
# Empty container for easily sharing data between step definitions
@verify = {}
end
Now I want to hash the value generated by Faker in the Given
step so I can validate it saved properly in the When
step. I also want to enter the value generated by faker in the script below into a search field.
@page.producttitle.set Faker::Name.title
- How do I push the values generated by faker to the @verify has?
- How do I pull that value and insert it into a text field?
- How do I pull that value to verify the save value equals the value generated by faker?