Пример #1
0
        /// <summary>
        /// Gives a role permissions for a page that has already been created.
        /// </summary>
        /// <param name="setting">Grant, Deny, Unchecked</param>
        /// <param name="permission">The name of the Permission such as View, Edit, Add, Add Content etc.</param>
        /// <param name="pageName">The name of the page.</param>
        /// <param name="roleName">The name of the role.</param>
        public void SetPagePermissionForRole(string setting, string permission, string pageName, string roleName)
        {
            Span homeSpan = PageSpans.Filter(Find.ByText(s => s.Contains(pageName)))[0];

            // Fires the left click event
            homeSpan.FireEvent("oncontextmenu");
            Thread.Sleep(1000);
            PageSettingsLink.Click();
            Thread.Sleep(1500);
            PageSettingsPage _pageSettings = new PageSettingsPage(this);

            _pageSettings.PermissionsTabLink.Click();
            _pageSettings.SetPermissionForRole(setting, permission, roleName);
            _pageSettings.UpdatePageLink.Click();
            Thread.Sleep(1500);
        }
Пример #2
0
        /// <summary>
        /// Adds a page using the Pages bulk add page field.
        /// Sets the template for the page to the template specified
        /// </summary>
        /// <param name="pageName">The name of the page.</param>
        /// <param name="template">The name of the template.</param>
        public void AddPageSelectTemplate(string pageName, string template)
        {
            AddPage(pageName);
            Thread.Sleep(2500);
            Span pageSpan = PageSpans.Filter(Find.ByText(s => s.Contains(pageName)))[0];

            // Fires the left click event
            pageSpan.FireEvent("oncontextmenu");
            Thread.Sleep(1000);
            PageSettingsLink.Click();
            Thread.Sleep(1500);
            PageSettingsPage _pageSettings = new PageSettingsPage(this);

            _pageSettings.TemplateFolderSelectList.Select(template);
            Thread.Sleep(1500);
            _pageSettings.UpdateLink.Click();
            Thread.Sleep(1500);
        }
Пример #3
0
        /// <summary>
        /// Gives a user edit permissions for a page that has already been created.
        /// </summary>
        /// <param name="pageName">The name of the page that the user will get edit permissions for.</param>
        /// <param name="userName">The name of the user that will be given edit permissions.</param>
        /// <param name="displayName">The display name of the user.</param>
        public void EditPageGiveUserEditPermissions(string pageName, string userName, string displayName)
        {
            Span homeSpan = PageSpans.Filter(Find.ByText(s => s.Contains(pageName)))[0];

            // Fires the left click event
            homeSpan.FireEvent("oncontextmenu");
            Thread.Sleep(1000);
            PageSettingsLink.Click();
            Thread.Sleep(1500);
            PageSettingsPage _pageSettings = new PageSettingsPage(this);

            _pageSettings.PermissionsTabLink.Click();
            Thread.Sleep(1500);
            _pageSettings.GiveUserEditPermissionsForPage(userName, displayName);
            Thread.Sleep(1500);
            _pageSettings.UpdatePageLink.Click();
            Thread.Sleep(1500);
        }
