예제 #1
0
        public void OneEmailMemberTest()
        {
            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var campaign      = CreateCampaign(administrator);
            var member        = _memberAccountsCommand.CreateTestMember(0);

            // Login as administrator.

            LogIn(administrator);

            // Send.

            Get(GetEditTemplateUrl(campaign.Id));
            _emailAddressesTextBox.Text = member.EmailAddresses[0].Address;
            _sendButton.Click();

            // Check.

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(Return, Return, new EmailRecipient(member.EmailAddresses[0].Address, member.FullName));
            email.AssertSubject(GetSubject(member));
            Assert.IsTrue(email.GetHtmlView().Body.Contains(HtmlBody));
            Assert.IsTrue(email.GetPlainTextView().Body.Contains(TextBody));
        }
예제 #2
0
        public void TestPageVisibility()
        {
            // Assert that you have to be logged on to access the page.

            AssertSecureUrl(_activationSentUrl, LogInUrl);

            // LogIn.

            var member = _memberAccountsCommand.CreateTestMember(0, false);

            LogIn(member);

            // Resend an activation.

            AssertUrl(_notActivatedUrl);
            _resendActivationEmailButton.Click();

            // Assert that the verification email sent form is shown and that controls are visible.

            AssertUrl(_activationSentUrl);
            Assert.IsTrue(_changeEmailAddressLink.IsVisible);

            // Assert the email is sent.

            _emailServer.AssertEmailSent();
        }
예제 #3
0
        public void DeleteTest()
        {
            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var campaign1     = CreateCampaign(1, administrator);
            var campaign2     = CreateCampaign(2, administrator);

            // Login as administrator.

            LogIn(administrator);

            // Navigate to index page.

            Get(GetCampaignsUrl());
            AssertPageContains(campaign1.Name);
            AssertPageContains(campaign2.Name);

            // Go to the delete page.

            Get(GetDeleteCampaignUrl(campaign1.Id));
            AssertPageContains("Are you sure you want to delete the '" + campaign1.Name + "' campaign?");
            _deleteButton.Click();

            AssertUrl(GetCampaignsUrl());
            AssertPageDoesNotContain(campaign1.Name);
            AssertPageContains(campaign2.Name);
        }
예제 #4
0
        public void TestPageVisibility()
        {
            // Assert that you have to be logged on to access the page.

            AssertSecureUrl(_verificationSentUrl, LogInUrl);

            // LogIn.

            var member = _memberAccountsCommand.CreateTestMember(0, true);

            _emailVerificationsCommand.UnverifyEmailAddress(member.EmailAddresses[0].Address, null);
            LogIn(member);

            // Resend a verification.

            AssertUrlWithoutQuery(_notVerifiedUrl);
            _resendVerificationEmailButton.Click();

            // Assert that the verification email sent form is shown and that controls are visible.

            AssertUrlWithoutQuery(_verificationSentUrl);
            Assert.IsTrue(_changeEmailAddressLink.IsVisible);

            _emailServer.AssertEmailSent();
        }
        private void TestEditPersonalVisibility(Member member)
        {
            LogIn(member);
            GetPage <VisibilitySettingsBasic>();

            Assert.AreEqual(PersonalVisibilitySettings.ModerateFirstDegree, member.VisibilitySettings.Personal.FirstDegreeVisibility);
            Assert.AreEqual(PersonalVisibilitySettings.ModerateSecondDegree, member.VisibilitySettings.Personal.SecondDegreeVisibility);
            Assert.AreEqual(PersonalVisibilitySettings.ModeratePublic, member.VisibilitySettings.Personal.PublicVisibility);

            Assert.IsTrue(_moderatelyVisibleButton.IsChecked);
            Assert.IsFalse(_highlyVisibleButton.IsChecked);

            _highlyVisibleButton.IsChecked = true;
            _saveButton.Click();

            GetPage <VisibilitySettingsBasic>();
            AssertPage <VisibilitySettingsBasic>();

            member = _membersQuery.GetMember(member.Id);
            Assert.AreEqual(PersonalVisibilitySettings.HighFirstDegree, member.VisibilitySettings.Personal.FirstDegreeVisibility);
            Assert.AreEqual(PersonalVisibilitySettings.HighSecondDegree, member.VisibilitySettings.Personal.SecondDegreeVisibility);
            Assert.AreEqual(PersonalVisibilitySettings.HighPublic, member.VisibilitySettings.Personal.PublicVisibility);

            Assert.IsFalse(_moderatelyVisibleButton.IsChecked);
            Assert.IsTrue(_highlyVisibleButton.IsChecked);
        }
