コード例 #1
0
ファイル: Program.cs プロジェクト: sergey-frolov/AutoUpper
 private static void DeletePost(Element post, Browser browser)
 {
     var postId = post.Id.Replace("post-", string.Empty);
     var deletLink = browser.Links.SingleOrDefault(_ =>
         {
             var href = _.GetAttributeValue("href");
             return !string.IsNullOrEmpty(href) && Regex.IsMatch(_.GetAttributeValue("href"),
                                                                 "delete.*" + postId);
         });
     if (deletLink != null)
     {
         var confirmDialogHandler = new ConfirmDialogHandler();
         using (new UseDialogOnce(browser.DialogWatcher, confirmDialogHandler))
         {
             deletLink.ClickNoWait();
             confirmDialogHandler.WaitUntilExists();
             confirmDialogHandler.OKButton.Click();
             browser.WaitForComplete();
         }
     }
     else
     {
         AddToErrorLog(customeMessage: "Номогу найти кнопку удалить у сообщения");
     }
 }
コード例 #2
0
ファイル: canceldiscont.cs プロジェクト: nirvana-info/old_bak
        public void TestUsercanceldiscont(Browser browser,string raid,string raname)
        {
            browser.Link(Find.ByText("平台管理")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("销售折扣管理")).Click();
            browser.WaitUntilContainsText("折扣设置");
            Assert.IsTrue(browser.ContainsText("折扣设置"));

            //状态生效

            browser.RadioButton(Find.ById(raid)).Checked = true;

            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh4 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            browser.AddDialogHandler(dh4);

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnDelete")).ClickNoWait();
            dh4.WaitUntilExists(15);//
            dh4.OKButton.Click();//

            browser.RemoveDialogHandler(dh4);
            Thread.Sleep(1000);
            Assert.IsFalse(browser.ContainsText(raname));
        }
コード例 #3
0
        public override bool HandleDialog(Window window)
        {
            if (dialogHandler.CanHandleDialog(window))
            {
                dialogHandler.window = window;

                message = dialogHandler.Message;

                ConfirmDialogHandler confirmDialogHandler = dialogHandler as ConfirmDialogHandler;

                // hasHandledDialog must be set before the Click and not
                // after because this code executes on a different Thread
                // and could lead to property HasHandledDialog returning false
                // while hasHandledDialog set had to be set.
                hasHandledDialog = true;

                if (confirmDialogHandler != null && clickCancelButton)
                {
                    confirmDialogHandler.CancelButton.Click();
                }
                else
                {
                    dialogHandler.OKButton.Click();
                }
            }

            return(hasHandledDialog);
        }
コード例 #4
0
ファイル: 01_salesgoods.cs プロジェクト: nirvana-info/old_bak
        public void chech1_01_02_salessource()
        {
            //挂牌资源
            ie.Span(Find.ByText("交易平台")).Click();
            ie.Link(Find.ByUrl(url+"Trade/ReceiptSummary.aspx?usertype=sales")).Click();
            ie.Button(Find.ById("ctl00_ContentPlaceHolder1_gpbtn")).WaitUntilExists(120);
            Assert.IsTrue(ie.ContainsText("资源挂牌"));

            ie.Image(Find.ByAlt("在线上传")).Click();
            ie.Span(Find.ByText("资源录入/编辑")).WaitUntilExists(120);
            //无捆包
            ie.SelectList(Find.ById("ctl00_ContentPlaceHolder1_cmbCategory")).Option(Find.ByValue("100000101")).Select();
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_cz")).TypeText("功能测试专用1");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_sccj")).TypeText("功能测试专用1");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_gg_h")).TypeText("1");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_gg_k")).TypeText("1");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_gg_c")).TypeText("1");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_weight")).TypeText("1");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_price")).TypeText("100");
            string Date = DateTime.Today.ToString("yyyy-MM-dd");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_manufacturedate")).TypeText(Date);
            //提交后继续添加
            ie.Button(Find.ById("ctl00_ContentPlaceHolder1_Button3")).Click();
            //有捆包
            ie.SelectList(Find.ById("ctl00_ContentPlaceHolder1_cmbCategory")).Option(Find.ByValue("100000101")).Select();
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_cz")).TypeText("功能测试专用2");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_sccj")).TypeText("功能测试专用2");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_gg_h")).TypeText("1");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_gg_k")).TypeText("1");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_gg_c")).TypeText("1");

            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_price")).TypeText("100");
            //string Date = DateTime.Today.ToString("yyyy-MM-dd");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_manufacturedate")).TypeText(Date);
            //添加捆包
            ie.Button(Find.ById("ctl00_ContentPlaceHolder1_Button1")).Click();
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_GridView1_ctl02_txtkbh")).TypeText("1");
            ie.TextField(Find.ById("ctl00_ContentPlaceHolder1_GridView1_ctl02_txtqty")).TypeText("1");
            ie.Button(Find.ById("ctl00_ContentPlaceHolder1_Button1")).Click();
            //提交
            ie.Button(Find.ById("ctl00_ContentPlaceHolder1_Button2")).Click();
            ie.Button(Find.ById("ctl00_ContentPlaceHolder1_gpbtn")).WaitUntilExists(120);

            //关闭警告窗口
            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            ie.AddDialogHandler(dh);
            ie.Button(Find.ById("ctl00_ContentPlaceHolder1_gpallbtn")).ClickNoWait();
            //ie.Image(Find.ByAlt("Add")).ClickNoWait();
            dh.WaitUntilExists(15);//
            dh.OKButton.Click();//

            ie.RemoveDialogHandler(dh);
            //ie.Close();
        }
