public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);
            ServerOperationsFeather.DynamicModules().EnsureModuleIsImported(ModuleName, ModuleResource);

            Guid pageId = ServerOperations.Pages().CreatePage(PageName);

            ServerOperations.Taxonomies().CreateCategory(TaxonTitle + "0");

            for (int i = 1; i < 7; i++)
            {
                ServerOperations.Taxonomies().CreateCategory(TaxonTitle + i, TaxonTitle + (i - 1));
                var category = TaxonomyManager.GetManager().GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == TaxonTitle + i);
                ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticle(ItemsTitle + (i - 1), ItemsTitle + i + "Url", Guid.Empty, category.Id);
            }

            ServerOperationsFeather.Pages().AddDynamicWidgetToPage(pageId, "Telerik.Sitefinity.DynamicTypes.Model.PressRelease.PressArticle", "PressArticle", "Press Articles MVC");
        }
        public void SetUp()
        {
            var fields = new FormFieldType[]
            {
                FormFieldType.Captcha,
                FormFieldType.SubmitButton
            };

            var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(fields, FormName);

            var templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(PageName, templateId);
            var pageId = ServerOperations.Pages().GetPageId(PageName);

            ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId);
            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(pageId, "Test content", "Contentplaceholder1");
        }
        public void DynamicWidgetsDesignerContent_VerifyAllFunctionality()
        {
            this.pageOperations = new PagesOperations();
            string testName          = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix    = testName + "DynamicPage";
            string pageTitlePrefix   = testName + "Dynamic Page";
            string urlNamePrefix     = testName + "dynamic-page";
            int    index             = 1;
            string url               = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index);
            var    dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

            try
            {
                for (int i = 0; i < this.dynamicTitles.Length; i++)
                {
                    ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(this.dynamicTitles[i], this.dynamicUrls[i]);
                }

                dynamicCollection = ServerOperationsFeather.DynamicModulePressArticle().RetrieveCollectionOfPressArticles();

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType   = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SelectionMode = SelectionMode.AllItems;
                mvcProxy.Settings   = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, index);

                string responseContent = PageInvoker.ExecuteWebRequest(url);

                for (int i = 0; i < this.dynamicTitles.Length; i++)
                {
                    Assert.IsTrue(responseContent.Contains(this.dynamicTitles[i]), "The dynamic item with this title was not found!");
                }
            }
            finally
            {
                this.pageOperations.DeletePages();
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Taxonomies().DeleteTags(this.tagTitle);
            }
        }
        public void DynamicWidgetsAllTypes_VerifyAllFieldsOnTheFrontendWhereSomeFieldsAreEmpty()
        {
            this.pageOperations = new PagesOperations();
            string testName          = System.Reflection.MethodInfo.GetCurrentMethod().Name;
            string pageNamePrefix    = testName + "DynamicPage";
            string pageTitlePrefix   = testName + "Dynamic Page";
            string urlNamePrefix     = testName + "dynamic-page";
            int    index             = 1;
            string url               = UrlPath.ResolveAbsoluteUrl("~/" + urlNamePrefix + index);
            var    dynamicCollection = ServerOperationsFeather.DynamicModuleAllTypes().RetrieveCollectionOfAllFields();

            try
            {
                ServerOperationsFeather.DynamicModuleAllTypes().CreateFieldWithTitle(this.dynamicTitles, this.dynamicUrls);

                dynamicCollection = ServerOperationsFeather.DynamicModuleAllTypes().RetrieveCollectionOfAllFields();

                var mvcProxy = new MvcWidgetProxy();
                mvcProxy.ControllerName = typeof(DynamicContentController).FullName;
                var dynamicController = new DynamicContentController();
                dynamicController.Model.ContentType   = TypeResolutionService.ResolveType(ResolveType);
                dynamicController.Model.SelectionMode = SelectionMode.AllItems;
                dynamicController.Model.ProviderName  = FeatherWidgets.TestUtilities.CommonOperations.DynamicModulesOperations.ProviderName;
                mvcProxy.Settings   = new ControllerSettings(dynamicController);
                mvcProxy.WidgetName = WidgetName;

                this.pageOperations.CreatePageWithControl(mvcProxy, pageNamePrefix, pageTitlePrefix, urlNamePrefix, index);

                string responseContent = PageInvoker.ExecuteWebRequest(url);

                Assert.IsTrue(responseContent.Contains(this.dynamicTitles), "The dynamic item with this title was not found!");

                string detailNewsUrl         = url + dynamicCollection[0].ItemDefaultUrl;
                string detailResponseContent = PageInvoker.ExecuteWebRequest(detailNewsUrl);

                Assert.IsTrue(detailResponseContent.Contains(this.dynamicTitles), "The title was not found!");
            }
            finally
            {
                this.pageOperations.DeletePages();
                ServerOperationsFeather.DynamicModulePressArticle().DeleteDynamicItems(dynamicCollection);
            }
        }
