Reverted back to PhatomJs 2.1.1

This commit is contained in:
Godwin
2017-04-13 19:56:27 -07:00
parent cb07484265
commit 74d952393a
7 changed files with 49 additions and 84 deletions
+6 -13
View File
@@ -11,18 +11,14 @@ Then /^(?:I )?(?:should )?(not )?see (?:the |an? )?'(.+)' link$/i do |no, item|
end
Then /^(?:I )?(?:should )?(?:still )?(not )?see '(.+)'$/i do |negate, item|
attempt_to true do
attempt_to do
expect(page).send(negate ? :not_to : :to, have_text(item))
end
attempt_to do
expect(page).send(negate ? :not_to : :to, have_text(item))
end
end
Then /^(?:I )?(?:should )?(?:still )?(not )?see (?:my |the )([^']+)$/i do |negate, item|
attempt_to true do
attempt_to do
expect(page).send(negate ? :not_to : :to, have_text(TestState::Values[get_field(item)]))
end
attempt_to do
expect(page).send(negate ? :not_to : :to, have_text(TestState::Values[get_field(item)]))
end
end
@@ -37,10 +33,7 @@ Then /^(?:I )?click (?:on )?(?:the )?(a )?'(.+?)'( button| link)?(?: beside '(.+
else
element = element_with_text(item, root_item)
end
begin
element.click
rescue Capybara::Poltergeist::TimeoutError
end
element.click
rescue Exception => e
puts text
raise e
@@ -118,7 +111,7 @@ Then /^(?:I )?enter (?:my |an? |some |the )?(.+?)(?: as '(.+)')?$/i do |field, v
end
end
TestState::Values[field] = value
(TestState::Values[field] = value)
element.set value
+1 -14
View File
@@ -20,23 +20,10 @@ Given /^(?:(?:I )?am )?on an? (.+) error page$/i do |page_name|
end
Then /^(?:I )?should be on (?:the |an? | my)?(.+) page$/i do |page_name|
sleep(1)
attempt_to do
path = path_to(page_name)
TestState.last_page = path
path = /(https?\/\/:[^\/]+)?#{Regexp.escape(path)}\/?(\?|#|$)/ unless path.is_a?(Regexp)
begin
current_url.should match path
rescue Exception => e
# due to a bug in phantomjs 2.5-development, sometimes postbacks don't work properly, this is a workaround
if page.driver.network_traffic.last.url =~ path && page.driver.network_traffic.last.method =~ /^get$/i && page.driver.network_traffic.last.response_parts.present? && page.driver.network_traffic.last.response_parts.first.status == 200
attempt_to do
visit page.driver.network_traffic.last.url
end
else
raise e
end
end
current_url.should match path
end
end
+4 -5
View File
@@ -14,13 +14,12 @@ Given /^(?:I )?(?:am logged|log) in(?: as '(.+)')?$/i do |email|
end
first(selector_for('email')).set(TestState.my_account.email)
begin
first('.flex-form button').click
rescue Capybara::Poltergeist::TimeoutError
end
first('#token + button[type="submit"]').click
attempt_to true do
begin
expect(page).to have_link TestState.my_account.name
rescue
fail "Error logging in"
end
end
end