예제 #6
0
        public void TestSearchLogIn()
        {
            var employer = CreateEmployer();
            var member   = CreateMember(0);

            // Do an anonymous search.

            Get(GetSearchUrl());
            _keywordsTextBox.Text = BusinessAnalyst;
            _searchButton.Click();
            AssertMembers(member);

            // Look for the login overlay link and follow it.

            var node = Browser.CurrentHtml.DocumentNode.SelectSingleNode("//a[@id='login-overlay-login']");

            Assert.AreEqual("Log in", node.InnerText);
            Get(new ReadOnlyApplicationUrl(node.Attributes["href"].Value));

            // Should be on the login page.

            AssertPath(_loginUrl);
            _loginIdTextBox.Text  = employer.GetLoginId();
            _passwordTextBox.Text = employer.GetPassword();
            _loginButton.Click();

            // Should be on the current search page with the same member.

            AssertPath(GetResultsUrl());
            AssertMembers(member);
        }
예제 #7
0
        public void TestDeactivate()
        {
            var member = _memberAccountsCommand.CreateTestMember(1);

            LogIn(member);
            Get(_deactivateUrl);

            // Deactivate.

            _employerRadioButton.IsChecked = true;
            _commentsTextBox.Text          = "I am done.";
            _deactivateButton.Click();

            // Assert that the user is logged out.

            AssertNotLoggedIn();

            // Assert that their status has been updated.

            var updatedMember = _membersQuery.GetMember(member.Id);

            Assert.IsNotNull(updatedMember);
            Assert.IsTrue(updatedMember.IsEnabled);
            Assert.IsTrue(!updatedMember.IsActivated);

            // Try to log in again.

            LogIn(member);
            AssertUrl(_notActivatedUrl);

            // Try to get to the settings page.

            Get(_settingsUrl);
            AssertUrlWithoutQuery(_notActivatedUrl);
        }
예제 #8
0
        public void TestRemoveRepresentative()
        {
            var       member = _memberAccountsCommand.CreateTestMember(0);
            Member    friend;
            Candidate candidate;
            Resume    resume;

            CreateFriend(member.Id, out friend, out candidate, out resume);
            _representativesCommand.CreateRepresentative(member.Id, friend.Id);
            Assert.IsNotNull(_representativesQuery.GetRepresentativeId(member.Id));

            // Log in.

            LogIn(member);
            GetPage <ViewFriend>(ViewFriend.FriendIdParameter, friend.Id.ToString());

            // Check text is visible and delete.

            AssertPageContains(friend.FirstName + " is my nominated representative.");
            _btnRemoveRepresentative.Click();

            AssertPage <ViewFriend>();
            AssertPageDoesNotContain(friend.FirstName + " is my nominated representative.");
            Assert.IsFalse(_lnkRemoveRepresentative.IsVisible);
            Assert.IsFalse(_btnRemoveRepresentative.IsVisible);

            Assert.IsNull(_representativesQuery.GetRepresentativeId(member.Id));
        }
예제 #9
0
        public void TestEmployerUpdate()
        {
            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var organisation  = _organisationsCommand.CreateTestVerifiedOrganisation(1);

            LogIn(administrator);
            var url = GetCommunicationsUrl(organisation);

            Get(url);

            // Turn it off.

            _employerUpdateCheckBox.IsChecked = false;
            _saveButton.Click();

            AssertCategory("EmployerUpdate", Frequency.Never, _settingsQuery.GetSettings(organisation.Id));
            Assert.AreEqual(false, _employerUpdateCheckBox.IsChecked);

            // Turn it on again.

            _employerUpdateCheckBox.IsChecked = true;
            _saveButton.Click();

            AssertCategory("EmployerUpdate", Frequency.Immediately, _settingsQuery.GetSettings(organisation.Id));
            Assert.AreEqual(true, _employerUpdateCheckBox.IsChecked);
        }
