public async void ExportIssues_Test() { var request = CallbackTests.CreateRequestWithContent("/app/jiraexporter/export_issues", HttpMethod.Post, new FormUrlEncodedContent(new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("includeqr", "true"), new KeyValuePair <string, string>("issues", "CCTES-6"), new KeyValuePair <string, string>("issues", "DK-1"), }) ); var response = await CallbackTests.ExecuteRequest(Client, request, ClientServiceMock.RegistrationData); string responseString = await response.Content.ReadAsStringAsync(); Assert.True(response.IsSuccessStatusCode, $"{response.RequestMessage.RequestUri} failed, reason {responseString}"); dynamic result = JsonConvert.DeserializeObject <dynamic>(responseString); Assert.NotNull(result.fileid); Assert.Matches("https://mockurl.com/app/JiraExporter/download/[-a-zA-Z0-9]*", result.downloadlink.ToString()); await using (var context = Factory.AppFixture.NewDatabaseContext()) { string id = result.fileid.ToString(); Assert.Single(context.ReportFile.Where(x => x.UniqueId == id)); } Factory.LoggingMock.Verify(e => e.ReportAccessLog(It.Is <ElasticsearchAccessLogDocument>(d => d.Id == Factory.AppFixture.ClientServiceMock.RequestId && d.ControllerName == "JiraExporter" && d.ActionName == "ExportIssues" && d.Path == "/app/jiraexporter/export_issues" && d.ResultCode == 200 ))); }
public async void ExporterContentPane_Test() { var request = CallbackTests.CreateRequest("/ExporterContentPane", HttpMethod.Get); var response = await CallbackTests.ExecuteRequest(Client, request, ClientServiceMock.RegistrationData); var responseContent = await response.Content.ReadAsStringAsync(); Assert.True(response.IsSuccessStatusCode, $"{response.RequestMessage.RequestUri} failed, reason {responseContent}"); var document = await HtmlHelpers.GetDocumentAsync(response, new StandardConsoleLogger(Output), responseContent); //document.ExecuteScript("body_onload()"); // Anglesharp.JS supports ES5 https://github.com/AngleSharp/AngleSharp.Js#features but async/await seems like ES8 feature var et = document.ExecuteScript("eval(exportToken)"); //var et = document.ExecuteScript("document.querySelector('#messageDone').innerHTML"); }
public async void ExporterContentPane1_Test() { var request = CallbackTests.CreateRequest("/ExporterContentPane", HttpMethod.Get); var response = await CallbackTests.ExecuteRequest(Client, request, ClientServiceMock.RegistrationData); var responseContent = await response.Content.ReadAsStringAsync(); Assert.True(response.IsSuccessStatusCode, $"{response.RequestMessage.RequestUri} failed, reason {responseContent}"); var service = new JsScriptingService(); var cfg = Configuration.Default.With(service).WithConsoleLogger(context => new StandardConsoleLogger(Output)); var document = await BrowsingContext.New(cfg).OpenAsync(m => m.Content(responseContent)); //var body_onload = service.GetOrCreateJint(document).GetValue("body_onload"); //body_onload.Invoke(); var token = service.GetOrCreateJint(document).GetValue("exportToken"); }