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()); } } }
public void VendorCanEditAFeature() { 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); VendorUtil.CreateFeature(browser, "first feature", scenario.VendorName); var featureRow = browser.FindElement(By.XPath("//td[contains(text(),'first feature')]/ancestor::tr")); featureRow.FindElement(By.CssSelector("a[href^='/Feature/Edit']")).Click(); var nameInput = browser.FindElementByCssSelector("#Feature_FeatureName"); nameInput.Clear(); nameInput.SendKeys("second name"); browser.FindElementByCssSelector("form[action^='/Feature/Edit'] input[type='submit']").Click(); browser.FindElementByCssSelector(".success"); browser.FindElement(By.XPath("//td[contains(text(),'second name')]")); } } }