コード例 #5
0
        //public static string ladorderid;
        public void TestUserladbilldeliversearch(Browser browser, string url, string orderid)
        {
            browser.Link(Find.ByText("我要销售")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("可发资源查询")).Click();
            browser.WaitUntilContainsText("可提资源查询");
            Assert.IsTrue(browser.ContainsText("可提资源查询"));
            //先清空

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnCleanDelivery")).ClickNoWait();
            /*
             //测试用
            string ss = "0904000070";
            int s1 = int.Parse(ss);
            int s2 = s1 + 1;
            string ss1 = s2.ToString();
            */
            //
            Thread.Sleep(1500);
            browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtOrderCode")).TypeText(orderid);

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_Button1")).Click();

            //截取ID
            string l1 = browser.Span(Find.ByText("焊接用钢盘条")).Id;
            string l3 = l1.Trim().Substring(13, 4);

            browser.Link(Find.ById("a_order_" + l3)).Click();

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_NextStepBtn")).Click();

            browser.WaitUntilContainsText("在此页面中您可选择对此提单的处理方式,如无疑义,可点击创建提单完成");
            Assert.IsTrue(browser.ContainsText("在此页面中您可选择对此提单的处理方式,如无疑义,可点击创建提单完成"));
            browser.Table(Find.ById("ctl00_ContentPlaceHolder1_GridView1")).TableRow(Find.ByClass("RowBg")).WaitUntilExists(10);
            //Assert.AreEqual("xx",browser.Table(Find.ById("ctl00_ContentPlaceHolder1_GridView1")).TableRow(Find.ByClass("RowBg")).TableCells[1].Text);
            string ladorderid = browser.Table(Find.ById("ctl00_ContentPlaceHolder1_GridView1")).TableRow(Find.ByClass("RowBg")).TableCells[1].Text;

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_Button3")).Click();

            //发货单确认
            browser.Link(Find.ByText("发货单确认")).Click();
            browser.WaitUntilContainsText("提单管理");
            Assert.IsTrue(browser.ContainsText("提单管理"));

            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh2 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            browser.AddDialogHandler(dh2);

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_GridView1_ctl02_ConfirmBtn")).ClickNoWait();
            dh2.WaitUntilExists(15);//
            dh2.OKButton.Click();//
            browser.RemoveDialogHandler(dh2);
        }
コード例 #6
0
 public void ClickOk()
 {
     var handler = new ConfirmDialogHandler();
     using (new UseDialogOnce(_browser.DialogWatcher, handler))
     {
         _action();
         handler.WaitUntilExists();
         handler.OKButton.Click();
         _browser.WaitForComplete();
     }
 }
コード例 #7
0
ファイル: Steps.cs プロジェクト: mmozuras/Specflow.WatiN
 void Confirm(Action action)
 {
     //TODO: Doesn't work. Can't figure out why...
     var dialogHandler = new ConfirmDialogHandler();
     using (new UseDialogOnce(Browser.DialogWatcher, dialogHandler))
     {
         action();
         dialogHandler.WaitUntilExists();
         dialogHandler.OKButton.Click();
         Browser.WaitForComplete();
     }
 }
コード例 #8
0
        public void Should_also_handle_dialog_when_more_then_one_browser_is_open()
        {
            var not_used_ie = new IE();
            var approveConfirmDialog = new ConfirmDialogHandler();

            using (new UseDialogOnce(Ie.DialogWatcher, approveConfirmDialog))
            {
                Ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
                approveConfirmDialog.WaitUntilExists(5);
                approveConfirmDialog.OKButton.Click();
            }
            Ie.WaitForComplete();
        }
