-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests for recaptcha and shadow dom changes; Upgrade Selenium setup.
- Fix remaining API tests due to recaptcha changes. - Fix the signup UI capybara tests due to the shadow DOM changes. In order to get this working, upgrade to selenium-webdriver 4.x, which means coming up with a slightly different, custom solution to the `capybara-chromedriver-logger` gem for tracking javascript log output. - Simplify chromedriver setup for ARM environments by using Debian's chromiumdriver, so the versions should always match.
- Loading branch information
Showing
10 changed files
with
153 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,19 +16,44 @@ def test_submission | |
visit "/signup/" | ||
assert_text("API Key Signup") | ||
|
||
fill_in "First Name", :with => "Foo" | ||
fill_in "Last Name", :with => "Bar" | ||
fill_in "Email", :with => "[email protected]" | ||
check "I have read and agree to the terms and conditions." | ||
click_button "Signup" | ||
|
||
assert_text("Your API key for [email protected] is:") | ||
|
||
user = ApiUser.order(:created_at => :asc).last | ||
assert(user) | ||
assert(user.api_key) | ||
assert_equal("[email protected]", user.email) | ||
assert_text(user.api_key) | ||
# Because these elements are inside the shadow DOM, testing is a bit harder | ||
# with Capybara, so we can't rely on the normal `fill_in` usage currently, | ||
# so that's why this testing is a bit more manual. | ||
within find("#api_umbrella_signup .api-umbrella-signup-embed-content-container").shadow_root do | ||
first_name_input = find("input[name='user[first_name]']") | ||
first_name_input.set "Foo" | ||
first_name_label = find("label[for='#{first_name_input[:id]}']") | ||
assert_equal("First Name *", first_name_label.text) | ||
|
||
last_name_input = find("input[name='user[last_name]']") | ||
last_name_input.set "Bar" | ||
last_name_label = find("label[for='#{last_name_input[:id]}']") | ||
assert_equal("Last Name *", last_name_label.text) | ||
|
||
email_input = find("input[name='user[email]']") | ||
email_input.set "[email protected]" | ||
email_label = find("label[for='#{email_input[:id]}']") | ||
assert_equal("Email *", email_label.text) | ||
|
||
terms_input = find("input[name='user[terms_and_conditions]']") | ||
terms_input.click | ||
terms_label = find("label[for='#{terms_input[:id]}']") | ||
assert_equal("I have read and agree to the terms and conditions.", terms_label.text) | ||
|
||
submit_button = find("button[type=submit]") | ||
assert_equal("Signup", submit_button.text) | ||
submit_button.click | ||
|
||
assert_text("Your API key for [email protected] is:") | ||
|
||
user = ApiUser.order(:created_at => :asc).last | ||
assert(user) | ||
assert(user.api_key) | ||
assert_equal("Foo", user.first_name) | ||
assert_equal("Bar", user.last_name) | ||
assert_equal("[email protected]", user.email) | ||
assert_text(user.api_key) | ||
end | ||
|
||
messages = sent_emails | ||
assert_equal(1, messages.fetch("total")) | ||
|
Oops, something went wrong.