예제 #10
0
        private void OneEmailTest()
        {
            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var campaign      = CreateCampaign(administrator);
            var employer      = _employerAccountsCommand.CreateTestEmployer(0, _organisationsCommand.CreateTestOrganisation(0));

            // Login as administrator.

            LogIn(administrator);

            // Send.

            Get(GetEditTemplateUrl(campaign.Id));
            _emailAddressesTextBox.Text = employer.EmailAddress.Address;
            _sendButton.Click();

            // Check.

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(Return, Return, new EmailRecipient(employer.EmailAddress.Address, employer.FullName));
            email.AssertSubject(Subject);
            Assert.IsTrue(email.GetHtmlView().Body.Contains(HtmlBody));
            Assert.IsTrue(email.GetPlainTextView().Body.Contains(TextBody));
        }
예제 #11
0
        public void TestVerifiedParentOrganisation()
        {
            // Create the organisation and employer.

            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var parent        = _organisationsCommand.CreateTestVerifiedOrganisation(1, null, administrator.Id);
            var child         = _organisationsCommand.CreateTestVerifiedOrganisation(2, parent, administrator.Id);

            // Create some employers.

            var childEmployers  = CreateEmployers(0, 5, child);
            var parentEmployers = CreateEmployers(5, 4, parent);

            // Search for the organisation.

            LogIn(administrator);

            // Check parent.

            Get(GetEmployersUrl(parent));
            AssertEmployers(parentEmployers);
            Assert.IsTrue(_includeChildOrganisationsCheckBox.IsVisible);
            Assert.IsTrue(_searchButton.IsVisible);
            Assert.AreEqual(false, _includeChildOrganisationsCheckBox.IsChecked);

            _searchButton.Click();
            AssertEmployers(parentEmployers);
            Assert.IsTrue(_includeChildOrganisationsCheckBox.IsVisible);
            Assert.IsTrue(_searchButton.IsVisible);
            Assert.AreEqual(false, _includeChildOrganisationsCheckBox.IsChecked);

            _includeChildOrganisationsCheckBox.IsChecked = true;
            _searchButton.Click();
            AssertEmployers(parentEmployers.Concat(childEmployers).ToArray());
            Assert.IsTrue(_includeChildOrganisationsCheckBox.IsVisible);
            Assert.IsTrue(_searchButton.IsVisible);
            Assert.AreEqual(true, _includeChildOrganisationsCheckBox.IsChecked);

            // Check child.

            Get(GetEmployersUrl(child));
            AssertEmployers(childEmployers);
            Assert.IsTrue(_includeChildOrganisationsCheckBox.IsVisible);
            Assert.IsTrue(_searchButton.IsVisible);
            Assert.AreEqual(false, _includeChildOrganisationsCheckBox.IsChecked);

            _searchButton.Click();
            AssertEmployers(childEmployers);
            Assert.IsTrue(_includeChildOrganisationsCheckBox.IsVisible);
            Assert.IsTrue(_searchButton.IsVisible);
            Assert.AreEqual(false, _includeChildOrganisationsCheckBox.IsChecked);

            _includeChildOrganisationsCheckBox.IsChecked = true;
            _searchButton.Click();
            AssertEmployers(childEmployers);
            Assert.IsTrue(_includeChildOrganisationsCheckBox.IsVisible);
            Assert.IsTrue(_searchButton.IsVisible);
            Assert.AreEqual(true, _includeChildOrganisationsCheckBox.IsChecked);
        }