コード例 #9
0
 public void WhenIClickDeleteInTheUserTableAndConfirmTheDeletion(string displayName)
 {
     Thread.Sleep(1500);
     UserPage.AllDisplayLink.ClickNoWait();
     Thread.Sleep(1000);
     var dialog = new ConfirmDialogHandler();
     using (new UseDialogOnce(IEInstance.DialogWatcher, dialog))
     {
         UserPage.GetUserDeleteButton(displayName).ClickNoWait();
         dialog.WaitUntilExists();
         dialog.OKButton.Click();
     }
     Thread.Sleep(1500);
 }
コード例 #10
0
        public void Bug_1958882_SelectNoWait_is_waiting_somewhere()
        {
            Logging.Logger.LogWriter = new Logging.ConsoleLogWriter();
            Ie.GoTo(TestEventsURI);

            var confirm = new ConfirmDialogHandler();
            using (new UseDialogOnce(Ie.DialogWatcher, confirm))
            {
                Ie.SelectList(Find.ById("selectList")).Option(Find.ByValue("2")).SelectNoWait();

                confirm.WaitUntilExists();
                confirm.OKButton.Click();
            }
        }
コード例 #11
0
        public void TestUserladingbillmanageadmin(Browser browser, string url)
        {
            browser.Link(Find.ByText("提单管理")).Click();
            browser.WaitUntilContainsText("提单管理");
            Assert.IsTrue(browser.ContainsText("提单管理"));

            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh2 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            browser.AddDialogHandler(dh2);

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_GridView1_ctl02_ConfirmBtn")).ClickNoWait();
            dh2.WaitUntilExists(15);//
            dh2.OKButton.Click();//
            browser.RemoveDialogHandler(dh2);
        }
コード例 #12
0
        public void chech1_03_03_addshoppingcar()
        {
            //buy
            ie.Image(Find.ByAlt("buy product")).Click();
            //ie.TextField(Find.ById("txtTimeBargain_Qty_113669")).TypeText("1");
            //ie.Button(Find.ByClass("addBuyCartBtn")).Click();
            Thread.Sleep(1500);
            //关闭警告窗口
            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            ie.AddDialogHandler(dh);
            ie.Link(Find.ById("ctl00_ContentPlaceHolder1_linkBuildOrders")).ClickNoWait();

            dh.WaitUntilExists(3);//
            dh.OKButton.Click();//
            ie.RemoveDialogHandler(dh);
        }
コード例 #13
0
        public void ConfirmJavaDialogHandler()
        {
            WatiN.Core.Settings.AutoMoveMousePointerToTopLeft = false;
            WatiN.Core.Settings.MakeNewIeInstanceVisible = true;

            using (WatiN.Core.IE ie = new IE(Path.Combine(System.Environment.CurrentDirectory, "testpage1.htm")))
            {
                ie.BringToFront();
                WatiN.Core.DialogHandlers.ConfirmDialogHandler handler = new ConfirmDialogHandler();
                ie.DialogWatcher.Add(handler);

                ie.Link("linkConfirm").ClickNoWait();
                handler.WaitUntilExists(2000);

                Assert.AreEqual("Continue", handler.Message);

                handler.OKButton.Click();

            }
        }
コード例 #14
0
ファイル: WorkflowSteps.cs プロジェクト: biganth/Curt
        public void WhenISubmitContentOfModule0(int moduleId)
        {
            ModulePage.GetEditModuleContentLink(moduleId).Click();
            if (!HTMLModule.PublishCheckBox.Enabled)
            {
                var dialog = new ConfirmDialogHandler();
                using (new UseDialogOnce(IEInstance.DialogWatcher, dialog))
                {
                    HTMLModule.SaveContentLink.Click();
                    dialog.WaitUntilExists();
                    dialog.OKButton.Click();
                }

                ModulePage.GetEditModuleContentLink(moduleId).Click();
            }
            HTMLModule.PublishCheckBox.Checked = true;
            HTMLModule.SaveContentLink.Click();
            HTMLModule.CommentTextField.Value = "Submit Comment";
            HTMLModule.AddCommentLink.Click();
            WaitAjaxRequestComplete();
        }
コード例 #15
0
        public void ConfirmDialogHandlerOK()
        {
            Assert.AreEqual(0, Ie.DialogWatcher.Count, "DialogWatcher count should be zero");

            var confirmDialogHandler = new ConfirmDialogHandler();

            using (new UseDialogOnce(Ie.DialogWatcher, confirmDialogHandler))
            {
                Ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();

                confirmDialogHandler.WaitUntilExists();

                var message = confirmDialogHandler.Message;
                confirmDialogHandler.OKButton.Click();

                Ie.WaitForComplete();

                Assert.AreEqual("Do you want to do xyz?", message, "Unexpected message");
                Assert.AreEqual("OK", Ie.TextField("ReportConfirmResult").Text, "OK button expected.");
            }
        }