Esempio n. 5
0
        public void SetUp()
        {
            Guid pageId = ServerOperations.Pages().CreatePage(PageName);
            var  blogId = ServerOperations.Blogs().CreateBlog(BlogTitle);

            for (int i = 1; i < 6; i++)
            {
                ServerOperations.Blogs().CreatePublishedBlogPost(PostTitle + i, blogId);
            }

            var blogId1 = ServerOperations.Blogs().CreateBlog(BlogTitle1);

            for (int j = 1; j < 3; j++)
            {
                ServerOperations.Blogs().CreatePublishedBlogPost(PostTitle1 + j, blogId1);
            }

            ServerOperationsFeather.Pages().AddBlogPostsWidgetToPage(pageId, "Body");
        }
Esempio n. 6
0
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(this.AdminEmail, this.AdminPass, true);

            Guid templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);
            Guid pageId     = ServerOperations.Pages().CreatePage(PageName, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddProfileWidgetToPage(pageId, PlaceHolderId);

            var page2Id = ServerOperations.Pages().CreatePage(SpeciallPage);

            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(page2Id, ContentBlockText);

            ServerOperations.Users().CreateUserWithProfileAndRoles(NewUserEmail, NewUserPassword, NewUserFirstName, NewUserLastName, new List <string> {
                "BackendUsers", "Administrators"
            });
            AuthenticationHelper.LogoutUser(this.AdminEmail);
        }
        public void SetUp()
        {
            Guid page1Id = ServerOperations.Pages().CreatePage(PageName);

            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(page1Id);

            var parentId    = ServerOperations.Videos().CreateLibrary(VideoLibraryTitle);
            var childId     = ServerOperations.Videos().CreateFolder(ChildLibraryTitle, parentId);
            var nextChildId = ServerOperations.Videos().CreateFolder(NextChildLibraryTitle, childId);

            ServerOperations.Videos().Upload(VideoLibraryTitle, VideoTitle + 1, VideoResource);
            ServerOperationsFeather.MediaOperations().UploadVideoInFolder(childId, VideoTitle + 2, VideoResourceChild);
            ServerOperations.Users().CreateUserWithProfileAndRoles(this.AdninistratorEmail, "password", "Administrator", "User", new List <string> {
                "BackendUsers", "Administrators"
            });

            AuthenticationHelper.AuthenticateUser(this.AdninistratorEmail, "password", true);
            ServerOperationsFeather.MediaOperations().UploadVideoInFolder(nextChildId, VideoTitle + 3, VideoResourceNextChild);
        }