예제 #12
0
        public void TestAddCredits()
        {
            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var organisation  = _organisationsCommand.CreateTestVerifiedOrganisation(1, null, administrator.Id);

            LogIn(administrator);
            Get(GetCreditsUrl(organisation));

            // Add some.

            Credit   credit      = _creditsQuery.GetCredit <ContactCredit>();
            var      allocations = new List <Allocation>();
            int?     quantity    = null;
            DateTime?expiryDate  = null;

            _creditIdDropDownList.SelectedIndex = 1;
            _addButton.Click();

            allocations.Add(new Allocation {
                CreditId = credit.Id, InitialQuantity = quantity, ExpiryDate = expiryDate
            });
            AssertAllocations(organisation.Id, allocations);

            // Add more.

            credit     = _creditsQuery.GetCredit <JobAdCredit>();
            quantity   = 20;
            expiryDate = DateTime.Now.Date.AddYears(1);

            _creditIdDropDownList.SelectedValue = credit.Id.ToString();
            _quantityTextBox.Text   = quantity.ToString();
            _expiryDateTextBox.Text = expiryDate.Value.ToString("dd/MM/yyyy");
            _addButton.Click();

            allocations.Add(new Allocation {
                CreditId = credit.Id, RemainingQuantity = quantity, ExpiryDate = expiryDate
            });
            AssertAllocations(organisation.Id, allocations);

            // Add more.

            credit     = _creditsQuery.GetCredit <ApplicantCredit>();
            quantity   = null;
            expiryDate = DateTime.Now.Date.AddYears(1);

            _creditIdDropDownList.SelectedValue = credit.Id.ToString();
            _quantityTextBox.Text   = string.Empty;
            _expiryDateTextBox.Text = expiryDate.Value.ToString("dd/MM/yyyy");
            _addButton.Click();

            allocations.Add(new Allocation {
                CreditId = credit.Id, RemainingQuantity = quantity, ExpiryDate = expiryDate
            });
            AssertAllocations(organisation.Id, allocations);
        }
예제 #13
0
        public void JoinTest()
        {
            // LogIn.

            var member = _memberAccountsCommand.CreateTestMember(0);

            LogIn(member);

            // Browse to the invite contacts form.

            GetPage <InviteFriends>();
            AssertPage <InviteFriends>();

            // Send an invitation.

            _txtEmailAddresses.Text = Email;
            _btnSendInvitations.Click();
            AssertPage <InviteFriends>();
            LogOut();

            // Check that an email was sent.

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(member, Return, Email);
            email.AssertHtmlViewContains(member.FullName + " has sent you a request to join their personal network.");
            var url = Get(email.GetHtmlView().Body);

            // Navigate to the join page.

            Get(url);
            AssertUrlWithoutQuery(_joinUrl);

            // Join.

            Browser.Submit(_joinFormId);
            EnterDetails(Email, FirstName, LastName);
            Browser.Submit(_personalDetailsFormId);

            // No email should have been sent to the user, but one should have been sent to the inviter.

            email = _emailServer.AssertEmailSent();
            email.AssertAddresses(Return, Return, member);

            // Continue.

            _maleRadioButton.IsChecked = true;
            _dateOfBirthMonthDropDownList.SelectedIndex = 1;
            _dateOfBirthYearDropDownList.SelectedIndex  = 1;
            Browser.Submit(_jobDetailsFormId);

            // Check that the user has been sent to the welcome form.

            AssertUrl(_profileUrl);
        }
예제 #14
0
        protected void AnswerQuestions(int visaValue, string phoneNumberValue, string mobileValue, int availabilityValue, int salaryValue)
        {
            Assert.IsFalse(_questionsCoverLetterTextBox.IsVisible);

            _visaDropDownList.SelectedValue         = visaValue;
            _phoneNumberTextBox.Text                = phoneNumberValue;
            _mobileTextBox.Text                     = mobileValue;
            _availabilityDropDownList.SelectedValue = availabilityValue;
            _salaryDropDownList.SelectedValue       = salaryValue;
            _sendButton.Click();
        }
