public void InsertItemDialog_InsertViaOK_Success() { var ribbon = AddinRibbonController.Initialize(_app); //Login AddinTestUtility.LoginExpectSuccess(ribbon, AddinTestUtility.LoginEmail, AddinTestUtility.LoginPsw); //Insert item ribbon.InvokeButton(AddinRibbonButton.InsertItem); var itemDlg = InsertItemDriver.FindFromParent(ribbon.ExcelElement); itemDlg.SelectedItem = AddinTestUtility.ReadonlyItemName; itemDlg.SelectInsertVerifySuccess(); //Wait for item to be inserted in item-named worksheet var newlyCreatedItemSheet = ExcelAutoUtility.GetWorkSheetWithTimeout(_wb.Wb, AddinTestUtility.ReadonlyItemName, AddinTestUtility.WebServiceResponsePopulateTimeout); ribbon.Refresh(); Assert.AreEqual(string.Empty, ribbon.ValidateExpectedButtonStates(ExpectedButtonStates.OnNonPublishableItemCell)); //Validate cell content from inserted item Assert.AreEqual("Sumlev", ExcelAutoUtility.GetCellValue(newlyCreatedItemSheet, 1, 1)); Assert.AreEqual(-10.42333312, ExcelAutoUtility.GetCellValue(newlyCreatedItemSheet, 58, 46)); }
private Excel.Worksheet InsertOKToModifyItemData(AddinRibbonController ribbon, string itemName, bool getSecondInstance) { //Login if (!getSecondInstance) { AddinTestUtility.LoginExpectSuccess(ribbon, AddinTestUtility.LoginEmail, AddinTestUtility.LoginPsw); } //Insert item ribbon.InvokeButton(AddinRibbonButton.InsertItem); var itemDlg = InsertItemDriver.FindFromParent(ribbon.ExcelElement); itemDlg.SelectedItem = itemName; itemDlg.AllowPublish = true; itemDlg.SelectInsertVerifySuccess(); //Wait for item to be inserted in item-named worksheet var sheetName = itemName; if (getSecondInstance) { sheetName += " 1"; } var ws = ExcelAutoUtility.GetWorkSheetWithTimeout(_wb.Wb, sheetName, AddinTestUtility.WebServiceResponsePopulateTimeout); //Wait for access to worksheet to be stable ExcelAutoUtility.WaitForNewWorksheetToBeAccessible(ws); return(ws); }
public void CreateItemDialog_CreateSecondItemSameSheet_Success() { var ribbon = AddinRibbonController.Initialize(_app); //Login AddinTestUtility.LoginExpectSuccess(ribbon, AddinTestUtility.LoginEmail, AddinTestUtility.LoginPsw); //Insert item ribbon.InvokeButton(AddinRibbonButton.InsertItem); var itemDlg = InsertItemDriver.FindFromParent(ribbon.ExcelElement); itemDlg.SelectedItem = AddinTestUtility.ReadonlyItemName; itemDlg.AllowPublish = true; itemDlg.SelectInsertVerifySuccess(); //Wait for item to be inserted in item-named worksheet var newlyCreatedItemSheet = ExcelAutoUtility.GetWorkSheetWithTimeout(_wb.Wb, AddinTestUtility.ReadonlyItemName, AddinTestUtility.WebServiceResponsePopulateTimeout); ribbon.Refresh(); Assert.AreEqual(string.Empty, ribbon.ValidateExpectedButtonStates(ExpectedButtonStates.OnPublishableItemCell)); ExcelAutoUtility.SetCellValue(newlyCreatedItemSheet, 2, 48, "singleCellValue"); var range = newlyCreatedItemSheet.get_Range("AV2", "AV2"); range.Select(); //Force ribbon refresh in this special case of selecting range programmatically via excel automation //which does not result in ribbon refresh ribbon.ForceRibbonRefresh(); Assert.AreEqual(string.Empty, ribbon.ValidateExpectedButtonStates(ExpectedButtonStates.OnExistingAllowPublishItemSheetOffItemCell)); //Create the second item var newItemName = "uitest" + AddinTestUtility.GetUniqueSuffix(); var newItemDescr = "sample description #2"; ribbon.Refresh(); ribbon.InvokeButton(AddinRibbonButton.Create); var createItemDlg = CreateItemDriver.FindFromParent(ribbon.ExcelElement); createItemDlg.Name = newItemName; createItemDlg.Desc = newItemDescr; createItemDlg.SelectCreateVerifySuccess(); ribbon.Refresh(); Assert.AreEqual(string.Empty, ribbon.ValidateExpectedButtonStates(ExpectedButtonStates.OnPublishableItemCell)); }