Esempio n. 8
0
        public void DynamicWidgets_ContentLocationService_SingleItemSelectedFromWidget()
        {
            int expectedLocationsCount;

            try
            {
                for (int i = 1; i <= 3; i++)
                {
                    ServerOperationsFeather.DynamicModuleBooking().CreateCountry(CountryName + i.ToString(CultureInfo.InvariantCulture));
                }

                Type countryType = TypeResolutionService.ResolveType(ResolveTypeCountry);

                DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();
                var countryItemId = dynamicModuleManager.GetDataItems(countryType).Where("Title = \"" + CountryName + "1\"").First().Id;

                string[] itemIds = new string[] { countryItemId.ToString() };

                var pageId = ServerOperations.Pages().CreatePage(PageName);

                var countriesWidget = this.CreateMvcWidget(ResolveTypeCountry, WidgetNameCountries, itemIds);
                var controls        = new List <System.Web.UI.Control>();
                controls.Add(countriesWidget);

                PageContentGenerator.AddControlsToPage(pageId, controls);

                var locationsService     = SystemManager.GetContentLocationService();
                var dynamicItemLocations = locationsService.GetItemLocations(countryType, dynamicModuleManager.Provider.Name, countryItemId);

                expectedLocationsCount = 1;

                Assert.AreEqual(expectedLocationsCount, dynamicItemLocations.Count(), "Unexpected locations count");
            }
            finally
            {
                ServerOperations.Pages().DeleteAllPages();

                for (int i = 1; i <= 3; i++)
                {
                    ServerOperationsFeather.DynamicModuleBooking().DeleteCountry(CountryName + i.ToString(CultureInfo.InvariantCulture));
                }
            }
        }
        private PageNode CreatePageOnTemplateWithCustomWigdet(out Guid templateId)
        {
            var templateName = "TestTemplate1";

            templateId = ServerOperationsFeather.TemplateOperations().DuplicatePageTemplate(PageTemplateName, templateName);
            var customWidget = new MvcControllerProxy();

            customWidget.ControllerName = typeof(TestController).FullName;
            customWidget.Settings       = new ControllerSettings(new TestController());
            ServerOperationsFeather.TemplateOperations().AddControlToTemplate(templateId, customWidget, "Contentplaceholder1", typeof(TestController).Name);

            var pageTitle   = "TestPage1";
            var pageId      = ServerOperations.Pages().CreatePage(pageTitle, templateId);
            var pageNodeId  = ServerOperations.Pages().GetPageNodeId(pageId);
            var pageManager = Telerik.Sitefinity.Modules.Pages.PageManager.GetManager();
            var pageNode    = pageManager.GetPageNode(pageNodeId);

            return(pageNode);
        }
Esempio n. 10
0
        public void SetUp()
        {
            Guid pageId = ServerOperations.Pages().CreatePage(PageName);

            for (int i = 1; i < 4; i++)
            {
                ServerOperations.Taxonomies().CreateCategory(this.categoryTitle + i);
            }

            ServerOperationsFeather.NewsOperations().CreatePublishedNewsItem(NewsTitle + 1, NewsContent, AuthorName, SourceName, new List <string> {
                this.categoryTitle + 1
            }, null, null);
            ServerOperationsFeather.NewsOperations().CreatePublishedNewsItem(NewsTitle + 2, NewsContent, AuthorName, SourceName, new List <string> {
                this.categoryTitle + 2
            }, null, null);
            ServerOperationsFeather.NewsOperations().CreatePublishedNewsItem(NewsTitle + 3, NewsContent, AuthorName, SourceName, null, null, null);
            ServerOperationsFeather.Pages().AddNewsWidgetToPage(pageId);
            ServerOperationsFeather.Pages().AddCategoriesWidgetToPage(pageId);
        }
Esempio n. 11
0
        public void TearDown()
        {
            ServerOperations.Pages().DeleteAllPages();
            var providerName = string.Empty;

            if (ServerOperations.MultiSite().CheckIsMultisiteMode())
            {
                providerName = "dynamicContentProvider";
            }

            ServerOperationsFeather.DynamicModulePressArticle().DeleteAllDynamicItemsInProvider(providerName);

            for (int i = 0; i < 4; i++)
            {
                ServerOperations.Taxonomies().DeleteCategories(this.taxonTitleDynamic + i, this.taxonTitleNews + i);
            }

            ServerOperations.News().DeleteAllNews();
        }
        public void SetUp()
        {
            Guid listPageId = ServerOperations.Pages().CreatePage(PageName);

            ServerOperationsFeather.Pages().AddUsersListWidgetToPage(listPageId);

            ServerOperations.Users().CreateUserWithProfileAndRoles(AuthorUserName, AuthorPassword, AuthorFirstName, AuthorLastName, AuthorEmail, new List <string> {
                "BackendUsers", "Authors"
            });
            ServerOperations.Users().CreateUserWithProfileAndRoles(AuthorUserName1, AuthorPassword1, AuthorFirstName1, AuthorLastName1, AuthorEmail1, new List <string> {
                "BackendUsers", "Authors"
            });
            ServerOperations.Users().CreateUserWithProfileAndRoles(EditorUserName, EditorPassword, EditorFirstName, EditorLastName, EditorEmail, new List <string> {
                "BackendUsers", "Editors"
            });
            ServerOperations.Users().CreateUserWithProfileAndRoles(AdministratorUserName1, AdministratorPassword1, AdministratorFirstName1, AdministratorLastName1, AdministratorEmail1, new List <string> {
                "BackendUsers", "Administrators"
            });
        }
