I can understand that the page can be one or the other but when you are running your test you should know which one you will see
if its all left up to chance I would think it would make things harder to actually have confidence in your tests whats you say you dont end up with a line like
browser.text.should =~ /(foo|bar|baz|biz|buz)/
how much value does that actually provide?
I would probably do something like
if i was using cucumber:
strange_webpage.feature
Scenario: I should see foo
Given I visit "/"
Then I should see "foo"
Scenario: I should see bar
Given I visit "/"
Then I should see "bar"
step_definition.rb
Then /^I should see "([^"]*)"$/ do |expected_result|
#<< but i would probably find out what the element really is and not just that some text exist in the page
#something like
#browser.div(:id => 'something').text
browser.text.should == expected_result
end
if I was using rspec:
describe 'Simple page assertions' do
it 'should display foo' do
browser.goto '
www.strangepage.com'
browser.text.should == 'foo'
end
it 'should display bar' do
browser.goto '
www.strangepage.com'
browser.text.should == 'bar'
end
end