Beispiel #1
0
        public void Setup(KeyHubWebDriver site, bool canDeleteManualDomainsOfLicense = true)
        {
            using (var browser = BrowserUtil.GetBrowser())
            {
                base.Setup(site);

                browser.Navigate().GoToUrl(site.UrlFor("/"));
                SiteUtil.SubmitLoginForm(browser, UserEmail, UserPassword);

                VendorUtil.CreatePrivateKey(browser, VendorName);

                VendorUtil.CreateFeature(browser, "first feature", VendorName);
                VendorUtil.CreateFeature(browser, "second feature", VendorName);

                VendorUtil.CreateSku(browser, "first sku", VendorName, "first feature", canDeleteManualDomainsOfLicense);
                VendorUtil.CreateSku(browser, "second sku", VendorName, "second feature", canDeleteManualDomainsOfLicense);

                //  Create a Customer
                var customerName = VendorUtil.CreateCustomer(browser);

                //  Create a License
                VendorUtil.CreateLicense(browser, "first sku", customerName);
                VendorUtil.CreateLicense(browser, "second sku", customerName);
            }
        }
Beispiel #2
0
        public void VendorCanRenameAndRemovePrivateKeys()
        {
            using (var site = new KeyHubWebDriver())
            {
                var scenario = new WithAVendorScenario();
                scenario.Setup(site);

                using (var browser = BrowserUtil.GetBrowser())
                {
                    browser.Navigate().GoToUrl(site.UrlFor("/"));
                    SiteUtil.SubmitLoginForm(browser, scenario.UserEmail, scenario.UserPassword);

                    var privateKeyName = VendorUtil.CreatePrivateKey(browser, scenario.VendorName);

                    var privateKeyRow = browser.FindElementByXPath("//td[contains(text(),'" + privateKeyName + "')]/ancestor::tr");
                    privateKeyRow.FindElement((By.CssSelector("a[href^='/PrivateKey/Edit']"))).Click();

                    var nameInput = browser.FindElementByCssSelector("input#PrivateKey_DisplayName");
                    nameInput.Clear();
                    nameInput.SendKeys("second name");
                    browser.FindElementByCssSelector("form[action^='/PrivateKey/Edit'] input[type='submit']").Click();

                    privateKeyRow = browser.FindElementByXPath("//td[contains(text(),'second name')]/ancestor::tr");

                    Assert.Equal(1, browser.FindElementsByCssSelector(".private-key-list").Count());
                    Assert.Equal(1, browser.FindElementsByCssSelector(".private-key-list tbody tr").Count());
                    privateKeyRow.FindElement((By.CssSelector("a[href^='/PrivateKey/Remove']"))).Click();

                    browser.FindElementByCssSelector("form[action^='/PrivateKey/Remove'] input[type='submit']").Click();

                    Assert.Equal(1, browser.FindElementsByCssSelector(".private-key-list").Count());
                    Assert.Equal(0, browser.FindElementsByCssSelector(".private-key-list tbody tr").Count());
                }
            }
        }