public void ExportEditedLibrariesModule()
        {
            RuntimeSettingsModificator.ExecuteWithClientTimeout(200000, () => BAT.Macros().NavigateTo().Modules().Documents(this.Culture));
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper().OpenCustomFieldsSection(CustomFieldsLinkID);
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper().DeleteField("Short");
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper()
            .AddCustomField(CustomFieldsNames.ShortText, "ShortEdited");
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper().SaveCustomFields();
            ActiveBrowser.Refresh();

            this.Images(this.Culture);
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper().OpenCustomFieldsSection(CustomFieldsLinkID);
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper().DeleteField("Short");
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper()
            .AddCustomField(CustomFieldsNames.ShortText, "ShortEdited");
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper().SaveCustomFields();
            ActiveBrowser.Refresh();

            BAT.Macros().NavigateTo().Modules().Videos(this.Culture);
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper().OpenCustomFieldsSection(CustomFieldsLinkID);
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper().DeleteField("Short");
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper()
            .AddCustomField(CustomFieldsNames.ShortText, "ShortEdited");
            BAT.Wrappers().Backend().CustomFields().CustomFieldsWrapper().SaveCustomFields();
            ActiveBrowser.Refresh();

            BAT.Wrappers().Backend().Packaging().PackagingWrapper().ExportStructure();
            BAT.Arrange(this.TestName).ExecuteArrangement("VerifyExportedFiles");
        }
        public void ExtensibleWebAiiEvents()
        {
            Manager.LaunchNewBrowser();
            ActiveBrowser.NavigateTo(Path.Combine(TestContext.TestDeploymentDir, TESTPAGE));

            //
            // Events setup
            //
            // Logging events: Triggered each time a Log.WriteLine is fired.
            Log.LogWrite += new EventHandler <ArtOfTest.WebAii.EventsArgs.LogWriteEventArgs>(Log_LogWrite);

            // Browser events: BeforeCommandExecuted/AfterCommandExecuted/DOMRefreshed
            ActiveBrowser.BeforeCommandExecuted += new EventHandler <ArtOfTest.WebAii.EventsArgs.BrowserCommandEventArgs>(ActiveBrowser_BeforeCommandExecuted);
            ActiveBrowser.AfterCommandExecuted  += new EventHandler <ArtOfTest.WebAii.EventsArgs.BrowserCommandEventArgs>(ActiveBrowser_AfterCommandExecuted);
            ActiveBrowser.DomRefreshed          += new EventHandler(ActiveBrowser_DomRefreshed);

            // Find events: When a failed search returns null or an empty list for Find.Allxx
            Find.ReturnedNullOrEmpty += new EventHandler <ArtOfTest.WebAii.EventsArgs.ReturnedNullOrEmptyEventArgs>(Find_ReturnedNullOrEmpty);

            // Perform a command to simulate the browser events
            ActiveBrowser.Refresh();

            // Perform a find operation to simulate the find events
            Element e = Find.ById("invalidId");

            // Perform a log operation to simulate the logging events
            Log.WriteLine("Logging from Test");
        }
        public void ExportImportModuleAllFieldsFrontendCheck()
        {
            RuntimeSettingsModificator.ExecuteWithClientTimeout(200000, () => BAT.Wrappers().Backend().Packaging().PackagingWrapper().ExportStructure());
            BAT.Wrappers().Backend().ModuleBuilder().ModuleInitializerWrapper().NavigateToModuleBuilderPage();
            BAT.Wrappers().Backend().ModuleBuilder().ModuleInitializerWrapper().DeleteModule(ModuleName);
            BAT.Arrange(this.TestName).ExecuteArrangement("VerifyExportedFiles");
            BAT.Arrange(this.TestName).ExecuteArrangement("DeletePackageFromDB");
            BAT.Arrange(this.TestName).ExecuteArrangement("RestartApplication");
            BAT.Wrappers().Backend().ModuleBuilder().ModuleInitializerWrapper().WaitForSystemRestart();
            ActiveBrowser.Refresh();
            RuntimeSettingsModificator.ExecuteWithClientTimeout(200000, () => BAT.Wrappers().Backend().ModuleBuilder().ModuleInitializerWrapper().NavigateToModuleBuilderPage());
            BAT.Wrappers().Backend().ModuleBuilder().ModuleInitializerWrapper().OpenModuleDashboard(ModuleName);
            BAT.Wrappers().Backend().ModuleBuilder().ModuleInitializerWrapper().AssertContentIsPresent(ContentTypeName, true);
            BAT.Macros().NavigateTo().Modules().ParticularModule(ModuleName, this.Culture);
            BAT.Wrappers().Backend().ModuleBuilder().ContentTypePageActionsWrapper().OpenCreateItemWizard(this.title);
            BAT.Wrappers().Backend().ModuleBuilderWrapper().ModuleBuilderItemsCreateScreenFrameWrapper().SetTitle(this.dynamicItemNameAllTypes);
            BAT.Wrappers().Backend().ModuleBuilderWrapper().ModuleBuilderItemsCreateScreenFrameWrapper().SetNumber(this.dynamicItemNumber);
            BAT.Wrappers().Backend().ModuleBuilderWrapper().ModuleBuilderItemsCreateScreenFrameWrapper().PublishItem();

            BAT.Macros().NavigateTo().Pages(this.Culture);
            BAT.Wrappers().Backend().Pages().PagesWrapper().OpenPageZoneEditor(PageName);
            BATFeather.Wrappers().Backend().Pages().PageZoneEditorWrapper().AddMvcWidgetHybridModePage(ContentTypeName);
            BAT.Wrappers().Backend().Pages().PageZoneEditorWrapper().PublishPage();
            BAT.Macros().NavigateTo().CustomPage("~/" + PageName.ToLower(), true, this.Culture);
            this.VerifyDynamicItemsOnFrontEnd(this.dynamicItemNameAllTypes);
        }
        public void WaitForContent()
        {
            exec(4);
            this.Elements.GetHtml("mainDiv").Wait.ForContent(FindContentType.TextContent, "l:hello", 5000);
            Assert.IsTrue(this.Elements.GetHtml("mainDiv").TextContent.Equals("Hello"));

            ActiveBrowser.Refresh(); // Reset everything.
            this.Elements.GetHtml("mainDiv").Refresh(true);
            exec(4);
            this.Elements.GetHtml("mainDiv").Wait.ForContent(FindContentType.TextContent, "p:hell", 5000);
            Assert.IsTrue(this.Elements.GetHtml("mainDiv").TextContent.Equals("Hello"));


            ActiveBrowser.Refresh(); // Reset everything.
            this.Elements.GetHtml("mainDiv").Refresh(true);
            exec(4);
            this.Elements.GetHtml("mainDiv").Wait.ForContent(FindContentType.InnerText, "l:Hello", 5000);
            Assert.IsTrue(this.Elements.GetHtml("mainDiv").TextContent.Equals("Hello"));


            this.Elements.GetHtml("mainDiv").SetValue <string>("innerHTML", "bal");
            this.Elements.GetHtml("mainDiv").Refresh(true);
            exec(4);
            this.Elements.GetHtml("mainDiv").Wait.ForContentNot(FindContentType.TextContent, "l:bal", 5000);
            Assert.IsTrue(this.Elements.GetHtml("mainDiv").TextContent.Equals("Hello"));
        }
        public void DeleteDraftAndPublishVersionInDetailRevisionHistoryPageOnMvcPageTemplate()
        {
            RuntimeSettingsModificator.ExecuteWithClientTimeout(800000, () => BAT.Macros().NavigateTo().CustomPage("~/sitefinity/design/pagetemplates", false));
            BAT.Macros().NavigateTo().Design().PageTemplates(this.Culture);
            BAT.Wrappers().Backend().PageTemplates().PageTemplateMainScreen().OpenTemplateEditor(TemplateTitle);
            BAT.Wrappers().Backend().PageTemplates().PageTemplateModifyScreen().PublishTemplate();
            BAT.Wrappers().Backend().PageTemplates().PageTemplateMainScreen().OpenTemplateEditor(TemplateTitle);
            BAT.Wrappers().Backend().PageTemplates().PageTemplateModifyScreen().PublishTemplate();
            BAT.Wrappers().Backend().PageTemplates().PageTemplateMainScreen().OpenTemplateEditor(TemplateTitle);
            BAT.Wrappers().Backend().PageTemplates().PageTemplateModifyScreen().ClickSaveAsDraftButton();
            BAT.Wrappers().Backend().PageTemplates().PageTemplateModifyScreen().ClickBackToTemplatesButton();
            BAT.Wrappers().Backend().PageTemplates().PageTemplateMainScreen().OpenRevisionHistoryScreenFromActionsMenu(TemplateTitle);
            BAT.Wrappers().Backend().RevisionHistory().RevisionHistoryWrapper().VerifyRevisionHistoryScreen(TemplateTitle, "Templates");
            Assert.AreEqual <int>(3, BAT.Wrappers().Backend().RevisionHistory().RevisionHistoryWrapper().GetRevisionHistoryRows().Count, "The actual number of revisions doesn't match the expected (3) three");
            BAT.Wrappers().Backend().RevisionHistory().RevisionHistoryWrapper().ClickOnSelectedVersion("1.0");
            BAT.Wrappers().Backend().RevisionHistory().VersionPreview().VerifyDeleteVersionButtonIsVisible();
            BAT.Macros().DialogOperations().StartConfirmDialogMonitoring();
            BAT.Wrappers().Backend().RevisionHistory().VersionPreview().PressDeleteVersionButtonInDetailPage();

            ////BAT.Wrappers().Backend().PageTemplates().PageTemplateMainScreen().OpenRevisionHistoryScreenFromActionsMenu(TemplateTitle);
            BAT.Wrappers().Backend().RevisionHistory().RevisionHistoryWrapper().VerifyTitleRowsInRevisionHistory("2.1");
            BAT.Wrappers().Backend().RevisionHistory().RevisionHistoryWrapper().VerifyTitleRowsInRevisionHistory("2.0");
            Assert.AreEqual <int>(2, BAT.Wrappers().Backend().RevisionHistory().RevisionHistoryWrapper().GetRevisionHistoryRows().Count, "The actual number of revisions doesn't match the expected (2) two");
            BAT.Wrappers().Backend().RevisionHistory().RevisionHistoryWrapper().ClickOnSelectedVersion("2.1");
            BAT.Wrappers().Backend().RevisionHistory().VersionPreview().VerifyDeleteVersionButtonIsVisible();
            BAT.Macros().DialogOperations().StartConfirmDialogMonitoring();
            BAT.Wrappers().Backend().RevisionHistory().VersionPreview().PressDeleteVersionButtonInDetailPage();
            ActiveBrowser.WaitUntilReady();
            ActiveBrowser.Refresh();
            ActiveBrowser.WaitForElementEndsWithID("_frontendPageTemplatesListView");
            BAT.Wrappers().Backend().PageTemplates().PageTemplateMainScreen().OpenRevisionHistoryScreenFromActionsMenu(TemplateTitle);
            BAT.Wrappers().Backend().RevisionHistory().RevisionHistoryWrapper().VerifyTitleRowsInRevisionHistory("2.0");
            Assert.AreEqual <int>(1, BAT.Wrappers().Backend().RevisionHistory().RevisionHistoryWrapper().GetRevisionHistoryRows().Count, "The actual number of revisions doesn't match the expected (1) one");
        }