コード例 #16
0
ファイル: cancelsource.cs プロジェクト: nirvana-info/old_bak
        public void TestUsercancelsource(Browser browser)
        {
            browser.Link(Find.ById("ctl00_linkTrade")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("我要销售")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("资源撤牌管理")).Click();
            browser.WaitUntilContainsText("本页可选择需要撤牌的资源,进行撤牌");
            Assert.IsTrue(browser.ContainsText("本页可选择需要撤牌的资源,进行撤牌"));

            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh2 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            browser.AddDialogHandler(dh2);

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnTakeDownAll")).ClickNoWait();
            dh2.WaitUntilExists(15);//
            dh2.OKButton.Click();//
            browser.RemoveDialogHandler(dh2);
        }
コード例 #17
0
ファイル: checkdiscount.cs プロジェクト: nirvana-info/old_bak
        public void TestUsercheckdiscount(Browser browser, string url, string material, string date1, string number)
        {
            browser.Link(Find.ById("ctl00_linkTrade")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("我要采购")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));
            //采购
            browser.Link(Find.ByUrl(url + "SearchProduct.aspx")).Click();
            browser.WaitUntilContainsText("清空购物车");
            Assert.IsTrue(browser.ContainsText("清空购物车"));
            //查询资源
            browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtSteel_Num")).TypeText(material + date1);
            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnSearch1")).Click();
            //清空购物车
            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh2 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            browser.AddDialogHandler(dh2);

            browser.Link(Find.ById("ctl00_ContentPlaceHolder1_linkClearCart")).ClickNoWait();
            dh2.WaitUntilExists(15);//
            dh2.OKButton.Click();//
            browser.RemoveDialogHandler(dh2);
            Thread.Sleep(1500);
            //点击该资源并购买

            browser.Image(Find.ByAlt("buy product")).Click();
            browser.TextField(Find.ByClass("cinput")).TypeText(number);
            browser.WaitUntilContainsText(number);
            Assert.IsTrue(browser.ContainsText(number));
            browser.Button(Find.ByClass("addBuyCartBtn")).Click();
            Thread.Sleep(1500);
            browser.WaitUntilContainsText("优惠后总额 900.00元");
            Assert.IsTrue(browser.ContainsText("优惠后总额 900.00元"));
        }
コード例 #18
0
        public void chech1_03_04_confirmorder()
        {
            //生成意向订单
            //关闭警告窗口
            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh1 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            ie.AddDialogHandler(dh1);
            ie.Button(Find.ById("ctl00_ContentPlaceHolder1_btnBuld")).ClickNoWait();

            dh1.WaitUntilExists(3);//
            dh1.OKButton.Click();//
            ie.RemoveDialogHandler(dh1);

            ie.RadioButton(Find.ByName("radionSelect")).Checked = true;
            ie.Button(Find.ById("btnNoBargain")).Click();
            ie.TableCell(Find.ByText("bobby002")).WaitUntilExists(120);
            //确定
            Thread.Sleep(1500);
            //提货功能暂时只能自提,选择功能先关闭
            //ie.Frame(Find.ById("wheatmsg_ifrm")).SelectList(Find.ById("selTransport")).Option(Find.ByValue("2")).Select();
            ie.Frame(Find.ById("wheatmsg_ifrm")).Button(Find.ById("btnYes")).Click();
            ie.Span(Find.ByText("合同生效配款")).WaitUntilExists(120);
            Assert.IsTrue(ie.ContainsText("合同生效配款"));
        }
コード例 #19
0
ファイル: UserTests.cs プロジェクト: neogic/DotNetNuke_SVN
 public void Delete_User()
 {
     //Arrange
     AddUser("user1", "user1FN", "user1LN", "User1 DN", "*****@*****.**", "password");
     ConfirmDialogHandler dialog = new ConfirmDialogHandler();
     ie.GoToDNNUrl("Admin/UserAccounts.aspx");
     //Act
     using (new UseDialogOnce(ie.DialogWatcher, dialog))
     {
         ie.Button(Find.ByTitle("Delete")).ClickNoWait();
         dialog.WaitUntilExists();
         dialog.OKButton.Click();
     }
     ie.WaitForComplete();
     //Assert
     ie.GoToDNNUrl("Admin/UserAccounts.aspx");
     Assert.IsFalse(ie.Element(Find.ById("dnn_ctr365_Users_UP")).InnerHtml.Contains("user1"));
 }
コード例 #20
0
        public void TestMultipleIE()
        {
            using (var ie = new IE(TestEventsURI))
            {
                var handler = new ConfirmDialogHandler();
                try
                {
                    ie.AddDialogHandler(handler);
                    ie.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
                    handler.WaitUntilExists(5);
                    handler.OKButton.Click();
                }
                finally
                {
                    ie.RemoveDialogHandler(handler);
                }

                using (var ie2 = new IE(TestEventsURI))
                {
                    var handler2 = new ConfirmDialogHandler();
                    try
                    {
                        ie2.AddDialogHandler(handler2);
                        ie2.Button(Find.ByValue("Show confirm dialog")).ClickNoWait();
                        handler2.WaitUntilExists(5);
                        handler2.OKButton.Click();
                    }
                    finally
                    {
                        ie2.RemoveDialogHandler(handler2);
                    }
                }
            }
        }
