コード例 #1
0
        public void PublishDialog_ViaPublishItems_Success()
        {
            var ribbon = AddinRibbonController.Initialize(_app);

            //Insert an item to modify
            var ws = InsertOKToModifyItemData(ribbon, AddinTestUtility.ModifiableItemName,
                                              false); //getSecondInstance

            //Modify a cell
            var modValRow = 3;
            var modValCol = 2;
            int newVal    = Convert.ToInt32(ExcelAutoUtility.GetCellValue(ws, modValRow, modValCol)) + 1;

            ExcelAutoUtility.SetCellValue(ws, modValRow, modValCol, newVal);

            //Publish

            //Get ribbon tab automation element again to get its newly-enabled instances of descendant buttons
            ribbon.Refresh();

            ribbon.InvokeButton(AddinRibbonButton.PublishItems);

            var pubDlg = PublishDriver.FindFromParent(ribbon.ExcelElement);

            pubDlg.SelectPublishVerifySuccess();

            //Verify
            ribbon.Refresh();
            Assert.AreEqual(string.Empty, ribbon.ValidateExpectedButtonStates(ExpectedButtonStates.OnPublishableItemCell));

            ws = InsertOKToModifyItemData(ribbon, AddinTestUtility.ModifiableItemName,
                                          true); //getSecondInstance

            Assert.AreEqual(newVal, Convert.ToInt32(ExcelAutoUtility.GetCellValue(ws, modValRow, modValCol)));
        }
コード例 #2
0
        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));
        }