Esempio n. 6
0
        public void MvcWidgetUseMediaField()
        {
            BAT.Macros().NavigateTo().Pages();
            BAT.Wrappers().Backend().Pages().PagesWrapper().OpenPageZoneEditor(PageName);
            BATFrontend.Wrappers().Backend().Pages().PageZoneEditorWrapper().EditWidget(WidgetCaption);
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().WaitForSaveButtonToAppear();
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().IsMessageAppear(false);
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().ChangeDocumentButton();
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().SelectMediaFile(DocumentTitle, true);
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().DoneSelectingOfDocument();
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().ClickSaveButton();
            BAT.Wrappers().Backend().Pages().PageZoneEditorWrapper().PublishPage();

            BAT.Macros().NavigateTo().Modules().Documents();
            BAT.Wrappers().Backend().DocumentsAndFiles().DocumentsAndFilesDashboardWrapper().OpenDefaultLibrary();
            BAT.Wrappers().Backend().Images().ImagesDashboard().SelectItemsInGrid(this.itemToUnPublish);
            BAT.Wrappers().Backend().Images().ImagesDashboard().ClickMoreActionsMenuAndSelectOption(ActionNameUnpublish);

            ActiveBrowser.Refresh();
            BAT.Macros().NavigateTo().Pages();
            BAT.Wrappers().Backend().Pages().PagesWrapper().OpenPageZoneEditor(PageName);
            BATFrontend.Wrappers().Backend().Pages().PageZoneEditorWrapper().EditWidget(WidgetCaption);
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().WaitForSaveButtonToAppear();
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().IsMessageAppear(true);
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().ClickSaveButton();
            BAT.Wrappers().Backend().Pages().PageZoneEditorWrapper().PublishPage();


            BAT.Macros().NavigateTo().Modules().Documents();
            BAT.Wrappers().Backend().DocumentsAndFiles().DocumentsAndFilesDashboardWrapper().OpenDefaultLibrary();
            BAT.Wrappers().Backend().Images().ImagesDashboard().SelectItemsInGrid(this.itemToUnPublish);
            BAT.Wrappers().Backend().Images().ImagesDashboard().ClickMoreActionsMenuAndSelectOption(ActionNamePublish);

            BAT.Macros().NavigateTo().Pages();
            BAT.Wrappers().Backend().Pages().PagesWrapper().OpenPageZoneEditor(PageName);
            BATFrontend.Wrappers().Backend().Pages().PageZoneEditorWrapper().EditWidget(WidgetCaption);
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().WaitForSaveButtonToAppear();
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().IsMessageAppear(false);
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().ClickSaveButton();
            BAT.Wrappers().Backend().Pages().PageZoneEditorWrapper().PublishPage();

            BAT.Macros().NavigateTo().Modules().Documents();
            BAT.Wrappers().Backend().DocumentsAndFiles().DocumentsAndFilesDashboardWrapper().OpenDefaultLibrary();
            BAT.Wrappers().Backend().Images().ImagesDashboard().SelectItemsInGrid(this.itemToUnPublish);
            BAT.Wrappers().Backend().DocumentsAndFiles().DocumentsAndFilesDashboardWrapper().PerformDeleteOfCheckedFile();
            ActiveBrowser.Refresh();
            ActiveBrowser.WaitUntilReady();

            BAT.Macros().NavigateTo().Pages();
            BAT.Wrappers().Backend().Pages().PagesWrapper().OpenPageZoneEditor(PageName);
            BATFrontend.Wrappers().Backend().Pages().PageZoneEditorWrapper().EditWidget(WidgetCaption);
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().WaitForSaveButtonToAppear();
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().IsMessageAppear(true);
            BATFrontend.Wrappers().Backend().Widgets().WidgetsWrapper().ClickSaveButton();
            BAT.Wrappers().Backend().Pages().PageZoneEditorWrapper().PublishPage();
        }
        public void WaitForStyles()
        {
            HtmlDiv div = this.Elements.GetHtml("mainDiv").As <HtmlDiv>();

            exec(5);
            div.Wait.ForStyles("backgroundColor=blue");

            ActiveBrowser.Refresh();
            div.Refresh();

            exec(5);

            string s = div.GetComputedStyleValue("backgroundColor");

            // Wait until background color is NOT yellow.
            div.Wait.ForStylesNot(true, "backgroundColor=yellow");
        }
