/// <summary> /// Delete a form for testing purposes. This will only work if the form to be deleted has not been used. /// </summary> /// <param name="formId">The ID of the form to be deleted.</param> public void DeleteForm(int formId) { Console.WriteLine("WindowHandle at Start: " + _driver.GetHashCode().ToString()); var mainMenu = new MainMenu(_driver); var formMenu = new SubMenuForms(_driver); var formPages = new FormPages(_driver); Console.WriteLine("Attemping to delete form with ID {0}", formId); // navigate to Forms > Design Forms and Packets > Edit Forms _driver.SwitchToDefaultFrame(); mainMenu.ClickMainMenuTab(); mainMenu.ClickForms(); formMenu.ClickDesignFormsandPackets(); formMenu.ClickEditForms(); _test.Log(LogStatus.Pass, "Navigate to Forms > Design Forms and Packets > Edit Forms"); // select the form in the list _driver.SwitchToFrameById("MainContentsIFrame"); formPages.EditFormsPage.SelectForm(formId); _test.Log(LogStatus.Pass, "Select the form in the list"); // delete the form _driver.SwitchToDefaultFrame(); formMenu.ClickDeleteForms(); formPages.EditFormsPage.ConfirmDeletion(); _test.Log(LogStatus.Pass, "Delete and confirm"); }
public void Form_Delete_Unused() { Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString()); var mainMenu = new MainMenu(Driver); var formMenu = new SubMenuForms(Driver); var formPages = new FormPages(Driver); var formWorkflow = new FormWorkflows(Driver, test); try //Contains Contents of Test { //test.Log(LogStatus.Info, "Starting test at URL: " + BaseUrls["ApplitrackLoginPage"]); // create the form and get the id var newFormId = formWorkflow.CreateForm(); test.Log(LogStatus.Pass, "Create the form"); Console.WriteLine("Attemping to delete form with ID {0}", newFormId); // navigate to Forms > Design Forms and Packets > Edit Forms Driver.SwitchToDefaultFrame(); mainMenu.ClickMainMenuTab(); mainMenu.ClickForms(); formMenu.ClickDesignFormsandPackets(); formMenu.ClickEditForms(); test.Log(LogStatus.Pass, "Navigate to Main Menu > Forms > Design Forms and Packets > Edit Forms"); // select the form in the list Driver.SwitchToFrameById("MainContentsIFrame"); formPages.EditFormsPage.SelectForm(newFormId); test.Log(LogStatus.Pass, "Select the form from the list"); // delete the form Driver.SwitchToDefaultFrame(); formMenu.ClickDeleteForms(); test.Log(LogStatus.Pass, "Click Delete Forms"); formPages.EditFormsPage.ConfirmDeletion(); test.Log(LogStatus.Pass, "Confirm the deletion"); // verify that the form was deleted Driver.SwitchToDefaultFrame(); mainMenu.ClickMainMenuTab(); mainMenu.ClickForms(); formMenu.ClickDesignFormsandPackets(); formMenu.ClickEditForms(); Driver.SwitchToFrameById("MainContentsIFrame"); Assert.IsFalse(formPages.EditFormsPage.FormExists(newFormId)); test.Log(LogStatus.Pass, "Form deleted"); Console.Out.WriteLineAsync("Form Deleted"); } catch (Exception e) //On Error Do { HandleException(e, Driver); throw; } }