Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions registrations/test/integration/admin_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ defmodule Registrations.Integration.Admin do

Users.build_team_from(session, a.id)

assert Nav.info_text(session) == "Team built successfully"
Nav.assert_info_text(session, "Team built successfully")

assert Users.teamed(session, a.id)
assert Users.teamed(session, b.id)
Expand Down Expand Up @@ -136,7 +136,7 @@ defmodule Registrations.Integration.Admin do
Nav.users_link().click(session)
Users.build_team_from(session, a.id)

assert Nav.error_text(session) == "Team built with placeholders!"
Nav.assert_error_text(session, "Team built with placeholders!")

Nav.teams_link().click(session)

Expand Down Expand Up @@ -193,13 +193,13 @@ defmodule Registrations.Integration.Admin do
refute page_source(session) =~ "francine.pascal@example.com"

visit(session, "/messages")
assert Nav.error_text(session) == "Who are you?"
Nav.assert_error_text(session, "Who are you?")

visit(session, "/teams")
assert Nav.error_text(session) == "Who are you?"
Nav.assert_error_text(session, "Who are you?")

visit(session, "/settings")
assert Nav.error_text(session) == "Who are you?"
Nav.assert_error_text(session, "Who are you?")
end

end
Expand Down Expand Up @@ -245,7 +245,7 @@ defmodule Registrations.Integration.UnmnemonicDevices.Admin do
insert(:user, email: "francine.pascal@example.com")

visit(session, "/settings")
assert Nav.error_text(session) == "Who are you?"
Nav.assert_error_text(session, "Who are you?")
end

test "admin can view team JSON that includes voicepasses", %{session: session} do
Expand All @@ -265,6 +265,7 @@ defmodule Registrations.Integration.UnmnemonicDevices.Admin do

visit(session, "/")
Login.login_as_admin(session)
Nav.assert_logged_in_as(session, "octavia.butler@example.com")

visit(session, "/api/teams")
json = decode_json_from_page(session)
Expand Down
9 changes: 5 additions & 4 deletions registrations/test/integration/home_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ defmodule Registrations.Waydowntown.Integration.Home do
Login.fill_email(session, "Octavia.butler@example.com")
Login.fill_password(session, "Xenogenesis")
Login.submit(session)
Nav.assert_logged_in_as(session, "octavia.butler@example.com")

visit(session, "/")
refute(Home.placeholder_exists?(session))
Expand All @@ -191,7 +192,7 @@ defmodule Registrations.Waydowntown.Integration.Home do
Home.fill_waitlist_question(session, "When will the event take place?")
Home.submit_waitlist(session)

assert Nav.info_text(session) == "we’ll let you know when registration opens"
Nav.assert_info_text(session, "we’ll let you know when registration opens")

wait_for_emails([sent_email])
assert sent_email.to == [{"", "mdrysdale@waydown.town"}]
Expand Down Expand Up @@ -240,7 +241,7 @@ defmodule Registrations.Waydowntown.Integration.Home do

Home.submit_waitlist(session)

assert Nav.info_text(session) == "was that an email address?"
Nav.assert_info_text(session, "was that an email address?")

assert wait_for_emails([]) == []
end
Expand Down Expand Up @@ -268,7 +269,7 @@ defmodule Registrations.Waydowntown.Integration.Home do
Home.fill_waitlist_question(session, "When will the event take place?")
Home.submit_waitlist(session)

assert Nav.info_text(session) == "we’ll let you know when registration opens"
Nav.assert_info_text(session, "we’ll let you know when registration opens")

assert wait_for_emails([]) == []
end
Expand Down Expand Up @@ -296,7 +297,7 @@ defmodule Registrations.Waydowntown.Integration.Home do
Home.fill_waitlist_question(session, "When will this unwanted event take place?")
Home.submit_waitlist(session)

assert Nav.info_text(session) == "we’ll let you know when registration opens"
Nav.assert_info_text(session, "we’ll let you know when registration opens")

assert wait_for_emails([]) == []
end
Expand Down
2 changes: 1 addition & 1 deletion registrations/test/integration/invitations_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ defmodule Registrations.Integration.Invitations do
Register.fill_password_confirmation(session, "simulteneity")
Register.submit(session)

assert Nav.logout_link().text(session) == "Log out bedap@example.com"
Nav.assert_logged_in_as(session, "bedap@example.com")
end
end
8 changes: 4 additions & 4 deletions registrations/test/integration/messages_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defmodule Registrations.Integration.Messages do

Messages.send(session)

assert Nav.info_text(session) == "Message was sent"
Nav.assert_info_text(session, "Message was sent")

wait_for_emails([empty_email, _ignored1, email, _ignored2])
assert email.to == [{"", "user@example.com"}]
Expand Down Expand Up @@ -96,7 +96,7 @@ defmodule Registrations.Integration.Messages do