Esempio n. 8
0
        public void ApplyTwoDifferentTemplatesFromDifferentPackagesToPages()
        {
            BAT.Macros().NavigateTo().Design().PageTemplates();
            BAT.Wrappers().Backend().PageTemplates().PageTemplateMainScreen().IsPageTemplatePresentInGridView(Template1Title);
            BAT.Wrappers().Backend().PageTemplates().PageTemplateMainScreen().IsPageTemplatePresentInGridView(Template2Title);

            BAT.Arrange(this.TestName).ExecuteArrangement("CreatePages");

            BAT.Macros().NavigateTo().CustomPage("~/" + Page1Title, false);
            Assert.IsTrue(ActiveBrowser.ContainsText(Package1LayoutText), "Layout text is not correct");
            ActiveBrowser.Refresh();
            ActiveBrowser.WaitUntilReady();
            Assert.IsTrue(ActiveBrowser.ContainsText(Package1LayoutText), "Layout text is not correct");

            BAT.Macros().NavigateTo().CustomPage("~/" + Page2Title, false);
            Assert.IsTrue(ActiveBrowser.ContainsText(Package2LayoutText), "Layout text is not correct");
            ActiveBrowser.Refresh();
            ActiveBrowser.WaitUntilReady();
            Assert.IsTrue(ActiveBrowser.ContainsText(Package2LayoutText), "Layout text is not correct");
        }
        public void ControllingBrowserInstance()
        {
            Manager.LaunchNewBrowser();
            ActiveBrowser.NavigateTo(Path.Combine(TestContext.TestDeploymentDir, TESTPAGE));
            Assert.IsTrue(ActiveBrowser.Url.Contains("Browser.htm"));

            // Now navigate to www.google.com
            ActiveBrowser.NavigateTo("http://www.bing.com");
            Assert.IsTrue(ActiveBrowser.Url.Contains("bing.com"));

            // Now go back.
            ActiveBrowser.GoBack();
            Assert.IsTrue(ActiveBrowser.Url.Contains("Browser.htm"));

            // Now go forward
            ActiveBrowser.GoForward();
            Assert.IsTrue(ActiveBrowser.Url.Contains("bing.com"));

            // Do a Refresh()
            ActiveBrowser.Refresh();
            Assert.IsTrue(ActiveBrowser.Url.Contains("bing.com"));
        }
        public void CommonHtmlControlMethodsProperties()
        {
            // All controls have a Click/MouseClick. The .Click invokes a click from the DOM,
            // the MouseClick(), moves the mouse to the controls and clicks it.

            //
            // CLICKING
            //
            Find.ById <HtmlInputButton>("button1").Click();
            ActiveBrowser.Refresh();
            Find.ById <HtmlInputButton>("button1").MouseClick();

            // You can capture any element on the page using the .Capture()
            Find.ById <HtmlInputImage>("image1").Capture("myfile"); // Will be stored to the Log.LogLocation

            //
            // CHECKING
            //
            // Check a checkbox and invoke the onclick event.
            HtmlInputCheckBox ck = Find.ById <HtmlInputCheckBox>("checkbox1");

            if (ActiveBrowser.BrowserType == BrowserType.Safari)
            {
                // Unfortunately the way Safari behaves is different then the other browsers.
                ck.Check(true, false);
            }
            else
            {
                ck.Check(true, true);
            }

            // Query the checked state
            Assert.IsTrue(ck.Checked);
            // You can also simply set the value without invoking the clicked event.
            ck.Checked = false;
            Assert.IsFalse(ck.Checked);

            // Get whether a checkbox is enabled or disabled.
            HtmlInputCheckBox cks = Find.ById <HtmlInputCheckBox>("checkbox1");
            bool disabled         = cks.GetValue <bool>("disabled");

            // Disable it
            cks.SetValue <string>("disabled", "true");
            Assert.IsTrue(cks.GetValue <bool>("disabled"));

            // Is it visible
            Assert.IsTrue(cks.IsVisible());

            // When the contents of a div element are larger than the declared
            // width or height of element it automatically adds scroll bars.
            // When that happens we can scroll the contents of the div element.
            // The value represents the offset in pixels to scroll the contents.
            HtmlDiv infoDiv = Find.ById <HtmlDiv>("AutoInfo");

            infoDiv.ScrollTop  = 50;
            infoDiv.ScrollLeft = 75;

            //
            // SELECTING
            //
            HtmlSelect select = Find.ById <HtmlSelect>("color_product");

            Assert.IsTrue(select.SelectedOption.Value.Equals("Blue"));
            Assert.IsTrue(select.SelectedOption.Text.Equals("Color : Blue"));

            select.SelectByIndex(1);
            Assert.IsTrue(select.SelectedOption.Text.Equals("Color : Green"));

            //
            // SET TEXT
            //
            Find.ById <HtmlTextArea>("textarea1").Text = "NEW TEXT";

            // Access common methods
            HtmlAnchor link = Find.ByAttributes <HtmlAnchor>("href=~google");

            Assert.IsTrue(link.Attributes.Count == 3);
            Assert.IsTrue(link.BaseElement.TextContent.Trim().Equals("Link"));

            // Invoke any events on the control
            link.InvokeEvent(ScriptEventType.OnFocus);
        }