コード例 #21
0
        public void Remove_Poll_Completly_Test()
        {
            if (this.testPollTopicUrl.IsNotSet())
            {
                this.CreatePollTopicTest(allowMultiVote: false, addPollImages: false);
            }

            // Go To New Test Topic Url
            this.browser.GoTo(this.testPollTopicUrl);

            // Go to edit Page
            this.browser.Link(Find.ById(new Regex("_Edit_0"))).Click();

            Assert.IsTrue(this.browser.ContainsText("Remove Poll"), "Editing not allowed for that user");

            var delete = this.browser.Link(Find.ById(new Regex("_RemovePollAll_0")));

            var confirmDialog = new ConfirmDialogHandler();
            using (new UseDialogOnce(browser.DialogWatcher, confirmDialog))
            {
                delete.ClickNoWait();
                confirmDialog.WaitUntilExists();
                confirmDialog.OKButton.Click();
                browser.WaitForComplete();
            }

            Assert.IsTrue(this.browser.ContainsText("Create Poll"), "Deleting Poll failed");
        }
コード例 #22
0
        public override bool ChangePositionTo(Position newPosition)
        {
            Framework.CallTrace("Change position called to: " + newPosition.ToString());
            Ie.GoTo(Links.NewOrder);

            string s = Ie.Html;
            Ie.SelectList(Find.ByName("SecCode")).SelectByValue("PL0GF0000281"); //fw20
            Ie.SelectList(Find.ByName("OrdType")).SelectByValue(newPosition.Direction); //order


            Ie.TextField(Find.ByName("OrdQty")).TypeText(newPosition.Size.ToString()); //size of position
            Ie.SelectList(Find.ByName("OrdLimitType")).SelectByValue("P"); //P = PKC
            Ie.WaitForComplete(1);
            
            Ie.Button(Find.ByName("bc")).Click(); //przelicz

            if (Framework.Inst.OrderingEnabled)
            {
                Framework.CallTrace("Executing order...");
                var confirmDialogHandler = new ConfirmDialogHandler();
                Ie.DialogWatcher.Add(confirmDialogHandler);

                Ie.Button(Find.ByName("bs")).ClickNoWait(); //ORDER !!!
                
                confirmDialogHandler.WaitUntilExists();
                confirmDialogHandler.OKButton.Click(); //CONFIRM
                Ie.WaitForComplete();
                Ie.DialogWatcher.RemoveAll(confirmDialogHandler);   
            }

            Position = newPosition;
            Framework.CallTrace("Change position OK. CurrentPos: " + Position.ToString());
            return true;
        }
コード例 #23
0
 public void Delete_Host_User()
 {
     //Arrange
     AddHostUser("host2", "hostFN", "hostLN", "Host DN", "*****@*****.**", "password");
     ConfirmDialogHandler dialog = new ConfirmDialogHandler();
     //Act
     using (new UseDialogOnce(ie.DialogWatcher, dialog))
     {
         ie.Button(Find.ByTitle("Delete")).ClickNoWait();
         dialog.WaitUntilExists();
         dialog.OKButton.Click();
     }
     ie.WaitForComplete();
     //Assert
     Assert.IsFalse(ie.Element(Find.ById("dnn_ctr343_Users_UP")).InnerHtml.Contains("host2"));
 }
コード例 #24
0
        public void WhenMovingTheFileFromFolder1ToFolder2()
        {
            SelectTreeNode("folder1");
            var checkbox = FileManagerPage.FolderContentsTable.Span(Find.BySelector("[filename=\"Do Change.doc\"]"))
                            .CheckBox(Find.ById(new Regex(@".*dgFileList_ctl(\d*)_chkFile.*", RegexOptions.IgnoreCase)));
            checkbox.Checked = true;

            var dialog = new ConfirmDialogHandler();
            using (new UseDialogOnce(IEInstance.DialogWatcher, dialog))
            {
                FileManagerPage.MoveFileImage.ClickNoWait();
                dialog.WaitUntilExists();
                dialog.OKButton.Click();
            }

            SelectTreeNode("folder2");
            FileManagerPage.MoveFileOKButton.Click();
        }
