forked from Manuel/meeting-assistant
ci: consolidate platform pipelines and test prerequisites on macOS support
This commit is contained in:
1 parent
1b19b08f2e
commit
728e66dd72
76 files changed
+7477
-239
No files matched your search
@@ -1,13 +1,14 @@
|
||||
using System.Net.Http.Json;
|
||||
using MeetingAssistant.Calendar;
|
||||
using MeetingAssistant.MacOs;
|
||||
using MeetingAssistant.Notifications;
|
||||
using MeetingAssistant.MeetingNotes;
|
||||
using MeetingAssistant.Screenshots;
|
||||
using MeetingAssistant.Transcription;
|
||||
using MeetingAssistant.Workflow;
|
||||
using Microsoft.AspNetCore.Mvc.Testing;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace MeetingAssistant.Tests;
|
||||
|
||||
@@ -18,6 +19,10 @@ public sealed class MacOsMeetingIntegrationTests
|
||||
{
|
||||
var macServices = new ServiceCollection().AddLogging();
|
||||
var unsupportedServices = new ServiceCollection().AddLogging();
|
||||
using var host = new HostBuilder().Build();
|
||||
macServices.AddSingleton(TimeProvider.System);
|
||||
macServices.AddSingleton(host.Services.GetRequiredService<IHostApplicationLifetime>());
|
||||
macServices.AddSingleton<DesktopUserRequestStore>();
|
||||
|
||||
MacOsMeetingIntegrationRegistration.Add(macServices, isMacOs: true);
|
||||
MacOsMeetingIntegrationRegistration.Add(unsupportedServices, isMacOs: false);
|
||||
@@ -96,39 +101,20 @@ public sealed class MacOsMeetingIntegrationTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task MacOsPromptAndScreenshotUseNativeClientResults()
|
||||
public async Task MacOsScreenshotAndCropUseNativeClientResults()
|
||||
{
|
||||
var screenshot = new ActiveWindowScreenshot([137, 80, 78, 71], "Meeting deck");
|
||||
var client = new StubMacOsDesktopIntegrationClient(
|
||||
screenshot: screenshot,
|
||||
promptResponse: MeetingStartPromptResponse.Record);
|
||||
IMeetingStartPromptService prompt = new MacOsMeetingStartPromptService(
|
||||
client,
|
||||
NullLogger<MacOsMeetingStartPromptService>.Instance);
|
||||
IActiveWindowScreenshotCapture capture = client;
|
||||
IScreenshotImageCropper cropper = client;
|
||||
MeetingStartPromptResponse? callbackResponse = null;
|
||||
var request = new MeetingStartPromptRequest(new CalendarMeeting(
|
||||
"event-1",
|
||||
"Project sync",
|
||||
DateTimeOffset.Now,
|
||||
DateTimeOffset.Now.AddHours(1)));
|
||||
|
||||
await prompt.ShowPromptAsync(
|
||||
request,
|
||||
(response, _) =>
|
||||
{
|
||||
callbackResponse = response;
|
||||
return Task.CompletedTask;
|
||||
},
|
||||
CancellationToken.None);
|
||||
var captured = await capture.CaptureAsync(CancellationToken.None);
|
||||
var croppedPath = await cropper.SaveCroppedScreenshotAsync(
|
||||
"meeting.png",
|
||||
new ScreenshotCropCoordinates(1, 2, 3, 4),
|
||||
CancellationToken.None);
|
||||
|
||||
Assert.Equal(MeetingStartPromptResponse.Record, callbackResponse);
|
||||
Assert.Equal(screenshot, captured);
|
||||
Assert.Equal("meeting.png.cropped.png", croppedPath);
|
||||
}
|
||||
@@ -136,7 +122,7 @@ public sealed class MacOsMeetingIntegrationTests
|
||||
[MacOsFact]
|
||||
public async Task MacOsCapabilityEndpointReportsEnabledRealProviders()
|
||||
{
|
||||
await using var factory = new WebApplicationFactory<Program>();
|
||||
await using var factory = new IsolatedApplicationFactory();
|
||||
using var client = factory.CreateClient();
|
||||
|
||||
var report = await client.GetFromJsonAsync<PlatformCapabilityReport>(
|
||||
|
||||
Reference in new issue
Block a user