Esempio n. 13
0
        public void CheckboxesFieldTests_SubmitIncorrectValue_ServerValidationFails()
        {
            var controller = new CheckboxesFieldController();

            controller.Model.ValidatorDefinition.Required = true;

            var control = new MvcWidgetProxy();

            control.ControllerName = typeof(CheckboxesFieldController).FullName;
            control.Settings       = new ControllerSettings(controller);

            var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control);

            var formManager = FormsManager.GetManager();
            var form        = formManager.GetForms().FirstOrDefault(f => f.Id == formId);

            var pageManager = PageManager.GetManager();

            try
            {
                var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default");
                Assert.IsNotNull(template, "Template was not found");

                var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "CheckboxesFieldValidationTest", "checkboxes-field-validation-test");
                ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId);

                var checkboxesFieldName = ServerOperationsFeather.Forms().GetFirstFieldName(formManager, form);
                var result        = ServerOperationsFeather.Forms().SubmitField(checkboxesFieldName, string.Empty, pageManager, pageId);
                var contentResult = result as ViewResult;
                Assert.IsNotNull(contentResult, "Submit should return content result.");
                Assert.AreEqual(Res.Get <FormResources>().UnsuccessfullySubmittedMessage, contentResult.ViewBag.SubmitMessage, "The Submit didn't result in error as expected!");
                Assert.AreEqual("Form.SubmitResultView", contentResult.ViewName);

                var formEntry = formManager.GetFormEntries(form).LastOrDefault();
                Assert.IsNull(formEntry, "Form entry has been submitted even when the form is not valid.");
            }
            finally
            {
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();
                FormsModuleCodeSnippets.DeleteForm(formId);
            }
        }
        public void SetUp()
        {
            Guid templateId      = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);
            Guid pageIdSubscribe = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageName, templateId);

            pageIdSubscribe = ServerOperations.Pages().GetPageNodeId(pageIdSubscribe);
            ServerOperationsFeather.Pages().AddSubscribeFormWidgetToPage(pageIdSubscribe, PlaceHolderId);

            Guid mailingListId = Guid.NewGuid();
            Guid subscriberId  = Guid.NewGuid();

            ServerOperations.NewsLetter().CreateMailingList(mailingListId, MailingList, string.Empty, string.Empty, string.Empty);
            ServerOperations.NewsLetter().CreateSubscriber(subscriberId, SubscriberFirstName, SubscriberLastName, SubscriberEmail);
            ServerOperations.NewsLetter().AddSubscriberToMailingList(subscriberId, mailingListId);

            Guid pageId = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(FirstPageName, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(pageId, ContentBlockContent, PlaceHolderId);
        }
        public void SetUp()
        {
            ServerOperations.Comments().AllowComments(ThreadType, true);

            // Use the following line once the Sitefinity is updated to 9.0.
            // Telerik.Sitefinity.TestUtilities.Services.Notifications.NotificationsTestHelper.ResetDummySmtpSenderData(profileName: SubscribeUserForCommentsNotificationAndVerifyReceivedEmail.NotificationsProfileName);
            NotificationsTestHelper.ResetDummySmtpSenderData(profileName: SubscribeUserForCommentsNotificationAndVerifyReceivedEmail.NotificationsProfileName);

            ServerOperations.Comments().SetCommentsNotificationProfile(SubscribeUserForCommentsNotificationAndVerifyReceivedEmail.NotificationsProfileName);

            Guid templateId = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);
            Guid pageId     = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageName, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddCommentsWidgetToPage(pageId, "Contentplaceholder1");
            var groupKey = ServerOperations.Comments().GetCurrentSiteId.ToString();

            ServerOperations.Comments().CreateComment(groupKey, ThreadType, pageId, PageName, CommentToPage, "published", false);
            ServerOperations.Comments().EnableEmailSubscription(ThreadType, true);
        }
Esempio n. 16
0
        public void SetUp()
        {
            Guid pageId = ServerOperations.Pages().CreatePage(PageName);
            var  tags   = new List <string> {
                "Tag1", "Tag2"
            };
            int index = 1;

            foreach (var tg in tags)
            {
                ServerOperations.Taxonomies().CreateTag(tg);
                var tag = new List <string> {
                    tg
                };
                ServerOperationsFeather.NewsOperations().CreatePublishedNewsItem(NewsTitle + index, NewsContent, "AuthorName", "SourceName", null, tag, null);
                index++;
            }

            ServerOperationsFeather.Pages().AddNewsWidgetToPage(pageId);
        }
