示例#1
0
        private void HostTestPage(TestCommunity testCommunity, bool secure, string page)
        {
            var data      = testCommunity.GetCommunityTestData();
            var isDeleted = IsTestCommunityDeleted;
            var community = CreateTestCommunity(data, isDeleted);

            // Hit some pages.

            AssertDefaultAndProfilePages(null);

            // Hit the landing page.

            var url = GetCommunityHostUrl(community, secure, page);

            if (url == null)
            {
                return;
            }

            Get(url);

            if (isDeleted)
            {
                // Should have been redirected to the equivalent non-vertical url.

                var redirectUrl = string.IsNullOrEmpty(page)
                    ? new ReadOnlyApplicationUrl(false, "~/")
                    : new ReadOnlyApplicationUrl(page.EndsWith(".aspx"), "~/" + (page.EndsWith(".aspx") ? page.Substring(0, page.Length - ".aspx".Length) : page));
                AssertUrl(redirectUrl);

                // No branding.

                AssertHeader(null);
            }
            else
            {
                if (data.RequiresExternalLogin)
                {
                    AssertUrl(new ReadOnlyUrl(data.ExternalLoginUrl, new ReadOnlyQueryString("returnUrl", url.AbsoluteUri)));
                }
                else
                {
                    // Check no redirection.

                    AssertUrl(GetHostUrl(url, data.Host, false));

                    // Check the contents of the page.

                    AssertHeader(data.HeaderSnippet);
                }

                // Hit the pages again.

                AssertDefaultAndProfilePages(data);
            }
        }
示例#2
0
        public void TestCommunityMemberLoginNonCommunitySite()
        {
            // Create a community.

            CommunityTestData firstData = TestCommunity.Scouts.GetCommunityTestData();
            var community = firstData.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);

            // Create a member for the community.

            Member member = CreateMember(community, 0);

            // Go to the home page - branding should only appear when the user logs in.

            Get(HomeUrl);
            AssertUrl(HomeUrl);
            AssertNoHeader(firstData.HeaderSnippet);

            // Login.

            LogIn(member);
            AssertUrl(LoggedInMemberHomeUrl);
            AssertHeader(firstData.HeaderSnippet);

            // Logout, branding should stay.

            LogOut();
            AssertUrl(HomeUrl);
            AssertHeader(firstData.HeaderSnippet);

            // Create another community and member.

            const TestCommunity secondData = TestCommunity.Rcsa;

            community = secondData.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);
            member    = CreateMember(community, 1);

            // Go to the home page - branding should not change.

            Get(HomeUrl);
            AssertUrl(HomeUrl);
            AssertHeader(firstData.HeaderSnippet);

            // Login.

            LogIn(member);
            AssertUrl(LoggedInMemberHomeUrl);
            AssertHeader(firstData.HeaderSnippet);

            // Logout, branding should go away.

            LogOut();
            AssertUrl(HomeUrl);
            AssertHeader(firstData.HeaderSnippet);
        }
示例#3
0
        private void TestRequiresExternalLogin(TestCommunity testCommunity)
        {
            var data      = testCommunity.GetCommunityTestData();
            var isDeleted = IsTestCommunityDeleted;
            var community = CreateTestCommunity(data, isDeleted);

            // Only works with a host.

            var vertical = _verticalsCommand.GetVertical(community);

            if (string.IsNullOrEmpty(vertical.Host))
            {
                return;
            }

            var url = _verticalsCommand.GetCommunityHostUrl(community, "");

            Get(url);

            if (isDeleted)
            {
                // Should have been redirected to the equivalent non-vertical url.

                var redirectUrl = new ReadOnlyApplicationUrl("~/");
                AssertUrl(redirectUrl);
            }
            else
            {
                if (vertical.RequiresExternalLogin)
                {
                    // Should have been redirected.

                    AssertUrl(new ReadOnlyUrl(vertical.ExternalLoginUrl, new ReadOnlyQueryString("returnUrl", url.AbsoluteUri)));
                }
                else
                {
                    AssertUrl(url);
                }
            }
        }
示例#4
0
 public static Community CreateTestCommunity(this TestCommunity community, ICommunitiesCommand communitiesCommand, IVerticalsCommand verticalsCommand)
 {
     return(communitiesCommand.CreateTestCommunity(verticalsCommand, community.ToString()));
 }
示例#5
0
 public static CommunityTestData GetCommunityTestData(this TestCommunity community)
 {
     return(GetCommunityTestData(community.ToString()));
 }
示例#6
0
        private void TestJoinWithNewOrder(TestCommunity testCommunity, bool shouldBeJoined)
        {
            var data      = testCommunity.GetCommunityTestData();
            var community = data.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);

            // Hit the landing page.

            var url = _verticalsCommand.GetCommunityPathUrl(community, "employers/Employer.aspx");

            Get(url);

            // Choose.

            var host      = Browser.CurrentUrl.Host;
            var chooseUrl = GetChooseUrl().AsNonReadOnly();

            chooseUrl.Host = host;
            Get(chooseUrl);

            SelectContactProduct(_productsQuery.GetProduct("Contacts40"));
            _purchaseButton.Click();
            var instanceId = GetInstanceId();

            // Join.

            var accountUrl = GetAccountUrl(instanceId).AsNonReadOnly();

            accountUrl.Host = host;
            AssertUrl(accountUrl);

            _joinLoginIdTextBox.Text         = LoginId;
            _joinPasswordTextBox.Text        = Password;
            _joinConfirmPasswordTextBox.Text = Password;
            _firstNameTextBox.Text           = FirstName;
            _lastNameTextBox.Text            = LastName;
            _emailAddressTextBox.Text        = EmailAddress;
            _phoneNumberTextBox.Text         = PhoneNumber;
            _organisationNameTextBox.Text    = OrganisationName;
            _locationTextBox.Text            = Location;
            _acceptTermsCheckBox.IsChecked   = true;
            _joinButton.Click();

            // Payment.

            var paymentUrl = GetPaymentUrl(instanceId).AsNonReadOnly();

            paymentUrl.Host = host;
            AssertUrl(paymentUrl);

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

            // Receipt.

            var receiptUrl = GetReceiptUrl(instanceId).AsNonReadOnly();

            receiptUrl.Host = host;
            AssertUrl(receiptUrl);

            AssertCommunity(community, LoginId, shouldBeJoined);
        }
示例#7
0
 private void CreateCommunity(TestCommunity community)
 {
     CreateCommunity(community.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine));
 }
示例#8
0
        private Vertical CreateVertical(TestCommunity testCommunity)
        {
            var community = testCommunity.CreateTestCommunity(_communitiesCommand, _verticalsCommand, _contentEngine);

            return(_verticalsCommand.GetVertical(community));
        }