2012-07-28 07:11:59 +08:00
|
|
|
require File.expand_path(File.dirname(__FILE__) + '/common')
|
|
|
|
|
|
|
|
describe "communication channel selenium tests" do
|
2015-08-08 06:24:05 +08:00
|
|
|
include_context "in-process server selenium tests"
|
2012-07-28 07:11:59 +08:00
|
|
|
|
|
|
|
context "confirm" do
|
|
|
|
it "should register the user" do
|
2013-08-16 04:16:05 +08:00
|
|
|
Setting.set('terms_required', 'false')
|
2012-07-28 07:11:59 +08:00
|
|
|
u1 = user_with_communication_channel(:user_state => 'creation_pending')
|
|
|
|
get "/register/#{u1.communication_channel.confirmation_code}"
|
|
|
|
set_value f('#pseudonym_password'), "asdfasdf"
|
|
|
|
expect_new_page_load {
|
|
|
|
f('#registration_confirmation_form').submit
|
|
|
|
}
|
2014-10-14 09:36:52 +08:00
|
|
|
expect(f('#identity .logout')).to be_present
|
2012-07-28 07:11:59 +08:00
|
|
|
end
|
|
|
|
|
2013-07-31 03:50:49 +08:00
|
|
|
it "should require the terms if configured to do so" do
|
|
|
|
u1 = user_with_communication_channel(:user_state => 'creation_pending')
|
|
|
|
get "/register/#{u1.communication_channel.confirmation_code}"
|
2014-10-14 09:36:52 +08:00
|
|
|
expect(f('input[name="user[terms_of_use]"]')).to be_present
|
2013-07-31 03:50:49 +08:00
|
|
|
f('#registration_confirmation_form').submit
|
|
|
|
wait_for_ajaximations
|
|
|
|
assert_error_box 'input[name="user[terms_of_use]"]:visible'
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should not require the terms if the user has already accepted them" do
|
|
|
|
u1 = user_with_communication_channel(:user_state => 'creation_pending')
|
|
|
|
u1.preferences[:accepted_terms] = Time.now.utc
|
|
|
|
u1.save
|
|
|
|
get "/register/#{u1.communication_channel.confirmation_code}"
|
2014-10-14 09:36:52 +08:00
|
|
|
expect(f('input[name="user[terms_of_use]"]')).not_to be_present
|
2013-07-31 03:50:49 +08:00
|
|
|
end
|
|
|
|
|
2012-12-15 03:12:15 +08:00
|
|
|
it "should allow the user to edit the pseudonym if its already taken" do
|
2012-07-28 07:11:59 +08:00
|
|
|
u1 = user_with_communication_channel(:username => 'asdf@qwerty.com', :user_state => 'creation_pending')
|
2013-08-05 23:40:33 +08:00
|
|
|
u1.accept_terms
|
|
|
|
u1.save
|
2012-07-28 07:11:59 +08:00
|
|
|
# d'oh, now it's taken
|
|
|
|
u2 = user_with_pseudonym(:username => 'asdf@qwerty.com', :active_user => true)
|
|
|
|
|
|
|
|
get "/register/#{u1.communication_channel.confirmation_code}"
|
|
|
|
# they can set it...
|
|
|
|
input = f('#pseudonym_unique_id')
|
2014-10-14 09:36:52 +08:00
|
|
|
expect(input).to be_present
|
2012-07-28 07:11:59 +08:00
|
|
|
set_value input, "asdf@asdf.com"
|
|
|
|
set_value f('#pseudonym_password'), "asdfasdf"
|
|
|
|
expect_new_page_load {
|
|
|
|
f('#registration_confirmation_form').submit
|
|
|
|
}
|
|
|
|
|
2014-10-14 09:36:52 +08:00
|
|
|
expect(f('#identity .logout')).to be_present
|
2012-07-28 07:11:59 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|