Esempio n. 17
0
        public void OnBeforeTestsStarts()
        {
            var  templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);
            Guid pageId     = ServerOperations.Pages().CreatePage(PageTitle, templateId);
            var  pageNodeId = ServerOperations.Pages().GetPageNodeId(pageId);

            ServerOperationsFeather.Pages().AddCalendarWidgetToPage(pageNodeId, PlaceHolderId);

            var difference       = this.event1EndTime - this.event1StartTime;
            var occurancesCount1 = difference.TotalDays;
            int occurancesCount  = (int)occurancesCount1;

            ServerOperations.Events().CreateDailyRecurrentEvent(Event1Title, string.Empty, this.event1StartTime, this.event1EndTime, 60, occurancesCount, 1, TimeZoneInfo.Local.Id);
            var event1Item = EventsManager.GetManager().GetEvents().Where <Event>(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live &&
                                                                                  ni.Title == Event1Title).FirstOrDefault();

            ServerArrangementContext.GetCurrent().Values.Add("event1Id", event1Item.Id.ToString());

            ServerArrangementContext.GetCurrent().Values.Add("timezoneId", TimeZoneInfo.Utc.ToString());
        }
Esempio n. 18
0
        public void OnBeforeTestsStarts()
        {
            var  templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);
            Guid pageId     = ServerOperations.Pages().CreatePage(PageTitle, templateId);
            var  pageNodeId = ServerOperations.Pages().GetPageNodeId(pageId);

            ServerOperationsFeather.Pages().AddCalendarWidgetToPage(pageNodeId, PlaceHolderId);

            var еventStartTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0, DateTimeKind.Utc);
            var еventEndTime   = DateTime.Now.AddYears(5);

            ServerOperations.Events().CreаteAllDayRecurrentEvent(Event1Title, string.Empty, еventStartTime, еventEndTime, 1440, this.occurenceCount, 1, true);
            var event1Item = EventsManager.GetManager().GetEvents().Where <Event>(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live &&
                                                                                  ni.Title == Event1Title).FirstOrDefault();

            ServerArrangementContext.GetCurrent().Values.Add("event1Id", event1Item.Id.ToString());
            var еventExpectedStartTime = this.FormatTime(еventStartTime);

            ServerArrangementContext.GetCurrent().Values.Add("еventStartTime", еventExpectedStartTime);
        }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);
            ServerOperationsFeather.DynamicModules().EnsureModuleIsImported(ModuleName, ModuleResource);
            Guid templateId = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().GetTemplateIdByTitle(BootstrapTemplate);
            Guid pageId     = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageName, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);
            ServerOperationsFeather.Pages().AddNewsWidgetToPage(pageId, PlaceHolderId);
            ServerOperationsFeather.Pages().AddDynamicWidgetToPage(pageId, "Telerik.Sitefinity.DynamicTypes.Model.PressRelease.PressArticle", "PressArticle", "Press Articles MVC", PlaceHolderId);

            var pageId1 = ServerOperations.Pages().CreatePage(PageTitle);

            ServerOperationsFeather.Pages().AddNewsWidgetToPage(pageId1);
            ServerOperationsFeather.Pages().AddDynamicWidgetToPage(pageId1, "Telerik.Sitefinity.DynamicTypes.Model.PressRelease.PressArticle", "PressArticle", "Press Articles MVC");

            ServerOperations.News().CreatePublishedNewsItem(NewsTitle1, NewsContent1, null);
            ServerOperations.News().CreatePublishedNewsItem(NewsTitle2, NewsContent2, null);
            ServerOperationsFeather.DynamicModulePressArticle().CreatePressArticleItem(ItemTitle, ItemTitle + "Url");
        }