Пример #4
0
        /// <summary>
        /// Creates a page with an HTML module and some content on it and then exports it.
        /// </summary>
        /// <param name="pageName">The page that will be created.</param>
        /// <param name="pageContent">The content to add to the HTML module on the page.</param>
        /// <param name="templateName">The name for the template.</param>
        /// <param name="withContent">Will the page be exported with content.</param>
        /// <param name="siteURL">The site url.</param>
        /// <param name="community">Is the site running community edition. Enter false if it uses professional or Enterprise.</param>
        public void CreateAndExportPage(string pageName, string pageContent, string templateName, bool withContent, string siteURL, bool community)
        {
            IconBar controlPanel = null;
            RibbonBar ribbonBar = null;
            bool usesRibbonBar = false;

            //Add a page to the site
            if (ControlPanelElement.Id.Contains(RibbonBarID))
            {
                ribbonBar = new RibbonBar(this);
                ribbonBar.NewPageLink.ClickNoWait();
                usesRibbonBar = true;
            }
            else
            {
                controlPanel = new IconBar(this);
                controlPanel.AddPageLink.ClickNoWait();
            }
            PageSettingsPage newPage = new PageSettingsPage(this);
            newPage.PageNameField.Value = pageName;
            newPage.PageTemplateSelect.Select("None Specified");
            newPage.SetPermissionForRole("Grant", "View", "All Users");
            newPage.AddPageLink.ClickNoWait();
            System.Threading.Thread.Sleep(3000);

            //Add content to the page 
            IEInstance.GoTo(siteURL + "/testpage.aspx");
            if (!usesRibbonBar)
            {
                if (community)
                {
                    controlPanel.AddHTMLModuleToPageWithContent("Export Module", "HTML", pageContent, 0);
                }
                else
                {
                    controlPanel.AddHTMLModuleToPageWithContent("Export Module", "HTML Pro", pageContent, 0);
                }
            }
            else
            {
                if (community)
                {
                    ribbonBar.AddHTMLModuleToPageWithContent("Export Module", "HTML", pageContent, 0);

                }
                else
                {
                    ribbonBar.AddHTMLModuleToPageWithContent("Export Module", "HTML Pro", pageContent, 0);

                }
            }

            //Act 
            if (usesRibbonBar)
            {
                ribbonBar.ExportPageLink.Click();
            }
            else
            {
                controlPanel.ExportPageLink.Click();
            }
            ExportTemplateFolderSelectList.Select("Templates");
            TemplateNameField.Value = templateName;
            TemplateDescriptionField.Value = "This is a template for testing";
            IncludeContentCheckbox.Checked = withContent;
            ExportLink.ClickNoWait();
            System.Threading.Thread.Sleep(1000);
        }
Пример #5
0
 /// <summary>
 /// Gives a role permissions for a page that has already been created.
 /// </summary>
 /// <param name="setting">Grant, Deny, Unchecked</param>
 /// <param name="permission">The name of the Permission such as View, Edit, Add, Add Content etc.</param>
 /// <param name="pageName">The name of the page.</param>
 /// <param name="roleName">The name of the role.</param>
 public void SetPagePermissionForRole(string setting, string permission, string pageName, string roleName)
 {
     Span homeSpan = PageSpans.Filter(Find.ByText(s => s.Contains(pageName)))[0];
     // Fires the left click event
     homeSpan.FireEvent("oncontextmenu");
     Thread.Sleep(1000);
     PageSettingsLink.Click();
     Thread.Sleep(1500);
     PageSettingsPage _pageSettings = new PageSettingsPage(this);
     _pageSettings.PermissionsTabLink.Click();
     _pageSettings.SetPermissionForRole(setting, permission, roleName);
     _pageSettings.UpdatePageLink.Click();
     Thread.Sleep(1500);
 }
Пример #6
0
 /// <summary>
 /// Gives a user edit permissions for a page that has already been created.
 /// </summary>
 /// <param name="pageName">The name of the page that the user will get edit permissions for.</param>
 /// <param name="userName">The name of the user that will be given edit permissions.</param>
 /// <param name="displayName">The display name of the user.</param>
 public void EditPageGiveUserEditPermissions(string pageName, string userName, string displayName)
 {
     Span homeSpan = PageSpans.Filter(Find.ByText(s => s.Contains(pageName)))[0];
     // Fires the left click event
     homeSpan.FireEvent("oncontextmenu");
     Thread.Sleep(1000);
     PageSettingsLink.Click();
     Thread.Sleep(1500);
     PageSettingsPage _pageSettings = new PageSettingsPage(this);
     _pageSettings.PermissionsTabLink.Click();
     Thread.Sleep(1500);
     _pageSettings.GiveUserEditPermissionsForPage(userName, displayName);
     Thread.Sleep(1500);
     _pageSettings.UpdatePageLink.Click();
     Thread.Sleep(1500);
 }
