public void TestDownloadByteContent() { var content = string.Join("\n", new[] { "this is large file content" }.Concat(Enumerable.Range(0, 10000).Select(i => (i % 256).ToString()))); var blobId = Guid.NewGuid(); using (var context = new CqlDbContext()) context.GetTable <CqlActiveBoxState>().Insert(new CqlActiveBoxState { PartitionKey = "0", LastProcessedEventId = "0", BoxId = blobId, Content = Encoding.UTF8.GetBytes(content), }).SetTimestamp(DateTimeOffset.UtcNow).Execute(); using var browser = new BrowserForTests(); var tempFileStoragePage = browser.LoginAsSuperUser().SwitchTo <BusinessObjectTablePage>("CqlActiveBoxState"); tempFileStoragePage.OpenFilter.Click(); tempFileStoragePage.FilterModal.GetFilter("PartitionKey").Input.ClearAndInputText("0"); tempFileStoragePage.FilterModal.GetFilter("BoxId").Input.ClearAndInputText(blobId.ToString()); tempFileStoragePage.FilterModal.Apply.Click(); tempFileStoragePage.BusinessObjectItems.WaitCount(1); var detailsPage = tempFileStoragePage.BusinessObjectItems[0].Details.ClickAndGoTo <BusinessObjectDetailsPage>(); detailsPage.RootAccordion.FindField("Content").FieldValue.DownloadLink.Click(); Thread.Sleep(1000); var file = browser.DownloadFile("CqlActiveBoxState-Content-dGhpcy.bin"); file.Should().Be(content); }
private static string[] DownloadFile(BrowserForTests browser, BusinessObjectTablePage businessObjectPage) { businessObjectPage.DownloadLink.Click(); var filename = $"UsersTable-{DateTime.UtcNow:yyyy-MM-dd-HHmm}.csv"; Thread.Sleep(1000); var file = browser.DownloadFile(filename); var content = file.Split("\n"); if (content.Length == 1) { Console.WriteLine($"File Content: '{file}'"); } return(content); }