Skip to content

Commit

Permalink
Clean up protractor_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
bootstraponline committed May 22, 2015
1 parent f93df2f commit dd33a99
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions lib/angular_webdriver/protractor/protractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ def reset_url_for_browser browser_name
end
end

# @private
#
# Syncs the webdriver command if it's whitelisted
#
# @param webdriver_command [Symbol] the webdriver command to check for syncing
Expand Down
13 changes: 6 additions & 7 deletions spec/protractor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,27 +83,26 @@ def expect_equal actual, expected

it 'get' do
# should raise error when loading blank page and ignore sync is false
expect { driver.get protractor.reset_url }.to raise_error(*angular_not_found_error)
expect_angular_not_found { driver.get protractor.reset_url }

# should not raise error when loading blank page and ignore sync is true
protractor.ignore_sync = true
expect { driver.get protractor.reset_url }.to_not raise_error

expect_no_error { driver.get protractor.reset_url }
end

it 'driver_get' do
# should never raise error since driver_get will never sync
# (even when ignore sync is false)
expect { protractor.driver_get protractor.reset_url }.to_not raise_error
expect_no_error { protractor.driver_get protractor.reset_url }
end

it 'refresh' do
# should raise error when loading blank page and ignore sync is false
expect { driver.navigate.refresh }.to raise_error(*angular_not_found_error)
expect_angular_not_found { driver.navigate.refresh }

# should not raise error when loading blank page and ignore sync is true
protractor.ignore_sync = true
expect { driver.navigate.refresh }.to_not raise_error
expect_no_error { driver.navigate.refresh }
end

def expect_angular_not_found &block
Expand Down Expand Up @@ -199,7 +198,7 @@ def expect_no_error &block

it 'waitForAngular should error on non-angular pages' do
# ignore sync is false and we're on the reset page
expect { protractor.waitForAngular }.to raise_error(*angular_not_found_error)
expect_angular_not_found { protractor.waitForAngular }
end

it 'waitForAngular should succeed on angular pages with wait' do
Expand Down

0 comments on commit dd33a99

Please sign in to comment.