Пример #7
0
 /// <summary>
 /// Adds a page using the Pages bulk add page field.
 /// Sets the template for the page to the template specified
 /// </summary>
 /// <param name="pageName">The name of the page.</param>
 /// <param name="template">The name of the template.</param>
 public void AddPageSelectTemplate(string pageName, string template)
 {
     AddPage(pageName);
     Thread.Sleep(2500);
     Span pageSpan = PageSpans.Filter(Find.ByText(s => s.Contains(pageName)))[0];
     // Fires the left click event
     pageSpan.FireEvent("oncontextmenu");
     Thread.Sleep(1000);
     PageSettingsLink.Click();
     Thread.Sleep(1500);
     PageSettingsPage _pageSettings = new PageSettingsPage(this);
     _pageSettings.TemplateFolderSelectList.Select(template);
     Thread.Sleep(1500);
     _pageSettings.UpdateLink.Click();
     Thread.Sleep(1500);
 }
Пример #8
0
        /// <summary>
        /// Creates a page with an HTML module and some content on it and then exports it.
        /// </summary>
        /// <param name="pageName">The page that will be created.</param>
        /// <param name="pageContent">The content to add to the HTML module on the page.</param>
        /// <param name="templateName">The name for the template.</param>
        /// <param name="withContent">Will the page be exported with content.</param>
        /// <param name="siteURL">The site url.</param>
        /// <param name="community">Is the site running community edition. Enter false if it uses professional or Enterprise.</param>
        public void CreateAndExportPage(string pageName, string pageContent, string templateName, bool withContent, string siteURL, bool community)
        {
            IconBar   controlPanel  = null;
            RibbonBar ribbonBar     = null;
            bool      usesRibbonBar = false;

            //Add a page to the site
            if (ControlPanelElement.Id.Contains(RibbonBarID))
            {
                ribbonBar = new RibbonBar(this);
                ribbonBar.NewPageLink.ClickNoWait();
                usesRibbonBar = true;
            }
            else
            {
                controlPanel = new IconBar(this);
                controlPanel.AddPageLink.ClickNoWait();
            }
            PageSettingsPage newPage = new PageSettingsPage(this);

            newPage.PageNameField.Value = pageName;
            newPage.PageTemplateSelect.Select("None Specified");
            newPage.SetPermissionForRole("Grant", "View", "All Users");
            newPage.AddPageLink.ClickNoWait();
            System.Threading.Thread.Sleep(3000);

            //Add content to the page
            IEInstance.GoTo(siteURL + "/testpage.aspx");
            if (!usesRibbonBar)
            {
                if (community)
                {
                    controlPanel.AddHTMLModuleToPageWithContent("Export Module", "HTML", pageContent, 0);
                }
                else
                {
                    controlPanel.AddHTMLModuleToPageWithContent("Export Module", "HTML Pro", pageContent, 0);
                }
            }
            else
            {
                if (community)
                {
                    ribbonBar.AddHTMLModuleToPageWithContent("Export Module", "HTML", pageContent, 0);
                }
                else
                {
                    ribbonBar.AddHTMLModuleToPageWithContent("Export Module", "HTML Pro", pageContent, 0);
                }
            }

            //Act
            if (usesRibbonBar)
            {
                ribbonBar.ExportPageLink.Click();
            }
            else
            {
                controlPanel.ExportPageLink.Click();
            }
            ExportTemplateFolderSelectList.Select("Templates");
            TemplateNameField.Value        = templateName;
            TemplateDescriptionField.Value = "This is a template for testing";
            IncludeContentCheckbox.Checked = withContent;
            ExportLink.ClickNoWait();
            System.Threading.Thread.Sleep(1000);
        }