예제 #15
0
        public void TestConvert()
        {
            var vertical = CreateVertical();

            CreateMember(EmailAddress, FirstName, LastName, JobTitle, JobCompany, vertical.Id, true, ExternalId);

            // Check initial member.

            var member = _membersQuery.GetMember(EmailAddress);

            AssertMember(EmailAddress, FirstName, LastName, vertical.Id, true, true, member);
            Assert.IsNull(_membersQuery.GetMember(NewEmailAddress));
            Assert.IsNull(_loginCredentialsQuery.GetCredentials(member.Id));
            AssertCredentials(vertical.Id, ExternalId, _externalCredentialsQuery.GetCredentials(member.Id, vertical.Id));

            var reclaimUrl = GetConvertUrl(vertical.Url);

            Get(reclaimUrl);
            AssertUrl(reclaimUrl);
            _emailAddressTextBox.Text    = EmailAddress;
            _firstNameTextBox.Text       = FirstName;
            _lastNameTextBox.Text        = LastName;
            _jobTitleTextBox.Text        = JobTitle;
            _jobCompanyTextBox.Text      = JobCompany;
            _newEmailAddressTextBox.Text = NewEmailAddress;
            _passwordTextBox.Text        = NewPassword;
            _confirmPasswordTextBox.Text = NewPassword;
            _saveButton.Click();
            AssertUrl(GetConvertedUrl(vertical.Url));
            AssertPageContains("account has been converted into a full LinkMe account");

            // Check member.

            Assert.IsNull(_membersQuery.GetMember(EmailAddress));
            member = _membersQuery.GetMember(NewEmailAddress);
            AssertMember(NewEmailAddress, FirstName, LastName, null, true, false, member);
            AssertCredentials(NewEmailAddress, false, true, _loginCredentialsQuery.GetCredentials(member.Id));
            Assert.IsNull(_externalCredentialsQuery.GetCredentials(member.Id, vertical.Id));

            // Activation email should have been sent.

            var email = _emailServer.AssertEmailSent();

            email.AssertAddresses(Return, Return, member);
            var url = GetLink(email.GetHtmlView().Body);

            Get(url);
            AssertUrlWithoutQuery(_activationUrl);
            SubmitLogIn(member.EmailAddresses[0].Address, NewPassword);

            AssertUrl(_profileUrl);
        }
예제 #16
0
        public void TestBackForMember()
        {
            // Go to the sign in and request a new password.

            Get(_loginUrl);
            _forgotPasswordLink.Click();
            AssertPath(_newPasswordUrl);

            // Go back.

            _cancelButton.Click();
            AssertUrl(HomeUrl);
        }
예제 #17
0
        public void TestErrors()
        {
            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var organisation  = _organisationsCommand.CreateTestVerifiedOrganisation(1, null, administrator.Id);

            // Get the page.

            LogIn(administrator);
            var url = GetNewEmployerUrl(organisation);

            Get(url);

            Assert.AreEqual(string.Empty, _loginIdTextBox.Text);
            Assert.AreEqual(string.Empty, _passwordTextBox.Text);
            Assert.AreEqual(string.Empty, _emailAddressTextBox.Text);
            Assert.AreEqual(string.Empty, _firstNameTextBox.Text);
            Assert.AreEqual(string.Empty, _lastNameTextBox.Text);
            Assert.AreEqual(string.Empty, _phoneNumberTextBox.Text);
            Assert.AreEqual(string.Empty, _jobTitleTextBox.Text);
            Assert.AreEqual(string.Empty, _industryIdDropDownList.SelectedItem.Text);

            // Nothing filled in.

            _createButton.Click();

            AssertErrorMessages(
                "The username is required.",
                "The password is required.",
                "The email address is required.",
                "The first name is required.",
                "The last name is required.",
                "The phone number is required.");

            // Bad values.

            _loginIdTextBox.Text      = new string('a', 350);
            _passwordTextBox.Text     = "a";
            _emailAddressTextBox.Text = "sdffsdf";
            _firstNameTextBox.Text    = "%$^&^*()";
            _lastNameTextBox.Text     = "%$&$*&(&";
            _phoneNumberTextBox.Text  = "%$&*()&*()";
            _createButton.Click();

            AssertErrorMessages(
                "The username must be no more than 320 characters in length.",
                "The password must be between 6 and 50 characters in length.",
                "The email address must be valid and have less than 320 characters.",
                "The first name must be between 2 and 30 characters in length and not have any invalid characters.",
                "The last name must be between 2 and 30 characters in length and not have any invalid characters.",
                "The phone number must be between 8 and 20 characters in length and not have any invalid characters.");
        }