コード例 #25
0
        public void Remove_Buddy_Test()
        {
            Assert.IsTrue(this.LoginUser(), "Login failed");

            this.browser.GoTo("{0}yaf_cp_editbuddies.aspx".FormatWith(TestConfig.TestForumUrl));

            Assert.IsTrue(this.browser.ContainsText("Pending Requests"), "My Buddies function is not available for that User, or is disabled for that Forum");

            // Select the Newest Buddy
            var delete = this.browser.Link(Find.ById(new Regex("_BuddyList1_rptBuddy_lnkRemove_0")));

            Assert.IsNotNull(delete, "Currently the Test User doesnt have any Buddies");

            var confirmDialog = new ConfirmDialogHandler();
            using (new UseDialogOnce(this.browser.DialogWatcher, confirmDialog))
            {
                delete.ClickNoWait();
                confirmDialog.WaitUntilExists();
                confirmDialog.OKButton.Click();
                this.browser.WaitForComplete();
            }

            Assert.IsTrue(this.browser.ContainsText("has been removed from your Buddy list."), "Remove Buddy Failed");

            this.browser.Button(Find.ById(new Regex("_OkButton"))).Click();
        }
コード例 #26
0
ファイル: UserTests.cs プロジェクト: neogic/DotNetNuke_SVN
 public void Delete_Unauthorised_Users()
 {
     String userName;
     //Arrange
     ConfirmDialogHandler dialog = new ConfirmDialogHandler();
     for (int i = 0; i < 3; i++)
     {
         userName = "******" + (i+1);
         AddUser(userName, "Fname", "Lname", "Display Name", "*****@*****.**", "password");
     }
     //Act
     UnauthoriseUser("user1");
     UnauthoriseUser("user2");
     using (new UseDialogOnce(ie.DialogWatcher, dialog))
     {
         ie.Link(Find.ByTitle("Delete Unauthorized Users")).ClickNoWait();
         dialog.WaitUntilExists();
         dialog.OKButton.Click();
     }
     ie.WaitForComplete();
     //Assert
     Assert.IsFalse(ie.Element(Find.ById("dnn_ctr365_Users_UP")).InnerHtml.Contains("user1"));
     Assert.IsFalse(ie.Element(Find.ById("dnn_ctr365_Users_UP")).InnerHtml.Contains("user2"));
 }
コード例 #27
0
        public void TestUserbargainingorder(Browser browser, string url, string material, string date1, string number, string ordertype, string button)
        {
            //#*****************************************************************************
            //# Purpose: define User placeorder function.
            //# Author:  bobby
            //# Last Modify: apr 13, 2009
            //#*****************************************************************************

            browser.Link(Find.ById("ctl00_linkTrade")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("我要采购")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));
            //采购
            browser.Link(Find.ByUrl(url + "SearchProduct.aspx")).Click();
            browser.WaitUntilContainsText("清空购物车");
            Assert.IsTrue(browser.ContainsText("清空购物车"));
            //查询资源
            browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtSteel_Num")).TypeText(material + date1);
            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnSearch1")).Click();
            //清空购物车
            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh2 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            browser.AddDialogHandler(dh2);

            browser.Link(Find.ById("ctl00_ContentPlaceHolder1_linkClearCart")).ClickNoWait();
            dh2.WaitUntilExists(15);//
            dh2.OKButton.Click();//
            browser.RemoveDialogHandler(dh2);
            Thread.Sleep(1500);
            //点击该资源并购买

            browser.Image(Find.ByAlt("buy product")).Click();
            browser.TextField(Find.ByClass("cinput")).TypeText(number);
            browser.WaitUntilContainsText(number);
            Assert.IsTrue(browser.ContainsText(number));
            browser.Button(Find.ByClass("addBuyCartBtn")).Click();
            Thread.Sleep(1500);
            //点击pop出来的确认对话框
            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            browser.AddDialogHandler(dh);

            browser.Link(Find.ById("ctl00_ContentPlaceHolder1_linkBuildOrders")).ClickNoWait();
            dh.WaitUntilExists(15);//
            dh.OKButton.Click();//
            browser.RemoveDialogHandler(dh);

            //自动分单
            browser.WaitUntilContainsText("系统自动分单");
            Assert.IsTrue(browser.ContainsText("系统自动分单"));

            browser.SelectList(Find.ById("ctl00_ContentPlaceHolder1_dlPreviewList_ctl00_cmbPurcharseordertype")).Option(Find.ByText(ordertype)).Select();

            //点击pop出来的确认对话框
            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh1 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            browser.AddDialogHandler(dh1);

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnBuld")).ClickNoWait();
            dh1.WaitUntilExists(3);//
            dh1.OKButton.Click();//
            browser.RemoveDialogHandler(dh1);

            //意向订单
            browser.WaitUntilContainsText("选择需要的订单,生成意向订单");
            Assert.IsTrue(browser.ContainsText("选择需要的订单,生成意向订单"));
            browser.RadioButton(Find.ByName("radionSelect")).Checked = true;

            //意向订单-->订单生效
            //这个要参数化
            browser.Button(Find.ById(button)).Click();

            browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtDiscount")).TypeText("10");

            //WatiN.Core.DialogHandlers.AlertAndConfirmDialogHandler dh3 = new WatiN.Core.DialogHandlers.AlertAndConfirmDialogHandler();

            //browser.AddDialogHandler(dh3);

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnSubmit")).ClickNoWait();
            //dh3.WaitUntilExists(3);//
            //dh3.OKButton.Click();//
            //browser.RemoveDialogHandler(dh3);

            //Thread.Sleep(2000);
        }