Esempio n. 20
0
        public void ParagraphTextField_SubmitValue_ResponseIsCorrect()
        {
            const string SubmitedParagraphValue = "Submitted paragraph value";

            var controller = new ParagraphTextFieldController();

            var control = new MvcWidgetProxy();

            control.Settings       = new ControllerSettings(controller);
            control.ControllerName = typeof(ParagraphTextFieldController).FullName;

            var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control);

            var formManager = FormsManager.GetManager();
            var form        = formManager.GetForms().FirstOrDefault(f => f.Id == formId);

            var pageManager = PageManager.GetManager();

            try
            {
                var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default");
                Assert.IsNotNull(template, "Template was not found");

                var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "ParagraphTextFieldValueTest", "paragraph-text-field-submit-value-test");
                ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId);

                var paragraphTextFieldName = ServerOperationsFeather.Forms().GetFirstFieldName(formManager, form);
                ServerOperationsFeather.Forms().SubmitField(paragraphTextFieldName, SubmitedParagraphValue, pageManager, pageId);

                var formEntry = formManager.GetFormEntries(form).LastOrDefault();
                Assert.IsNotNull(formEntry, "Form entry has not been submitted.");

                var submittedValue = formEntry.GetValue(paragraphTextFieldName) as string;
                Assert.AreEqual(SubmitedParagraphValue, submittedValue, "Form did not persisted the submitted paragraph text value correctly.");
            }
            finally
            {
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();
                FormsModuleCodeSnippets.DeleteForm(formId);
            }
        }
        public void NewsWidget_SelectByCategoryNewsFunctionality()
        {
            int    newsCount      = 4;
            string newsTitle      = "Title";
            string categoryTitle  = "Category ";
            var    newsController = new NewsController();

            string[] categoryTitles = new string[newsCount + 1];

            try
            {
                this.serverOperationsTaxonomies.CreateCategory(categoryTitle + "0");

                for (int i = 0; i <= newsCount; i++)
                {
                    categoryTitles[i] = categoryTitle + i;
                    this.serverOperationsTaxonomies.CreateCategory(categoryTitle + (i + 1), categoryTitle + i);
                    ServerOperationsFeather.NewsOperations().CreatePublishedNewsItem(NewsTitle + i, "Content", "AuthorName", "SourceName", new List <string> {
                        categoryTitle + i
                    }, null, null);
                }

                TaxonomyManager taxonomyManager = TaxonomyManager.GetManager();

                for (int i = 0; i < newsCount; i++)
                {
                    var    category = taxonomyManager.GetTaxa <HierarchicalTaxon>().SingleOrDefault(t => t.Title == categoryTitle + i);
                    ITaxon taxonomy = taxonomyManager.GetTaxon(category.Id);
                    var    items    = newsController.Model.CreateListViewModel(taxonomy, 1).Items.ToArray();

                    for (int j = 0; j < items.Length; j++)
                    {
                        Assert.IsTrue(items[j].Fields.Title.Equals(newsTitle + i, StringComparison.CurrentCulture), "The news with this title was not found!");
                    }
                }
            }
            finally
            {
                this.serverOperationsTaxonomies.DeleteCategories(categoryTitles);
            }
        }
Esempio n. 22
0
        public void SetUp()
        {
            Guid templateId = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);
            Guid pageId     = Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().CreatePage(PageName, templateId);

            pageId = ServerOperations.Pages().GetPageNodeId(pageId);

            ServerOperationsFeather.Pages().AddProfileWidgetToPage(pageId, PlaceHolderId);
            ServerOperationsFeather.Pages().AddJavaScriptWidgetToPage(pageId, PlaceHolderId);

            string folderPath = Path.Combine(ServerOperationsFeather.TemplateOperations().SfPath, "JavaScriptTest");

            if (!Directory.Exists(folderPath))
            {
                Directory.CreateDirectory(folderPath);
            }

            string filePath = Path.Combine(folderPath, FileName);

            ServerOperationsFeather.DynamicModules().AddNewResource(JavaScriptFileResource, filePath);
        }
