Ejemplo n.º 1
0
        public void US519_AC2_AC3_MarketingPreferences(bool allowEmailMarketing, bool allowSmsMarketing)
        {
            var viewModel = new SettingsViewModelBuilder().SmsEnabled(true).AllowEmailMarketing(allowEmailMarketing).AllowSmsMarketing(allowSmsMarketing).Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var allowEmailMarketingCheckBox = result.GetElementbyId("AllowEmailMarketing");
            var allowSmsMarketingCheckBox   = result.GetElementbyId("AllowSmsMarketing");

            allowEmailMarketingCheckBox.Should().NotBeNull();
            allowSmsMarketingCheckBox.Should().NotBeNull();

            allowEmailMarketingCheckBox.ParentNode.InnerText.Should().Be("Email");
            allowSmsMarketingCheckBox.ParentNode.InnerText.Should().Be("Text");

            if (allowEmailMarketing)
            {
                allowEmailMarketingCheckBox.Attributes["checked"].Should().NotBeNull();
            }
            else
            {
                allowEmailMarketingCheckBox.Attributes["checked"].Should().BeNull();
            }

            if (allowSmsMarketing)
            {
                allowSmsMarketingCheckBox.Attributes["checked"].Should().NotBeNull();
            }
            else
            {
                allowSmsMarketingCheckBox.Attributes["checked"].Should().BeNull();
            }
        }
        public void OneSavedSearchWithSubCategories()
        {
            const string subCategoriesFullName = "Surveying, Construction Civil Engineering";
            var          savedSearchViewModels = new Fixture().Build <SavedSearchViewModel>()
                                                 .With(s => s.ApprenticeshipLevel, "All")
                                                 .With(s => s.SubCategoriesFullNames, subCategoriesFullName)
                                                 .CreateMany(1).ToList();
            var viewModel = new SettingsViewModelBuilder().WithSavedSearchViewModels(savedSearchViewModels).Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var savedSearchesDiv = result.GetElementbyId("savedSearches");

            savedSearchesDiv.Should().NotBeNull();

            var savedSearchElement = savedSearchesDiv.ChildNodes.First(n => n.Name == "div");

            savedSearchElement.Should().NotBeNull();

            var savedSearchPropertyList = savedSearchElement.ChildNodes.First(n => n.Name == "ul");
            var savedSearchProperties   = savedSearchPropertyList.ChildNodes.Where(n => n.Name == "li").ToList();

            savedSearchProperties.Count.Should().Be(3);

            savedSearchProperties[0].InnerText.Should().Be(string.Format("Sub-categories: {0}", subCategoriesFullName));
        }
        public void US616_AC2_AC3_CommunicationPreferences(bool allowEmailComms, bool allowSmsComms)
        {
            var viewModel = new SettingsViewModelBuilder().SmsEnabled(true).AllowEmailComms(allowEmailComms).AllowSmsComms(allowSmsComms).Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var allowEmailCommsCheckBox = result.GetElementbyId("AllowEmailComms");
            var allowSmsCommsCheckBox   = result.GetElementbyId("AllowSmsComms");

            allowEmailCommsCheckBox.Should().NotBeNull();
            allowSmsCommsCheckBox.Should().NotBeNull();

            allowEmailCommsCheckBox.ParentNode.InnerText.Should().Be("Email");
            allowSmsCommsCheckBox.ParentNode.InnerText.Should().Be("Text");

            if (allowEmailComms)
            {
                allowEmailCommsCheckBox.Attributes["checked"].Should().NotBeNull();
            }
            else
            {
                allowEmailCommsCheckBox.Attributes["checked"].Should().BeNull();
            }

            if (allowSmsComms)
            {
                allowSmsCommsCheckBox.Attributes["checked"].Should().NotBeNull();
            }
            else
            {
                allowSmsCommsCheckBox.Attributes["checked"].Should().BeNull();
            }
        }
        public void OneSavedSearch(string apprenticeshipLevel, bool alertEnabled)
        {
            const string name                  = "Within 5 miles of CV1 2WT";
            const string searchUrl             = "/apprenticeships?Location=CV1%202WT&LocationType=NonNational&ApprenticeshipLevel=All&SearchField=All&SearchMode=Keyword&Hash=0&WithinDistance=5&SortType=Relevancy&PageNumber=1&SearchAction=Search&ResultsPerPage=5";
            var          savedSearchViewModels = new Fixture().Build <SavedSearchViewModel>()
                                                 .With(s => s.Name, name)
                                                 .With(s => s.SearchUrl, new Url(searchUrl))
                                                 .With(s => s.AlertsEnabled, alertEnabled)
                                                 .With(s => s.ApprenticeshipLevel, apprenticeshipLevel)
                                                 .With(s => s.SubCategoriesFullNames, string.Empty)
                                                 .CreateMany(1).ToList();
            var viewModel = new SettingsViewModelBuilder().WithSavedSearchViewModels(savedSearchViewModels).Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var savedSearchDiv = result.GetElementbyId("savedSearch");

            savedSearchDiv.Should().NotBeNull();
            var savedSearchesHeading = result.GetElementbyId("savedSearchHeading");

            savedSearchesHeading.Should().NotBeNull();

            var noSavedSearchesText = result.GetElementbyId("noSavedSearchesText");

            noSavedSearchesText.Should().NotBeNull();
            noSavedSearchesText.GetAttributeValue("style", string.Empty).Should().Be("display: none");
            var savedSearchesDiv = result.GetElementbyId("savedSearches");

            savedSearchesDiv.Should().NotBeNull();

            var savedSearchElement = savedSearchesDiv.ChildNodes.First(n => n.Name == "div");

            savedSearchElement.Should().NotBeNull();

            var link = savedSearchElement.ChildNodes.First(n => n.Name == "a");

            link.GetAttributeValue("href", string.Empty).Should().Be(searchUrl);
            link.InnerText.Should().Be(name);

            //Last alert span should not be present
            var lastAlertSpanPresent = savedSearchElement.ChildNodes.All(n => n.Name != "span");

            lastAlertSpanPresent.Should().BeFalse();

            var savedSearchPropertyList = savedSearchElement.ChildNodes.First(n => n.Name == "ul");
            var savedSearchProperties   = savedSearchPropertyList.ChildNodes.Where(n => n.Name == "li").ToList();

            var shouldShowLevel = apprenticeshipLevel != "All";

            savedSearchProperties.Count.Should().Be(shouldShowLevel ? 3 : 2);

            if (shouldShowLevel)
            {
                savedSearchProperties[0].InnerText.Should().Be(string.Format("Apprenticeship level: {0}", apprenticeshipLevel));
            }

            savedSearchProperties.Last().ChildNodes.First(n => n.Name == "a").InnerText.Should().Contain("Delete saved search");
        }