コード例 #28
0
ファイル: LanguageSteps.cs プロジェクト: biganth/Curt
        public void ThenIDeleteTheLanguage(string languageName)
        {
            LanguagePage.GetCheckBoxForLanguage(languageName).Click();
            IEInstance.WaitForComplete();
            LanguagePage.GetEditLanguageButtonForLanguage(languageName).Click();
            IEInstance.WaitForComplete();
            LanguagePage.GetEditLanguageButtonForLanguage(languageName).Click();
            IEInstance.WaitForComplete();

            var dialog = new ConfirmDialogHandler();
            using (new UseDialogOnce(IEInstance.DialogWatcher, dialog))
            {
                LanguagePage.DeleteLanguageLink.ClickNoWait();
                dialog.WaitUntilExists();
                dialog.OKButton.Click();
            }
        }
コード例 #29
0
        public void WhenIDeleteTestuser(string user)
		{
			var approveConfirmDialog = new ConfirmDialogHandler();
            var deleteButton = HostUserPage.GetUserDeleteButton(user);
			//remove the confirm window because it can't handle by WatIn in IE9, will update this code
			//after update the confirm window with dnn jquery confirm plugin.
			deleteButton.SetAttributeValue("onclick", "return true");
			deleteButton.Click();
			Thread.Sleep(2500);
            var removeButton = HostUserPage.GetUserRemoveButton(user);
			removeButton.SetAttributeValue("onclick", "return true");
			removeButton.Click();

			Thread.Sleep(2500);
		}
コード例 #30
0
ファイル: salesource.cs プロジェクト: nirvana-info/old_bak
        public void TestUsersales(Browser browser,string bigsource,string littlesource,string size,string material,string made,string weight,string price,string date1,string date,string storehouse)
        {
            //#*****************************************************************************
            //# Purpose: define User sales function.
            //# Author:  bobby
            //# Last Modify: apr 13, 2009
            //#*****************************************************************************

            browser.Link(Find.ById("ctl00_linkTrade")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("我要销售")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("资源挂牌")).Click();
            browser.WaitUntilContainsText("可选择以下两种上传方式");
            Assert.IsTrue(browser.ContainsText("可选择以下两种上传方式"));
            //清空失误
            if (browser.Link(Find.ById("ctl00_ContentPlaceHolder1_GridView1_ctl02_edititem")).Exists)
            {
                WatiN.Core.DialogHandlers.ConfirmDialogHandler dh1 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

                browser.AddDialogHandler(dh1);

                browser.Button(Find.ByValue("全部删除")).ClickNoWait();
                dh1.WaitUntilExists(15);//

                dh1.OKButton.Click();//
                dh1.WaitUntilExists(15);

                dh1.OKButton.Click();
                browser.RemoveDialogHandler(dh1);

            }

                browser.Image(Find.ByAlt("在线上传")).Click();
                browser.WaitUntilContainsText("提示:此处显示所选品种的规格填写规则,单位 为毫米");
                Assert.IsTrue(browser.ContainsText("提示:此处显示所选品种的规格填写规则,单位 为毫米"));
                //大品种
                browser.SelectList(Find.ById("ctl00_ContentPlaceHolder1_cmbCategory")).Option(bigsource).Select();
                browser.WaitUntilContainsText(bigsource);
                Assert.IsTrue(browser.ContainsText(bigsource));
                //小品种
                browser.SelectList(Find.ById("ctl00_ContentPlaceHolder1_cmbProductName")).Option(littlesource).Select();
                browser.WaitUntilContainsText(littlesource);
                Assert.IsTrue(browser.ContainsText(littlesource));
                //规格
                browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_gg_h")).TypeText(size);
                browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_gg_k")).TypeText(size);
                browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_gg_c")).TypeText(size);
                //材质
                browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_cz")).TypeText(material + date1);
                //厂家
                browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_sccj")).TypeText(made + date1);
                //重量
                browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_weight")).TypeText(weight);
                //价格
                browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_price")).TypeText(price);
                //日期
                browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_manufacturedate")).TypeText(date);
                //仓库
                browser.SelectList(Find.ById("ctl00_ContentPlaceHolder1_cmblistck")).Option(storehouse).Select();
                browser.WaitUntilContainsText(storehouse);
                Assert.IsTrue(browser.ContainsText(storehouse));
                //确定资源录入
                browser.Button(Find.ById("ctl00_ContentPlaceHolder1_Button2")).Click();
                //挂牌
                browser.CheckBox(Find.ById("ctl00_ContentPlaceHolder1_GridView1_ctl02_gv_Chk")).Checked = true;
                browser.WaitUntilContainsText("可选择以下两种上传方式");
                Assert.IsTrue(browser.ContainsText("可选择以下两种上传方式"));
                //第一次
                WatiN.Core.DialogHandlers.ConfirmDialogHandler dh = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

                browser.AddDialogHandler(dh);

                browser.Button(Find.ByValue("全部挂")).ClickNoWait();
                dh.WaitUntilExists(15);//

                dh.OKButton.Click();//
                dh.WaitUntilExists(15);

                dh.OKButton.Click();
                browser.RemoveDialogHandler(dh);
        }
