private void VerifyReleaseNotesOnPkg(string expectedNotes, string packageName) { var wait = new WebDriverWait(this.Driver, TimeSpan.FromSeconds(15)); var row = this.GetUpdatesTableTopRow(wait, packageName); var id = row.FindElements(By.TagName("td"))[1].Text; var showBtn = DOMExtensions.TryFind(() => row.FindElement(By.ClassName("expand")) , TimeSpan.FromSeconds(15)); Assert.IsNotNull(showBtn); Actions actions = new Actions(this.Driver); actions.MoveToElement(showBtn); actions.Perform(); wait.Until(ExpectedConditions.ElementToBeClickable(showBtn)); showBtn.ClickWrapper(this.Driver); var nextRow = row.FindElement(By.XPath("following-sibling::*[1]")); IWebElement notesSection = DOMExtensions.TryFind( () => nextRow.FindElements(By.TagName("pre")).ToList() .FirstOrDefault(x => x.GetAttribute("data-pkg-id") == id), TimeSpan.FromSeconds(1)); Assert.AreEqual(expectedNotes, notesSection.Text); }
private void SetReleaseNotesOnExistingPkg(string notes, string packageName) { var wait = new WebDriverWait(this.Driver, TimeSpan.FromSeconds(15)); var row = this.GetUpdatesTableTopRow(wait, packageName); var setBtn = DOMExtensions.TryFind(() => row.FindElement(By.ClassName(Strings.Css.PrepareReleaseNotesButton)) , TimeSpan.FromSeconds(15)); Actions actions = new Actions(this.Driver); actions.MoveToElement(setBtn); actions.Perform(); wait.Until(ExpectedConditions.ElementToBeClickable(setBtn)); setBtn.ClickWrapper(this.Driver); this.FillInReleaseNotesModal(wait, notes); }
private Task <DateTime> GetLatestUsageFromTable(string callerMethodName) { try { this.GoToAdminHomePage(); WebDriverWait wait = new WebDriverWait(this.Driver, TimeSpan.FromSeconds(15)); this.Driver.FindElement(By.Id(Apps.Names.AutomaticTestsClient + "_menu")).ClickWrapper(this.Driver); IWebElement statLink = wait.Until(ExpectedConditions.ElementIsVisible(By.Id(Apps.Names.AutomaticTestsClient + "_statsLink"))); statLink.ClickWrapper(this.Driver); IWebElement programsTable = wait.Until(ExpectedConditions.ElementIsVisible(By.Id(Strings.Id.ViewUsageTable))); wait.Until(ExpectedConditions.ElementToBeClickable(By.Id(Strings.Id.ViewUsageTable))); wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.Id("ProgramUsageTable_processing"))); IWebElement latestRow = DOMExtensions.TryFind(() => programsTable.FindElement(By.TagName("tbody")).FindElements(By.TagName("tr")).FirstOrDefault() , TimeSpan.FromSeconds(2)); if (latestRow == null) { throw new InvalidOperationException("Latest row is null"); } string dateTime = "Not initialized"; try { dateTime = latestRow.FindElements(By.TagName("td")).FirstOrDefault()?.Text; DateTime parsed = DateTime.ParseExact(dateTime, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture); return(Task.FromResult(parsed)); } catch (Exception ex) { throw new InvalidOperationException($"Cannot parse [{dateTime}] as DateTime", ex); } } catch (Exception ex) { this.HandleError(ex, callerMethodName, this.outputs, this.errors); return(Task.FromResult(default(DateTime))); } }