protected void EnterBranchName(string newBranchName) { Session.EnterText(c => IdeQuery.EditBranchDialog(c).Children().Textfield().Marked("entryName"), newBranchName); Session.WaitForElement(c => IdeQuery.EditBranchDialog(c).Children().Textfield().Marked("entryName").Text(newBranchName)); TakeScreenShot("Branch-Name-Entered"); Assert.IsTrue(Session.ClickElement(c => IdeQuery.EditBranchDialog(c).Children().Button().Marked("buttonOk"))); }
protected void CloseRepositoryConfiguration() { ReproStep("Click on Close button of Git Repository Configuration Dialog"); Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked("buttonOk")); TakeScreenShot("Git-Repository-Configuration-Closed"); Session.WaitForNoElement(IdeQuery.GitConfigurationDialog); }
void AddEditRemote(string buttonName, string newRemoteName, string remoteUrl, string remotePushUrl) { Assert.IsNotEmpty(Session.Query(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked(buttonName))); Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked(buttonName), false); Session.WaitForElement(IdeQuery.EditRemoteDialog); ReproStep(string.Format("Enter Remote name as '{0}'", newRemoteName)); Func <AppQuery, AppQuery> EditRemoteDialogChildren = c => IdeQuery.EditRemoteDialog(c).Children(); Assert.IsTrue(Session.EnterText(c => EditRemoteDialogChildren(c).Textfield().Marked("entryName"), newRemoteName)); Session.WaitForElement(c => EditRemoteDialogChildren(c).Textfield().Marked("entryName").Text(newRemoteName)); ReproStep(string.Format("Enter Remote URL as '{0}'", remoteUrl)); Assert.IsTrue(Session.EnterText(c => EditRemoteDialogChildren(c).Textfield().Marked("entryUrl"), remoteUrl)); Session.WaitForElement(c => EditRemoteDialogChildren(c).Marked("entryUrl").Text(remoteUrl)); ReproStep(string.Format("Enter Remote Push URL as '{0}'", remotePushUrl ?? remoteUrl)); Assert.IsTrue(Session.EnterText(c => EditRemoteDialogChildren(c).Textfield().Marked("entryPushUrl"), remotePushUrl ?? remoteUrl)); Session.WaitForElement(c => EditRemoteDialogChildren(c).Textfield().Marked("entryPushUrl").Text(remotePushUrl ?? remoteUrl)); TakeScreenShot("Remote-Details-Filled"); ReproStep("Click on OK"); Assert.IsTrue(Session.ClickElement(c => EditRemoteDialogChildren(c).Button().Marked("buttonOk"))); Session.WaitForNoElement(IdeQuery.EditRemoteDialog); Session.WaitForElement(IdeQuery.GitConfigurationDialog); TakeScreenShot("Remote-Edit-Dialog-Closed"); }
protected void DeleteBranch(string branchName) { Assert.IsTrue(Session.SelectElement(c => branchDisplayName(c).Contains(branchName))); Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Text("Delete"), false); TakeScreenShot(string.Format("Delete-Branch-{0}", branchName)); Ide.ClickButtonAlertDialog("Delete"); Session.WaitForElement(IdeQuery.GitConfigurationDialog); }
protected void DeleteRemote(string remoteName) { Session.WaitForElement(c => remoteTreeName(c).Contains(remoteName)); Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Text("Remove"), false); TakeScreenShot(string.Format("Remove-Remote-{0}", remoteName)); Ide.ClickButtonAlertDialog("Delete"); Session.WaitForElement(IdeQuery.GitConfigurationDialog); }
protected void SwitchToBranch(string branchName) { SelectBranch(branchName); TakeScreenShot(string.Format("{0}-Branch-Selected", branchName)); Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Text("Switch to Branch"), false); CheckIfNameEmailNeeded(); CheckIfUserConflict(); Assert.IsTrue(IsBranchSwitched(branchName)); TakeScreenShot(string.Format("Switched-To-{0}", branchName)); }
protected void CreateEditBranch(string buttonName, string newBranchName) { Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked(buttonName), false); Session.WaitForElement(IdeQuery.EditBranchDialog); TakeScreenShot("Edit-Branch-Dialog-Opened"); EnterBranchName(newBranchName); Session.WaitForElement(IdeQuery.GitConfigurationDialog); TakeScreenShot("Edit-Branch-Dialog-Opened-Closed"); }
protected void DeleteBranch(string branchName) { SelectBranch(branchName); ReproStep("Press Delete"); Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Text("Delete"), false); TakeScreenShot(string.Format("Delete-Branch-{0}", branchName)); ReproStep("If prompted for confirmation, press Delete"); Ide.ClickButtonAlertDialog("Delete"); Session.WaitForElement(IdeQuery.GitConfigurationDialog); }
protected void FetchRemoteBranch(string remoteName) { SelectRemote(remoteName); Assert.IsEmpty(Session.Query(c => remoteTreeFullName(c).Contains(remoteName + "/"))); Assert.IsTrue(Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Text("Fetch"))); TakeScreenShot("Fetch-Remote"); SelectRemoteBranch(remoteName); }
protected void SwitchTab(string tabName) { ReproStep(string.Format("Select the '{0}' tab", tabName)); try { Assert.IsTrue(Session.SelectElement(c => IdeQuery.GitConfigurationDialog(c).Children().Notebook().Marked("notebook1").Text(tabName))); } catch (AssertionException) { ReproFailedStep(string.Format("Tab '{0}' is selected", tabName), string.Format("Tab '{0}' is not selected", tabName)); throw; } TakeScreenShot(string.Format("Tab-Changed-{0}", GenerateProjectName(tabName))); }
protected void CloseIfXamarinUpdateOpen() { try { Session.WaitForElement(IdeQuery.XamarinUpdate, 10 * 1000); TakeScreenShot("Xamarin-Update-Opened"); Session.ClickElement(c => IdeQuery.XamarinUpdate(c).Children().Button().Text("Close")); } catch (TimeoutException) { TestService.Session.DebugObject.Debug("Visual Studio Update did not open"); } }
public static bool Debug(int timeoutSeconds = 20, int pollStepSecs = 1) { Session.ExecuteCommand("MonoDevelop.Debugger.DebugCommands.Debug"); try { Ide.WaitUntil( () => !Session.Query(c => IdeQuery.RunButton(c).Property("Icon", "Stop")).Any(), timeout: timeoutSeconds * 1000, pollStep: pollStepSecs * 1000); return(false); } catch (TimeoutException) { return(true); } }
public static bool Run(int timeoutSeconds = 20, int pollStepSecs = 5) { Session.ExecuteCommand(ProjectCommands.Run); try { Ide.WaitUntil( () => !Session.Query(c => IdeQuery.RunButton(c).Property("Icon", "Stop")).Any(), timeout: timeoutSeconds * 1000, pollStep: pollStepSecs * 1000); return(false); } catch (TimeoutException) { return(true); } }
protected void DeleteTag(string tagName) { SelectTag(tagName); ReproStep("Click Delete"); try { Assert.IsTrue((Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked("buttonRemoveTag")))); } catch (AssertionException) { ReproFailedStep(string.Format("Tag '{0}' should be removed", tagName), string.Format("Tag '{0}' could not be removed", tagName)); throw; } Session.WaitForNoElement(c => tagTreeName(c).Text(tagName)); }
protected void CreateEditBranch(string buttonName, string newBranchName) { Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked(buttonName), false); Session.WaitForElement(IdeQuery.EditBranchDialog); TakeScreenShot("Edit-Branch-Dialog-Opened"); Session.EnterText(c => IdeQuery.EditBranchDialog(c).Children().Textfield().Marked("entryName"), newBranchName); Session.WaitForElement(c => IdeQuery.EditBranchDialog(c).Children().Textfield().Marked("entryName").Text(newBranchName)); TakeScreenShot("Branch-Name-Entered"); Assert.IsTrue(Session.ClickElement(c => IdeQuery.EditBranchDialog(c).Children().Button().Marked("buttonOk"))); Session.WaitForElement(IdeQuery.GitConfigurationDialog); TakeScreenShot("Edit-Branch-Dialog-Opened-Closed"); }
protected void AddNewTag(string tagName, string tagMessage = null, string commitMsg = null) { ReproStep("Click on New"); Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked("buttonAddTag"), false); ReproStep("Wait for 'Select a Revision' dialog to open"); try { Session.WaitForElement(c => c.Window().Marked("Select a revision")); } catch (AssertionException) { ReproFailedStep("'Select a Revision' dialog should open", "'Select a Revision' dialog did not open"); throw; } ReproStep("Enter the Tag Name"); Session.EnterText(c => c.Window().Marked("Select a revision").Children().Textfield().Index(0), tagName); Session.WaitForElement(c => c.Window().Marked("Select a revision").Children().Textfield().Index(0).Text(tagName)); TakeScreenShot("Tag-Name-Entered"); if (!string.IsNullOrEmpty(tagMessage)) { ReproStep("Enter a Tag Message"); Session.EnterText(c => c.Window().Marked("Select a revision").Children().Textfield().Index(1), tagMessage); Session.WaitForElement(c => c.Window().Marked("Select a revision").Children().Textfield().Index(1).Text(tagMessage)); TakeScreenShot("Tag-Message-Entered"); } Func <AppQuery, AppQuery> revisionsTreeView = c => c.Window().Marked("Select a revision").Children().TreeView().Index(0).Model().Children(); if (!string.IsNullOrEmpty(commitMsg)) { ReproStep(string.Format("Select the commit with message '{0}'", commitMsg)); Session.SelectElement(c => revisionsTreeView(c).Text(commitMsg)); } else { ReproStep("Select the first commit"); Session.SelectElement(c => revisionsTreeView(c).Index(0)); } TakeScreenShot("Commit-Message-Selected"); ReproStep("Click OK"); Session.ClickElement(c => c.Window().Marked("Select a revision").Children().Button().Text("Ok")); try { Session.WaitForElement(IdeQuery.GitConfigurationDialog); TakeScreenShot("Git-User-Not-Configured"); EnterGitUserConfig("John Doe", "*****@*****.**"); } catch (TimeoutException e) { } Session.WaitForElement(c => IdeQuery.GitConfigurationDialog(c)); TakeScreenShot("Ok-Clicked"); }
protected void SwitchToBranch(string branchName) { SelectBranch(branchName); TakeScreenShot(string.Format("{0}-Branch-Selected", branchName)); Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked("buttonSetDefaultBranch"), false); try { Session.WaitForElement(IdeQuery.GitConfigurationDialog); TakeScreenShot("Git-User-Not-Configured"); EnterGitUserConfig("John Doe", "*****@*****.**"); } catch (TimeoutException e) { } Assert.IsTrue(IsBranchSwitched(branchName)); TakeScreenShot(string.Format("Switched-To-{0}", branchName)); }
protected void SwitchToBranch(string branchName) { SelectBranch(branchName); TakeScreenShot(string.Format("{0}-Branch-Selected", branchName)); ReproStep("Click on 'Switch to Branch'"); Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Text("Switch to Branch"), false); CheckIfNameEmailNeeded(); CheckIfUserConflict(); ReproStep("Check if the selected branch is bold"); try { Assert.IsTrue(IsBranchSwitched(branchName)); } catch (AssertionException) { ReproFailedStep("The selected branch should be bold", "The selected branch is not bold"); throw; } TakeScreenShot(string.Format("Switched-To-{0}", branchName)); }
protected void AddNewTag(string tagName, string tagMessage = null, string commitMsg = null) { Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked("buttonAddTag"), false); Session.WaitForElement(c => c.Window().Marked("Select a revision")); Session.EnterText(c => c.Window().Marked("Select a revision").Children().Textfield().Index(0), tagName); Session.WaitForElement(c => c.Window().Marked("Select a revision").Children().Textfield().Index(0).Text(tagName)); TakeScreenShot("Tag-Name-Entered"); if (!string.IsNullOrEmpty(tagMessage)) { Session.EnterText(c => c.Window().Marked("Select a revision").Children().Textfield().Index(1), tagMessage); Session.WaitForElement(c => c.Window().Marked("Select a revision").Children().Textfield().Index(1).Text(tagMessage)); TakeScreenShot("Tag-Message-Entered"); } Func <AppQuery, AppQuery> revisionsTreeView = c => c.Window().Marked("Select a revision").Children().TreeView().Index(0).Model().Children(); if (!string.IsNullOrEmpty(commitMsg)) { Session.SelectElement(c => revisionsTreeView(c).Text(commitMsg)); } else { Session.SelectElement(c => revisionsTreeView(c).Index(0)); } TakeScreenShot("Commit-Message-Selected"); Session.ClickElement(c => c.Window().Marked("Select a revision").Children().Button().Text("Ok")); try { Session.WaitForElement(IdeQuery.GitConfigurationDialog); TakeScreenShot("Git-User-Not-Configured"); EnterGitUserConfig("John Doe", "*****@*****.**"); } catch (TimeoutException e) { } Session.WaitForElement(c => IdeQuery.GitConfigurationDialog(c)); TakeScreenShot("Ok-Clicked"); }
public bool Done() { return(Session.ClickElement(c => IdeQuery.NewFileDialog(c).Children().Button().Marked("okButton"))); }
protected void CloseRepositoryConfiguration() { Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked("buttonOk")); Session.WaitForNoElement(IdeQuery.GitConfigurationDialog); }
protected void DeleteTag(string tagName) { SelectTag(tagName); Assert.IsTrue((Session.ClickElement(c => IdeQuery.GitConfigurationDialog(c).Children().Button().Marked("buttonRemoveTag")))); Session.WaitForNoElement(c => tagTreeName(c).Text(tagName)); }
protected void SwitchTab(string tabName) { Assert.IsTrue(Session.SelectElement(c => IdeQuery.GitConfigurationDialog(c).Children().Notebook().Marked("notebook1").Text(tabName))); TakeScreenShot(string.Format("Tab-Changed-{0}", GenerateProjectName(tabName))); }