public void VendorCanManageDomainLicenses() { using (var site = new KeyHubWebDriver()) { var scenario = new VendorWithALicensedCustomerScenario(); scenario.Setup(site, canDeleteManualDomainsOfLicense:true); using (var browser = BrowserUtil.GetBrowser()) { // Create a license browser.Navigate().GoToUrl(site.UrlFor("/")); SiteUtil.SubmitLoginForm(browser, scenario.UserEmail, scenario.UserPassword); browser.FindElementByCssSelector("a[href='/License']").Click(); browser.FindElementByCssSelector("a[href^='/License/Details']").Click(); browser.FindElementByCssSelector("a[href^='/DomainLicense/Create']").Click(); browser.FindElementByCssSelector("input#DomainName").SendKeys("example.com"); browser.FindElementByCssSelector("form[action^='/DomainLicense/Create'] input[type='submit']").Click(); browser.FindElementByCssSelector(".success"); var licensedDomains = GetLicensedDomains(browser); Assert.Contains("example.com", licensedDomains); // Edit a license browser.FindElementByCssSelector("a[href^='/DomainLicense/Edit']").Click(); IWebElement domainNameInput = browser.FindElementByCssSelector("input#DomainName"); domainNameInput.Clear(); domainNameInput.SendKeys("example.org"); browser.FindElementByCssSelector("form[action^='/DomainLicense/Edit'] input[type='submit']").Click(); browser.FindElementByCssSelector(".success"); licensedDomains = GetLicensedDomains(browser); Assert.Contains("example.org", licensedDomains); Assert.DoesNotContain("example.com", licensedDomains); // Delete a license browser.FindElementByCssSelector("a[href^='/DomainLicense/Remove']").Click(); browser.FindElementByCssSelector("form[action^='/DomainLicense/Remove'] input[type='submit']").Click(); browser.FindElementByCssSelector(".success"); licensedDomains = GetLicensedDomains(browser); Assert.Equal(0, licensedDomains.Count()); } } }
public void VendorCanManuallyCreateLicensedApplicationAndChangeItsSkus() { var vendorAndCustomerScenario = new VendorWithALicensedCustomerScenario(); using (var site = new KeyHubWebDriver()) { vendorAndCustomerScenario.Setup(site); var firstCustomerAppName = "customerApp.name1"; var secondCustomerAppName = "customerApp.name2"; using (var browser = BrowserUtil.GetBrowser()) { browser.Navigate().GoToUrl(site.UrlFor("/")); SiteUtil.SubmitLoginForm(browser, vendorAndCustomerScenario.UserEmail, vendorAndCustomerScenario.UserPassword); // Create a CustomerApp / Licensed Application browser.Navigate().GoToUrl(site.UrlFor("/")); browser.FindElementByCssSelector("a[href='/CustomerApp']").Click(); browser.FindElementByCssSelector("a[href='/CustomerApp/Create']").Click(); browser.FindElementByCssSelector("input#ApplicationName").SendKeys(firstCustomerAppName); SiteUtil.SetValueForChosenJQueryControlMulti(browser, "#SelectedLicenseGUIDs_chzn", "first sku"); browser.FindElementByCssSelector("form[action='/CustomerApp/Create'] input[type=submit]").Click(); browser.FindElementByCssSelector(".success"); AssertApplicationNameIs(browser, firstCustomerAppName); AssertApplicationSkuIs(browser, "first sku"); // Rename the customer app browser.FindElementByCssSelector("a[href^='/CustomerApp/Edit']").Click(); var nameElement = browser.FindElementByCssSelector("input#ApplicationName"); nameElement.Clear(); nameElement.SendKeys(secondCustomerAppName); browser.FindElementByCssSelector("form[action^='/CustomerApp/Edit'] input[type='submit']").Click(); browser.FindElementByCssSelector(".success"); AssertApplicationNameIs(browser, secondCustomerAppName); // Switch licenses on the customer app browser.FindElementByCssSelector("a[href^='/CustomerApp/Edit']").Click(); SiteUtil.SetValueForChosenJQueryControlMulti(browser, "#SelectedLicenseGUIDs_chzn", "second sku", clearExisting:true); browser.FindElementByCssSelector("form[action^='/CustomerApp/Edit'] input[type='submit']").Click(); browser.FindElementByCssSelector(".success"); AssertApplicationSkuIs(browser, "second sku"); // Remove the customer app browser.FindElementByCssSelector("a[href^='/CustomerApp/Remove']").Click(); browser.FindElementByCssSelector("form[action^='/CustomerApp/Remove'] input[type='submit']").Click(); browser.FindElementByCssSelector(".success"); Assert.Equal(0, browser.FindElementsByCssSelector("a[href^='/CustomerApp/Remove']").Count()); } } }