Messages.send_to_me(session)

assert Nav.info_text(session) == "Message was sent"
Nav.assert_info_text(session, "Message was sent")

wait_for_emails([email])
assert email.to == [{"", "admin@example.com"}]
Expand Down Expand Up @@ -129,7 +129,7 @@ defmodule Registrations.Integration.Messages do

Messages.send(session)

assert Nav.info_text(session) == "Message was sent"
Nav.assert_info_text(session, "Message was sent")

wait_for_emails([email])
assert email.from == {"Knut", "knut@example.com"}
Expand Down Expand Up @@ -175,7 +175,7 @@ defmodule Registrations.Integration.Messages do

Messages.send(session)

assert Nav.info_text(session) == "Message was sent"
Nav.assert_info_text(session, "Message was sent")

sent_emails = wait_for_emails([_email1, _email2, _email3, _email4])

Expand Down
4 changes: 2 additions & 2 deletions registrations/test/integration/questions_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ defmodule Registrations.ClandestineRendezvous.Integration.Questions do

Home.submit_question(session)

assert Nav.info_text(session) == "Your question has been submitted."
Nav.assert_info_text(session, "Your question has been submitted.")

wait_for_emails([sent_email])
assert sent_email.to == [{"", "b@events.chromatin.ca"}]
Expand Down Expand Up @@ -58,7 +58,7 @@ defmodule Registrations.UnmnemonicDevices.Integration.Questions do

Home.submit_question(session)

assert Nav.info_text(session) == "Your question has been submitted."
Nav.assert_info_text(session, "Your question has been submitted.")

wait_for_emails([sent_email])
assert sent_email.to == [{"", "knut@chromatin.ca"}]
Expand Down
89 changes: 55 additions & 34 deletions registrations/test/integration/registrations_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do

Register.submit(session)

assert Nav.error_text(session) ==
"Oops, something went wrong! Please check the errors below:\nPassword can't be blank\nEmail can't be blank"
Nav.assert_error_text(
session,
"Oops, something went wrong! Please check the errors below:\nPassword can't be blank\nEmail can't be blank"
)

assert Register.email_error(session) == "Email can't be blank"
# FIXME fix plural detection
Expand All @@ -29,15 +31,17 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do
Register.fill_email(session, "franklin.w.dixon@example.com")
Register.submit(session)

assert Nav.error_text(session) ==
"Oops, something went wrong! Please check the errors below:\nPassword can't be blank"
Nav.assert_error_text(
session,
"Oops, something went wrong! Please check the errors below:\nPassword can't be blank"
)

Register.fill_email(session, "samuel.delaney@example.com")
Register.fill_password(session, "nestofspiders")
Register.fill_password_confirmation(session, "nestofspiders")
Register.submit(session)

assert Nav.info_text(session) == "Your account was created"
Nav.assert_info_text(session, "Your account was created")

wait_for_emails([admin_email, welcome_email])

Expand All @@ -50,7 +54,7 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do
assert String.contains?(welcome_email.text_body, "secret society")
assert String.contains?(welcome_email.html_body, "secret society")

assert Nav.logout_link().text(session) == "Log out samuel.delaney@example.com"
Nav.assert_logged_in_as(session, "samuel.delaney@example.com")

assert Details.active?(session)
end
Expand All @@ -67,20 +71,22 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do
Login.fill_password(session, "Parable of the Talents")
Login.submit(session)

assert Nav.error_text(session) ==
"The provided login details did not work. Please verify your credentials, and try again."
Nav.assert_error_text(
session,
"The provided login details did not work. Please verify your credentials, and try again."
)

Login.fill_password(session, "Xenogenesis")
Login.submit(session)

assert Nav.info_text(session) == "Logged in"
assert Nav.logout_link().text(session) == "Log out octavia.butler@example.com"
Nav.assert_info_text(session, "Logged in")
Nav.assert_logged_in_as(session, "octavia.butler@example.com")

assert Details.active?(session)

Nav.logout_link().click(session)

assert Nav.info_text(session) == "Logged out"
Nav.assert_info_text(session, "Logged out")
assert Nav.login_link().present?(session)
assert Nav.register_link().present?(session)
end
Expand All @@ -99,25 +105,30 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do
Account.fill_current_password(session, "Wrong")
Account.submit(session)

assert Nav.error_text(session) ==
"Oops, something went wrong! Please check the errors below:\nCurrent password is invalid"
Nav.assert_error_text(
session,
"Oops, something went wrong! Please check the errors below:\nCurrent password is invalid"
)

Account.fill_current_password(session, "Xenogenesis")
Account.fill_new_password(session, "abcde")
Account.fill_new_password_confirmation(session, "vwxyz")
Account.submit(session)