예제 #18
0
        public void TestChangePassword()
        {
            // Create the employer.

            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var employer      = _employerAccountsCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(0));

            LogIn(administrator);
            Get(GetEmployerUrl(employer));

            // Change the password.

            _changePasswordTextBox.Text = NewPassword;
            _changeButton.Click();
            AssertConfirmationMessage("The password has been reset.");

            // Check the user details.

            AssertVisibility(employer);
            AssertEmployer(employer, employer.GetLoginId());
            _emailServer.AssertNoEmailSent();

            // Check the user login.

            LogOut();
            LogIn(employer);
            AssertNotLoggedIn();

            LogIn(employer, NewPassword);
            AssertUrlWithoutQuery(_mustChangePasswordUrl);

            // Change password.

            _passwordTextBox.Text           = NewPassword;
            _newPasswordTextBox.Text        = NewNewPassword;
            _confirmNewPasswordTextBox.Text = NewNewPassword;
            _saveButton.Click();
            AssertUrlWithoutQuery(LoggedInEmployerHomeUrl);

            // Check the user login.

            LogOut();
            LogIn(employer);
            AssertNotLoggedIn();

            LogIn(employer, NewPassword);
            AssertNotLoggedIn();

            LogIn(employer, NewNewPassword);
            AssertUrl(LoggedInEmployerHomeUrl);
        }
예제 #19
0
        public void TestLoginIdLinkedInProfile()
        {
            var employer = CreateEmployer(0);

            _linkedInCommand.UpdateProfile(new LinkedInProfile {
                Id = LinkedInId, UserId = employer.Id
            });

            LogIn(employer);
            Get(_settingsUrl);
            AssertLinkedInProfile(employer.GetLoginId(), false, true);

            // Try to update.

            _useLinkedInProfileCheckBox.IsChecked = false;
            _saveButton.Click();
            AssertUrlWithoutQuery(LoggedInEmployerHomeUrl);

            // Assert profile.

            Assert.IsNull(_linkedInQuery.GetProfile(LinkedInId));
            Assert.IsNull(_linkedInQuery.GetProfile(employer.Id));

            Get(_settingsUrl);
            AssertNoLinkedInProfile(employer.GetLoginId());
        }
예제 #20
0
        public void TestLoggedInFeaturePack1()
        {
            var credits  = GetEmployerCredits();
            var employer = CreateEmployer(credits);

            LogIn(employer);

            // Job ad.

            Get(GetJobAdUrl(null));

            AssertJobAdPage(true);

            _titleTextBox.Text   = DefaultTitle;
            _contentTextBox.Text = DefaultContent;
            _industryIdsListBox.SelectedValues = new[] { _accounting.Id.ToString() };
            _fullTimeCheckBox.IsChecked        = true;
            _locationTextBox.Text = DefaultLocation;

            // Preview.

            _previewButton.Click();

            var jobAdId = AssertJobAd(employer.Id, JobAdStatus.Draft, JobAdFeatures.None).Id;

            AssertPreviewPage(jobAdId, true, credits);

            // Publish.

            _featurePack1.IsChecked = true;
            _publishButton.Click();

            AssertJobAd(employer.Id, JobAdStatus.Draft, JobAdFeatures.None);
            AssertPaymentPage(jobAdId, JobAdFeaturePack.FeaturePack1);

            // Pay.

            _cardNumberTextBox.Text                = CreditCardNumber;
            _cvvTextBox.Text                       = Cvv;
            _cardHolderNameTextBox.Text            = CardHolderName;
            _authoriseCreditCardCheckBox.IsChecked = true;
            _purchaseButton.Click();

            var jobAd = AssertJobAd(employer.Id, JobAdStatus.Open, JobAdFeatures.Logo | JobAdFeatures.ExtendedExpiry);
            var order = AssertOrder(employer.Id, JobAdFeaturePack.FeaturePack1);

            AssertReceiptPage(jobAd, order);

            _emailServer.AssertNoEmailSent();
        }
