public async Task WaitForScreenshotDone(CbtScreenshot result) { START: CbtScreenshot info = await GetScreenshotInfo(result.screenshot_test_id.ToString()); if (info.versions.First().active) { Logger.Log($"{result.url} is still running."); Thread.Sleep(90_000); goto START; } }
public async Task UpdatePageAndTaskResult(AppPage page, AppTask task, CbtScreenshot result) { // update page UpdateDefinition <AppPage> pageUpdate = null; var resultId = result.screenshot_test_id.ToString(); if (task.Type == AppTaskType.Desktop) { if (page.DesktopResultId != resultId) { pageUpdate = Builders <AppPage> .Update.Set(d => d.DesktopResultId, resultId); } } else { if (page.MobileResultId != resultId) { pageUpdate = Builders <AppPage> .Update.Set(d => d.MobileResultId, resultId); } } if (pageUpdate != null) { var pageFilter = Builders <AppPage> .Filter.Eq(d => d.Id, page.Id); await pageCollection.UpdateOneAsync(pageFilter, pageUpdate); } // update task var filter = Builders <AppTask> .Filter.Eq(d => d.Id, task.Id); var update = Builders <AppTask> .Update.Set(d => d.State, AppTaskState.Executed) .Set(d => d.FinishedAt, DateTime.UtcNow); await taskCollection.UpdateOneAsync(filter, update); }