Ejemplo n.º 5
0
        public void DeleteAccountContainer()
        {
            var viewModel = new SettingsViewModelBuilder().Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var savedSearchesHeading = result.GetElementbyId("deleteAccountHeading");

            savedSearchesHeading.Should().NotBeNull();
            savedSearchesHeading.InnerText.Should().Contain("Delete your account");
        }
        public void US616_EmailRadioButtonsRemoved()
        {
            var viewModel = new SettingsViewModelBuilder().SmsEnabled(true).Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var allowEmailCommsRadioButtonYes = result.GetElementbyId("AllowEmailComms-yes");
            var allowEmailCommsRadioButtonNo  = result.GetElementbyId("AllowEmailComms-no");

            allowEmailCommsRadioButtonYes.Should().BeNull();
            allowEmailCommsRadioButtonNo.Should().BeNull();
        }
        public void ShouldRenderTextCommunicationPreferences(
            bool enableApplicationStatusChangeAlertsViaText,
            bool enableExpiringApplicationAlertsViaText,
            bool enableMarketingViaText)
        {
            var viewModel = new SettingsViewModelBuilder()
                            .SmsEnabled(true)
                            .EnableApplicationStatusChangeAlertsViaText(enableApplicationStatusChangeAlertsViaText)
                            .EnableExpiringApplicationAlertsViaText(enableExpiringApplicationAlertsViaText)
                            .EnableMarketingViaText(enableMarketingViaText)
                            .Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var enableApplicationStatusChangeAlertsViaTextCheckbox = result.GetElementbyId("EnableApplicationStatusChangeAlertsViaText");
            var enableExpiringApplicationAlertsViaTextCheckbox     = result.GetElementbyId("EnableExpiringApplicationAlertsViaText");
            var enableMarketingViaTextCheckbox = result.GetElementbyId("EnableMarketingViaText");

            enableApplicationStatusChangeAlertsViaTextCheckbox.Should().NotBeNull();
            enableExpiringApplicationAlertsViaTextCheckbox.Should().NotBeNull();
            enableMarketingViaTextCheckbox.Should().NotBeNull();

            enableApplicationStatusChangeAlertsViaTextCheckbox.ParentNode.InnerText.Should().Be(string.Empty);
            enableExpiringApplicationAlertsViaTextCheckbox.ParentNode.InnerText.Should().Be(string.Empty);
            enableMarketingViaTextCheckbox.ParentNode.InnerText.Should().Be(string.Empty);

            if (enableApplicationStatusChangeAlertsViaText)
            {
                enableApplicationStatusChangeAlertsViaTextCheckbox.Attributes["checked"].Should().NotBeNull();
            }
            else
            {
                enableApplicationStatusChangeAlertsViaTextCheckbox.Attributes["checked"].Should().BeNull();
            }

            if (enableExpiringApplicationAlertsViaText)
            {
                enableExpiringApplicationAlertsViaTextCheckbox.Attributes["checked"].Should().NotBeNull();
            }
            else
            {
                enableExpiringApplicationAlertsViaTextCheckbox.Attributes["checked"].Should().BeNull();
            }

            if (enableMarketingViaText)
            {
                enableMarketingViaTextCheckbox.Attributes["checked"].Should().NotBeNull();
            }
            else
            {
                enableMarketingViaTextCheckbox.Attributes["checked"].Should().BeNull();
            }
        }
        public void SavedSearchContainer()
        {
            var viewModel = new SettingsViewModelBuilder().Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var savedSearchDiv = result.GetElementbyId("savedSearch");

            savedSearchDiv.Should().NotBeNull();
            var savedSearchesHeading = result.GetElementbyId("savedSearchHeading");

            savedSearchesHeading.Should().NotBeNull();
            savedSearchesHeading.InnerText.Should().Contain("Saved searches");
        }
        public void MultipleSavedSearches(int savedSearchCount)
        {
            var savedSearchViewModels = new Fixture().Build <SavedSearchViewModel>().CreateMany(savedSearchCount).ToList();
            var viewModel             = new SettingsViewModelBuilder().WithSavedSearchViewModels(savedSearchViewModels).Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var savedSearchesDiv = result.GetElementbyId("savedSearches");

            savedSearchesDiv.Should().NotBeNull();

            var savedSearchElements = savedSearchesDiv.ChildNodes.Where(n => n.Name == "div").ToList();

            savedSearchElements.Count.Should().Be(savedSearchCount);
        }