コード例 #31
0
ファイル: adddiscount.cs プロジェクト: nirvana-info/old_bak
        public void TestUseradddiscount(Browser browser,string date)
        {
            browser.Link(Find.ByText("平台管理")).Click();
            browser.WaitUntilContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南");
            Assert.IsTrue(browser.ContainsText("请在左边的菜单选择您要进行的操作。 如有疑问,请点击下面相关链接查看操作流程图或查看交易指南"));

            browser.Link(Find.ByText("销售折扣管理")).Click();
            browser.WaitUntilContainsText("折扣设置");
            Assert.IsTrue(browser.ContainsText("折扣设置"));
            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnNew")).Click();
            //日期
            browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtStartDate")).TypeText(date);
            browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_txtEndDate")).TypeText(date);
            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnPricelistDetail")).Click();
            /*
            //选供应商
            browser.Image(Find.ByTitle("供应商查询")).ClickNoWait();

            Browser DW=IE.AttachToIE(Find.ByUrl("http://192.168.0.21/Trade/Price/OrgDetail.aspx?index=ctl00_ContentPlaceHolder1_gvDetail_ctl02_"));

            DW.TextField("txtDWMC").TypeText("自动供应商");
            DW.Button("btnSearch").Click();
            //DW.Button(Find.ByName("1001")).Click();
            DW.Button(Find.ByValue("选择")).Click();

            /*
            //选小品种
            browser.Image(Find.ByTitle("品种查询")).ClickNoWait();
            Browser DW1=IE.AttachToIE(Find.ByUrl("http://192.168.0.21/Trade/Price/Product.aspx?orgid=0&index=ctl00_ContentPlaceHolder1_gvDetail_ctl02_"));
            browser.WaitUntilContainsText("小品种代码");
            DW1.TextField(Find.ById("txtProductName")).TypeText("焊接用钢盘条");
            DW1.Button(Find.ById("btnSearch")).Click();
            DW1.Button(Find.ByValue("选择")).Click();*/

            //选资源
            browser.Image(Find.ByTitle("资源查询")).ClickNoWait();
            Browser DW2=IE.AttachToIE(Find.ByUrl("http://192.168.0.21/Trade/Price/ProductDetail.aspx?orgid=0&productid=0&index=ctl00_ContentPlaceHolder1_gvDetail_ctl02_"));
            browser.WaitForComplete(120);
            DW2.TextField(Find.ById("txtcz")).TypeText("脚本");
            DW2.Button(Find.ById("Button1")).Click();
            DW2.Button(Find.ByValue("选择")).Click();

            browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_gvDetail_ctl02_txtQty")).TypeText("1");
            browser.TextField(Find.ById("ctl00_ContentPlaceHolder1_gvDetail_ctl02_txtAmount")).TypeText("100");

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnSave")).ClickNoWait();
            browser.WaitUntilContainsText("折扣设置");
            Assert.IsTrue(browser.ContainsText("折扣设置"));

            //状态生效
            raid=browser.RadioButton(Find.ByName("radionSelect")).Id;
            browser.RadioButton(Find.ByName("radionSelect")).Checked = true;

            WatiN.Core.DialogHandlers.ConfirmDialogHandler dh4 = new WatiN.Core.DialogHandlers.ConfirmDialogHandler();

            browser.AddDialogHandler(dh4);

            browser.Button(Find.ById("ctl00_ContentPlaceHolder1_btnEffect")).ClickNoWait();
            dh4.WaitUntilExists(15);//
            dh4.OKButton.Click();//
            dh4.WaitUntilExists(15);

            dh4.OKButton.Click();
            browser.RemoveDialogHandler(dh4);
            Thread.Sleep(1000);
        }