Esempio n. 23
0
        public void OnBeforeTestsStarts()
        {
            var  templateId = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);
            Guid pageId     = ServerOperations.Pages().CreatePage(PageTitle, templateId);
            var  pageNodeId = ServerOperations.Pages().GetPageNodeId(pageId);

            ServerOperationsFeather.Pages().AddCalendarWidgetToPage(pageNodeId, PlaceHolderId);

            var event1End = this.event1Start.AddDays(5);

            ServerOperations.Events().CreаteAllDayRecurrentEvent(Event1Title, string.Empty, this.event1Start, event1End, 1440, 5, 1, true);
            var event1Item = EventsManager.GetManager().GetEvents().Where <Event>(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live &&
                                                                                  ni.Title == Event1Title).FirstOrDefault();

            ServerArrangementContext.GetCurrent().Values.Add("event1Id", event1Item.Id.ToString());
            var еventExpectedStartTime = this.FormatTime(this.event1Start);

            ServerArrangementContext.GetCurrent().Values.Add("еventStartTime", еventExpectedStartTime);

            ServerArrangementContext.GetCurrent().Values.Add("timezoneId", TimeZoneInfo.Utc.ToString());
        }
        public void SetUp()
        {
            AuthenticationHelper.AuthenticateUser(AdminUserName, AdminPass, true);
            Guid page1Id = ServerOperations.Pages().CreatePage(PageName);

            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(page1Id);

            var parentId    = ServerSideUpload.CreateDocumentLibrary(DocumentLibraryTitle);
            var childId     = ServerSideUpload.CreateFolder(ChildLibraryTitle, parentId);
            var nextChildId = ServerSideUpload.CreateFolder(NextChildLibraryTitle, childId);

            ServerSideUpload.UploadDocument(DocumentLibraryTitle, DocumentTitle + 1, DocumentResource);
            ServerOperationsFeather.MediaOperations().UploadDocumentInFolder(childId, DocumentTitle + 2, DocumentResourceChild);

            ServerOperations.Users().CreateUserWithProfileAndRoles("administrator", "password", "Administrator", "User", "*****@*****.**", new List <string> {
                "BackendUsers", "Administrators"
            });

            AuthenticationHelper.AuthenticateUser("administrator", "password", true);
            ServerOperationsFeather.MediaOperations().UploadDocumentInFolder(nextChildId, DocumentTitle + 3, DocumentResourceNextChild);
        }
Esempio n. 25
0
        public void SetUp()
        {
            Guid page1Id = ServerOperations.Pages().CreatePage(PageName);

            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(page1Id);

            var parentId    = ServerSideUpload.CreateAlbum(ImageLibraryTitle);
            var childId     = ServerSideUpload.CreateFolder(ChildLibraryTitle, parentId);
            var nextChildId = ServerSideUpload.CreateFolder(NextChildLibraryTitle, childId);

            ServerSideUpload.UploadImage(ImageLibraryTitle, ImageTitle + 1, ImageResource);

            ServerSideUpload.UploadImageInFolder(childId, ImageTitle + 2, ImageResourceChild);

            ServerOperations.Users().CreateUserWithProfileAndRoles("administrator", "password", "Administrator", "User", "*****@*****.**", new List <string> {
                "BackendUsers", "Administrators"
            });

            AuthenticationHelper.AuthenticateUser("administrator", "password", true);
            ServerSideUpload.UploadImageInFolder(nextChildId, ImageTitle + 3, ImageResourceNextChild);
        }
Esempio n. 26
0
        public void DynamicWidgets_ImportDynamicModule_VerifyGeneratedWidgetInPageToolbox()
        {
            ServerOperationsFeather.DynamicModules().EnsureModuleIsImported(ModuleName, ModuleResource);
            var section       = ServerOperationsFeather.Pages().GetDynamicWidgetToolboxSection(DynamicWidgetSection);
            int expectedCount = 6;

            string[] widgets = new string[]
            {
                DynamicWidgetTitle,
                DynamicChild1WidgetTitle,
                DynamicChild2WidgetTitle,
            };

            Assert.AreEqual(expectedCount, section.Tools.Count);

            foreach (var widget in widgets)
            {
                Assert.IsTrue(ServerOperationsFeather.Pages().IsWidgetPresentInToolbox(section, widget, isMvcWidget: true), "Mvc widget not found: " + widget);
                Assert.IsTrue(ServerOperationsFeather.Pages().IsWidgetPresentInToolbox(section, widget, isMvcWidget: false), "Web Forms widget not found: " + widget);
            }
        }