Ejemplo n.º 10
0
        public void ShowFindTraineeshipLink(bool shouldShow)
        {
            var viewModel = new SettingsViewModelBuilder().ShowTraineeshipsLink(shouldShow).ShowTraineeshipsPrompt(false).Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var findTraineeshipLink = result.GetElementbyId("find-traineeship-link");

            if (shouldShow)
            {
                findTraineeshipLink.Should().NotBeNull();
            }
            else
            {
                findTraineeshipLink.Should().BeNull();
            }
        }
        public void US616_AC4_PhoneVerifiedIndication(bool verifiedMobile)
        {
            var viewModel = new SettingsViewModelBuilder().VerifiedMobile(verifiedMobile).Build();
            var result    = new SettingsViewBuilder().With(viewModel).Render();

            var allowEmailCommsCheckBox = result.GetElementbyId("verifyContainer");

            if (verifiedMobile)
            {
                allowEmailCommsCheckBox.Should().NotBeNull();
                allowEmailCommsCheckBox.ChildNodes["span"].InnerText.Should().Be("Verified");
            }
            else
            {
                allowEmailCommsCheckBox.Should().BeNull();
            }
        }
        public void OneSavedSearchWithDateProcessed()
        {
            var savedSearchViewModels = new Fixture().Build <SavedSearchViewModel>()
                                        .With(s => s.DateProcessed, DateTime.UtcNow)
                                        .CreateMany(1).ToList();
            var viewModel = new SettingsViewModelBuilder().WithSavedSearchViewModels(savedSearchViewModels).Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var savedSearchesDiv = result.GetElementbyId("savedSearches");

            savedSearchesDiv.Should().NotBeNull();

            var savedSearchElement = savedSearchesDiv.ChildNodes.First(n => n.Name == "div");

            savedSearchElement.Should().NotBeNull();

            var lastAlertSpan = savedSearchElement.ChildNodes.First(n => n.Name == "span");

            lastAlertSpan.InnerText.Should().Be("(Last alert: today)");
        }
        public void NoSavedSearches()
        {
            var viewModel = new SettingsViewModelBuilder().Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var savedSearchDiv = result.GetElementbyId("savedSearch");

            savedSearchDiv.Should().NotBeNull();
            var savedSearchesHeading = result.GetElementbyId("savedSearchHeading");

            savedSearchesHeading.Should().NotBeNull();

            var noSavedSearchesText = result.GetElementbyId("noSavedSearchesText");

            noSavedSearchesText.Should().NotBeNull();
            noSavedSearchesText.Attributes.Any(a => a.Name == "style").Should().BeFalse();
            noSavedSearchesText.InnerText.Should().Contain("You currently don't have any active saved searches");
            var savedSearchesDiv = result.GetElementbyId("savedSearches");

            savedSearchesDiv.Should().BeNull();
        }
Ejemplo n.º 14
0
        public void SmsEnabledFeatureToggle(bool smsEnabled)
        {
            var viewModel = new SettingsViewModelBuilder().SmsEnabled(smsEnabled).Build();

            var result = new SettingsViewBuilder().With(viewModel).Render();

            var allowEmailMarketingCheckBox = result.GetElementbyId("AllowEmailMarketing");
            var allowSmsMarketingCheckBox   = result.GetElementbyId("AllowSmsMarketing");

            allowEmailMarketingCheckBox.Should().NotBeNull();
            allowEmailMarketingCheckBox.ParentNode.InnerText.Should().Be("Email");

            if (smsEnabled)
            {
                allowSmsMarketingCheckBox.Should().NotBeNull();
                allowSmsMarketingCheckBox.ParentNode.InnerText.Should().Be("Text");
            }
            else
            {
                allowSmsMarketingCheckBox.Should().BeNull();
            }
        }