예제 #21
0
        private void TestInvite(IRegisteredUser inviter, IMember invitee)
        {
            Assert.IsNull(_memberContactsQuery.GetRepresentativeContact(inviter.Id));
            Assert.AreEqual(0, _memberContactsQuery.GetRepresenteeContacts(invitee.Id).Count);

            LogIn(inviter);

            // Invite.

            GetPage <RepresentativePopupContents>(
                RepresentativePopupContents.InviteeIdParameter, invitee.Id.ToString(),
                RepresentativePopupContents.SendInvitationParameter, "true",
                RepresentativePopupContents.MessageParameter, Message);

            GetPage <ViewRepresentative>();
            AssertNoRepresentative();

            GetPage <Invitations>();
            AssertPageContains(invitee.FullName);

            AssertInvitation(inviter.Id, invitee.Id, Message);

            // Accept.

            LogOut();
            LogIn(invitee);

            GetPage <Invitations>();
            AssertPageContains(inviter.FullName);
            AssertPageContains("has asked you to be their representative");

            _btnAccept.Click();
            AssertPage <Invitations>();
            var url = NavigationManager.GetUrlForPage <ViewFriend>(ViewFriend.FriendIdParameter, inviter.Id.ToString());

            AssertPageContains(string.Format("You are now <a href=\"{0}\">{1}</a>{2} representative.", url.PathAndQuery, inviter.FullName, inviter.FullName.GetNamePossessiveSuffix()), true);

            Assert.IsNull(_memberFriendsQuery.GetRepresentativeInvitation(inviter.Id, invitee.Id));
            Assert.IsNull(_memberFriendsQuery.GetRepresentativeInvitationByInviter(inviter.Id));
            Assert.AreEqual(0, _memberFriendsQuery.GetRepresentativeInvitations(invitee.Id, invitee.GetBestEmailAddress().Address).Count);

            Assert.AreEqual(invitee.Id, _memberContactsQuery.GetRepresentativeContact(inviter.Id));
            Assert.AreEqual(1, _memberContactsQuery.GetRepresenteeContacts(invitee.Id).Count);
            Assert.AreEqual(inviter.Id, _memberContactsQuery.GetRepresenteeContacts(invitee.Id)[0]);

            // Should also be friends.

            Assert.AreEqual(true, _memberContactsQuery.AreFirstDegreeContacts(inviter.Id, invitee.Id));
        }
예제 #22
0
        public void TestInvalidPassword()
        {
            var member         = _memberAccountsCommand.CreateTestMember(0, false);
            var activationCode = Activate(member);

            // Verify with an invalid password.

            _passwordTextBox.Text = "invalidPassword";
            _loginButton.Click();

            // Assert that the appropriate error message is shown.

            AssertPath(GetActivationUrl(activationCode));
            AssertPageContains("Login failed. Please try again.");
        }
예제 #23
0
        public void TestChangeEmailAddress()
        {
            // LogIn.

            var member = _memberAccountsCommand.CreateTestMember(0, true);

            _emailVerificationsCommand.UnverifyEmailAddress(member.EmailAddresses[0].Address, null);
            LogIn(member);

            // Resend a verification.

            AssertUrlWithoutQuery(_notVerifiedUrl);
            _resendVerificationEmailButton.Click();

            // Change email.

            AssertUrlWithoutQuery(_verificationSentUrl);
            _changeEmailAddressLink.Click();

            // Assert that the user was redirected to the appropriate page.

            var changeEmailUrl = _changeEmailUrl.AsNonReadOnly();

            changeEmailUrl.QueryString["returnUrl"] = _verificationSentUrl.PathAndQuery;
            AssertUrl(changeEmailUrl);

            // Assert that selecting the cancel button returns the browser to this form.

            Assert.IsTrue(_cancelButton.IsVisible);
            _cancelButton.Click();
            AssertUrl(_verificationSentUrl);
        }
예제 #24
0
        public void TestChangePassword()
        {
            // Create the custodian.

            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);

            var community = CreateCommunity();
            var custodian = _custodianAccountsCommand.CreateTestCustodian(2, community.Id);

            LogIn(administrator);
            Get(GetCustodianUrl(custodian));

            // Change the password.

            _passwordTextBox.Text = NewPassword;
            _changeButton.Click();
            AssertConfirmationMessage("The password has been reset.");

            // Check the user details.

            AssertVisibility(custodian);
            AssertCustodian(custodian);

            // Check the user login.

            LogOut();
            LogIn(custodian);
            AssertNotLoggedIn();

            LogIn(custodian, NewPassword);
            AssertUrl(LoggedInCustodianHomeUrl);
        }