assert Nav.error_text(session) ==
"Oops, something went wrong! Please check the errors below:\nPassword should be at least 8 character(s)\nPassword confirmation does not match confirmation"
Nav.assert_error_text(
session,
"Oops, something went wrong! Please check the errors below:\nPassword should be at least 8 character(s)\nPassword confirmation does not match confirmation"
)

Account.fill_current_password(session, "Xenogenesis")
Account.fill_new_password(session, "Lilith’s Brood")
Account.fill_new_password_confirmation(session, "Lilith’s Brood")
Account.submit(session)

assert Nav.info_text(session) == "Your account has been updated."
Nav.assert_info_text(session, "Your account has been updated.")

Nav.logout_link().click(session)
Nav.assert_info_text(session, "Logged out")

visit(session, "/")
Nav.login_link().click(session)
Expand All @@ -126,13 +137,15 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do
Login.fill_password(session, "Xenogenesis")
Login.submit(session)

assert Nav.error_text(session) ==
"The provided login details did not work. Please verify your credentials, and try again."
Nav.assert_error_text(
session,
"The provided login details did not work. Please verify your credentials, and try again."
)

Login.fill_password(session, "Lilith’s Brood")
Login.submit(session)

assert Nav.info_text(session) == "Logged in"
Nav.assert_info_text(session, "Logged in")
end

test "forgot password", %{session: session} do
Expand All @@ -148,8 +161,10 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do
ForgotPassword.fill_email(session, "octavia.butler@example.com")
ForgotPassword.submit(session)

assert Nav.info_text(session) ==
"If an account for the provided email exists, an email with reset instructions will be sent to you. Please check your inbox."
Nav.assert_info_text(
session,
"If an account for the provided email exists, an email with reset instructions will be sent to you. Please check your inbox."
)

wait_for_emails([forgot_password_email])

Expand All @@ -167,38 +182,40 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do
assert String.starts_with?(reset_path, "/reset-password/")

visit(session, "/reset-password/fake")
assert Nav.error_text(session) == "The reset token has expired."
Nav.assert_error_text(session, "The reset token has expired.")

visit(session, reset_path)

Account.fill_new_password(session, "anewpassword")
Account.fill_new_password_confirmation(session, "awrongpassword")
Account.submit(session)

assert Nav.error_text(session) ==
"Oops, something went wrong! Please check the errors below:\nPassword confirmation does not match confirmation"
Nav.assert_error_text(
session,
"Oops, something went wrong! Please check the errors below:\nPassword confirmation does not match confirmation"
)

Account.fill_new_password(session, "anewpassword")
Account.fill_new_password_confirmation(session, "anewpassword")
Account.submit(session)

assert Nav.info_text(session) == "The password has been updated."
Nav.assert_info_text(session, "The password has been updated.")

Login.fill_email(session, "Octavia.butler@example.com")
Login.fill_password(session, "anewpassword")
Login.submit(session)

assert Nav.logout_link().text(session) == "Log out octavia.butler@example.com"
Nav.assert_logged_in_as(session, "octavia.butler@example.com")

Nav.logout_link().click(session)

Login.login_as(session, "octavia.butler@example.com", "anewpassword")
assert Nav.logout_link().text(session) == "Log out octavia.butler@example.com"
Nav.assert_logged_in_as(session, "octavia.butler@example.com")

Nav.logout_link().click(session)

visit(session, reset_path)
assert Nav.error_text(session) == "The reset token has expired."
Nav.assert_error_text(session, "The reset token has expired.")
end

test "delete account", %{session: session} do
Expand All @@ -210,7 +227,7 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do
Nav.edit_details(session)
Details.delete_account(session)

assert Nav.info_text(session) == "Your account has been deleted. Sorry to see you go!"
Nav.assert_info_text(session, "Your account has been deleted. Sorry to see you go!")

wait_for_emails([admin_email])

Expand All @@ -227,7 +244,7 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do
Login.fill_password(session, "Xenogenesis")
Login.submit(session)

assert Nav.info_text(session) == "Your account has been deleted. Sorry to see you go!"
Nav.assert_info_text(session, "Your account has been deleted. Sorry to see you go!")
end

test "when registration is closed, a warning is displayed on the registration and details routes",
Expand All @@ -242,14 +259,18 @@ defmodule Registrations.Integration.ClandestineRendezvous.Registrations do

Nav.register_link().click(session)

assert Nav.error_text(session) ==
"Registration is closed; however, you may continue and we will email you"
Nav.assert_error_text(
session,
"Registration is closed; however, you may continue and we will email you"
)

insert(:octavia)
Login.login_as_admin(session)

assert Nav.error_text(session) ==
"You may change your details but it’s too late to guarantee the changes can be integrated"
Nav.assert_error_text(
session,
"You may change your details but it’s too late to guarantee the changes can be integrated"
)
end
end

Expand Down
Loading
Loading