Esempio n. 27
0
        public void OnBeforeTestsStarts()
        {
            var  templateId  = ServerOperations.Templates().GetTemplateIdByTitle(TemplateTitle);
            Guid page1Id     = ServerOperations.Pages().CreatePage(PageTitle, templateId);
            var  page1NodeId = ServerOperations.Pages().GetPageNodeId(page1Id);

            ServerOperationsFeather.Pages().AddCalendarWidgetToPage(page1NodeId, PlaceHolderId);

            var basicCurrentEventStartTime = DateTime.Now;
            var currentEventStartTime      = new DateTime(basicCurrentEventStartTime.Year, basicCurrentEventStartTime.Month, basicCurrentEventStartTime.Day, basicCurrentEventStartTime.Hour, basicCurrentEventStartTime.Minute, basicCurrentEventStartTime.Second);
            var basicCurrentEventEndTime   = DateTime.Now.AddHours(1);
            var currentEventEndTime        = new DateTime(basicCurrentEventEndTime.Year, basicCurrentEventEndTime.Month, basicCurrentEventEndTime.Day, basicCurrentEventEndTime.Hour, basicCurrentEventEndTime.Minute, basicCurrentEventEndTime.Second);

            ServerOperations.Events().CreateEvent(EventTitle, string.Empty, false, currentEventStartTime, currentEventEndTime);
            var currentEventItem = EventsManager.GetManager()
                                   .GetEvents()
                                   .Where <Event>(ni => ni.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live && ni.Title == EventTitle)
                                   .FirstOrDefault();

            ServerArrangementContext.GetCurrent().Values.Add("currentEventId", currentEventItem.Id.ToString());
        }
        public void SetUp()
        {
            var fields = new FormFieldType[]
            {
                FormFieldType.TextField,
                FormFieldType.SubmitButton
            };

            var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(fields, FormName);

            var templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(PageName, templateId);
            var pageId = ServerOperations.Pages().GetPageId(PageName);

            ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId);

            Guid page1Id = ServerOperations.Pages().CreatePage(PageNameRedirect);

            ServerOperationsFeather.Pages().AddContentBlockWidgetToPage(page1Id, Content);
        }
        public void CheckboxesFieldTests_EditDefaultChoices_MarkupIsCorrect()
        {
            var choice1 = "Choice1";
            var choice2 = "Choice2";
            var choice3 = "Choice3";

            var controller = new CheckboxesFieldController();

            controller.Model.SerializedChoices = "[\"{0}\",\"{1}\",\"{2}\"]".Arrange(choice1, choice2, choice3);
            controller.Model.HasOtherChoice    = true;

            var control = new MvcWidgetProxy();

            control.Settings       = new ControllerSettings(controller);
            control.ControllerName = typeof(CheckboxesFieldController).FullName;

            var formId = ServerOperationsFeather.Forms().CreateFormWithWidget(control);

            var pageManager = PageManager.GetManager();

            try
            {
                var template = pageManager.GetTemplates().FirstOrDefault(t => t.Name == "SemanticUI.default" && t.Title == "default");
                Assert.IsNotNull(template, "Template was not found");

                var pageId = FeatherServerOperations.Pages().CreatePageWithTemplate(template, "CheckboxesFieldDefaultValueTest", "checkboxes-field-value-test");
                ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId);

                var pageContent = ServerOperationsFeather.Pages().GetPageContent(pageId);
                Assert.IsTrue(pageContent.Contains(choice1), "Form did not render the first choice in the checkboxes field.");
                Assert.IsTrue(pageContent.Contains(choice2), "Form did not render the second choice in the checkboxes field.");
                Assert.IsTrue(pageContent.Contains(choice3), "Form did not render the third choice in the checkboxes field.");
                Assert.IsTrue(pageContent.Contains(Res.Get <FieldResources>().Other), "Form did not render the 'Other' choice in the checkboxes field.");
            }
            finally
            {
                Telerik.Sitefinity.TestUtilities.CommonOperations.ServerOperations.Pages().DeleteAllPages();
                FormsModuleCodeSnippets.DeleteForm(formId);
            }
        }
        public void SetUp()
        {
            List <FormFieldType> formHeaderControls = new List <FormFieldType>()
            {
            };
            List <FormFieldType> formBodyControls = new List <FormFieldType>()
            {
                FormFieldType.NavigationField, FormFieldType.TextField, FormFieldType.PageBreak, FormFieldType.CheckboxesField, FormFieldType.SubmitButton
            };
            List <FormFieldType> formFooterControls = new List <FormFieldType>()
            {
            };

            var formId = ServerOperationsFeather.Forms().CreateFormWithWidgets(formHeaderControls, formBodyControls, formFooterControls, FormName);

            var templateId = ServerOperations.Templates().GetTemplateIdByTitle(PageTemplateName);

            ServerOperations.Pages().CreatePage(PageName, templateId);
            var pageId = ServerOperations.Pages().GetPageId(PageName);

            ServerOperationsFeather.Forms().AddFormControlToPage(pageId, formId);
        }