예제 #25
0
        public void TestDisable()
        {
            // Create the custodian.

            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);

            var community = CreateCommunity();
            var custodian = _custodianAccountsCommand.CreateTestCustodian(2, community.Id);

            LogIn(administrator);
            Get(GetCustodianUrl(custodian));

            // Disable the custodian.

            _disableButton.Click();

            // Check the user details.

            custodian.IsEnabled = false;
            AssertVisibility(custodian);
            AssertCustodian(custodian);

            // Check the user login.

            LogOut();
            LogIn(custodian);
            AssertPath(_contactUsUrl);
        }
예제 #26
0
        public void TestEnable()
        {
            // Create the employer.

            var administrator = _administratorAccountsCommand.CreateTestAdministrator(1);
            var employer      = _employerAccountsCommand.CreateTestEmployer(1, _organisationsCommand.CreateTestOrganisation(0));

            employer.IsEnabled = false;
            _employerAccountsCommand.UpdateEmployer(employer);

            LogIn(employer);
            AssertPath(_contactUsUrl);

            LogIn(administrator);
            Get(GetEmployerUrl(employer));

            // Enable the User.

            _enableButton.Click();

            // Check the user details.

            employer.IsEnabled = true;
            AssertVisibility(employer);
            AssertEmployer(employer, employer.GetLoginId());

            // Check the user login.

            LogOut();
            LogIn(employer);
            AssertUrl(LoggedInEmployerHomeUrl);
        }
예제 #27
0
        public void TestChangeBadPassword()
        {
            // Create the administrator.

            var administrator1 = _administratorAccountsCommand.CreateTestAdministrator(1);
            var administrator2 = _administratorAccountsCommand.CreateTestAdministrator(2);

            LogIn(administrator1);
            Get(GetAdministratorUrl(administrator2));

            // Change the password.

            _passwordTextBox.Text = BadPassword;
            _changeButton.Click();
            AssertErrorMessage("The password must be between 8 and 50 characters in length and not have any invalid characters.");
        }
예제 #28
0
        public void TestChangeEmailAddress()
        {
            // LogIn.

            var member = _memberAccountsCommand.CreateTestMember(0, false);

            LogIn(member);

            // Change email.

            AssertUrl(_notActivatedUrl);
            _changeEmailAddressLink.Click();

            // Assert that the user was redirected to the appropriate page.

            var changeEmailUrl = _changeEmailUrl.AsNonReadOnly();

            changeEmailUrl.QueryString["returnUrl"] = _notActivatedUrl.PathAndQuery;
            AssertUrl(changeEmailUrl);

            // Assert that selecting the cancel button returns the browser to this form.

            Assert.IsTrue(_cancelButton.IsVisible);
            _cancelButton.Click();
            AssertUrl(_notActivatedUrl);
        }
예제 #29
0
        public void TestEnable()
        {
            // Create the administrator.

            var administrator1 = _administratorAccountsCommand.CreateTestAdministrator(1);
            var administrator2 = _administratorAccountsCommand.CreateTestAdministrator(2);

            administrator2.IsEnabled = false;
            _administratorAccountsCommand.UpdateAdministrator(administrator2);

            LogIn(administrator2);
            AssertPath(_contactUsUrl);

            LogIn(administrator1);
            Get(GetAdministratorUrl(administrator2));

            // Enable the User.

            _enableButton.Click();

            // Check the user details.

            administrator2.IsEnabled = true;
            AssertVisibility(administrator2);
            AssertAdministrator(administrator2);

            // Check the user login.

            LogOut();
            LogIn(administrator2);
            AssertUrl(LoggedInAdministratorHomeUrl);
        }
예제 #30
0
        public void TestAnonymousAccess()
        {
            // Create employer.

            var employer = CreateEmployer();

            // Access anonymously.

            var foldersUrl = GetFoldersUrl();

            Get(foldersUrl);

            // Should be redirected.

            var loginUrl = _loginUrl.AsNonReadOnly();

            loginUrl.QueryString["returnUrl"] = foldersUrl.PathAndQuery;
            AssertUrl(loginUrl);

            // Log in.

            _loginIdTextBox.Text  = employer.GetLoginId();
            _passwordTextBox.Text = employer.GetPassword();
            _loginButton.Click();

            AssertUrl(foldersUrl);
        }