Пример #1
0
 public void AnyOperationRunner()
 {
     RunInAllBrowsers(browser =>
     {
         browser.NavigateToUrl("/test/FindElements");
         AssertUI.Any(browser.FindElements("div p")).InnerTextEquals("a");
     });
 }
Пример #2
0
 public void AnyOperationRunner_FailureExpected()
 {
     Assert.ThrowsAny <Exception>(() =>
     {
         RunInAllBrowsers(browser =>
         {
             browser.NavigateToUrl("/test/FindElements");
             AssertUI.Any(browser.FindElements("div p")).InnerTextEquals("1");
         });
     });
 }
Пример #3
0
 public void CheckValueAnyTest()
 {
     RunInAllBrowsers(browser =>
     {
         browser.NavigateToUrl("valuetest.aspx");
         var elements = new[]
         {
             browser.First("#checkbox1"),
             browser.First("#checkbox2")
         };
         AssertUI.Any(elements).CheckIfValue("checkboxvalue1");
     });
 }
Пример #4
0
        public void Feature_Api_GetCollection()
        {
            RunInAllBrowsers(browser => {
                browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_Api_GetCollection);

                // click the first button (ID = 11)
                browser.WaitFor(() => {
                    browser.First(".id-company[data-company-id='11'] input[type=button]").Click()
                    .Wait();
                }, 30000, "Cannot find CompanyID = 11. Probably data are not loaded. (The page did not load in 5s.)");

                // ensure that orders have been loaded
                var orders = browser.FindElements(".id-order");
                AssertUI.Any(orders).Attribute("data-order-id", "6");

                var idToDelete = orders[2].GetAttribute("data-order-id");       // every order has two elements (read-only and edit)

                // delete order (ID = 7)
                browser.First($".id-order[data-order-id='{idToDelete}'] input[type=button][value=Delete]").Click().Wait();
                orders = browser.FindElements(".id-order");
                AssertUI.Any(orders).Attribute("data-order-id", "6");
                AssertUI.All(orders).Attribute("data-order-id", s => s != idToDelete);

                // click the second button (ID = 12)
                browser.First(".id-company[data-company-id='12'] input[type=button]").Click().Wait();

                // ensure that orders have been loaded
                orders = browser.FindElements(".id-order");
                AssertUI.Any(orders).Attribute("data-order-id", "2");
                AssertUI.Any(orders).Attribute("data-order-id", "9");

                // edit order (ID = 2)
                browser.First(".id-order[data-order-id='2'] input[type=button][value=Edit]").Click().Wait();
                browser.First(".id-order.id-edit input[type=text]").Clear().SendKeys("2000-01-01");
                browser.First(".id-order.id-edit input[type=button][value=Apply]").Click().Wait();
                browser.First(".id-order.id-edit input[type=button][value=Exit]").Click().Wait();

                AssertUI.TextEquals(browser.First(".id-order[data-order-id='2'] .id-date"), "2000-01-01");

                // change the order (ID = 2) date back so the test can be run once again
                browser.First(".id-order[data-order-id='2'] input[type=button][value=Edit]").Click().Wait();
                browser.First(".id-order.id-edit input[type=text]").Clear().SendKeys("2010-01-01");
                browser.First(".id-order.id-edit input[type=button][value=Apply]").Click().Wait();
                browser.First(".id-order.id-edit input[type=button][value=Exit]").Click().Wait();

                AssertUI.TextEquals(browser.First(".id-order[data-order-id='2'] .id-date"), "2010-01-01");
            });
        }