public static void CaptureDeviceInfo(this IDiagnosticsData data, AndroidDevice device)
 {
     data.Target   = device.Architecture;
     data.TargetOS = "API " + device.ApiVersion;
     data.Device   = device.DeviceSerial;
     data.IsDevice = !device.DeviceSerial.ToLowerInvariant().StartsWith("emulator");
 }
Example #2
0
    public RunOrchestrator(
        IAppBundleInformationParser appBundleInformationParser,
        IAppInstaller appInstaller,
        IAppUninstaller appUninstaller,
        IAppRunnerFactory appRunnerFactory,
        IDeviceFinder deviceFinder,
        IiOSExitCodeDetector iOSExitCodeDetector,
        IMacCatalystExitCodeDetector macCatalystExitCodeDetector,
        ILogger consoleLogger,
        ILogs logs,
        IFileBackedLog mainLog,
        IErrorKnowledgeBase errorKnowledgeBase,
        IDiagnosticsData diagnosticsData,
        IHelpers helpers)
        : base(appBundleInformationParser, appInstaller, appUninstaller, deviceFinder, consoleLogger, logs, mainLog, errorKnowledgeBase, diagnosticsData, helpers)
    {
        _iOSExitCodeDetector         = iOSExitCodeDetector ?? throw new ArgumentNullException(nameof(iOSExitCodeDetector));
        _macCatalystExitCodeDetector = macCatalystExitCodeDetector ?? throw new ArgumentNullException(nameof(macCatalystExitCodeDetector));
        _logger             = consoleLogger ?? throw new ArgumentNullException(nameof(consoleLogger));
        _logs               = logs ?? throw new ArgumentNullException(nameof(logs));
        _errorKnowledgeBase = errorKnowledgeBase ?? throw new ArgumentNullException(nameof(errorKnowledgeBase));

        // Only add the extra callback if we do know that the feature was indeed enabled
        Action <string>?logCallback = IsLldbEnabled() ? (l) => NotifyUserLldbCommand(_logger, l) : null;

        _appRunner = appRunnerFactory.Create(mainLog, logs, logCallback);
    }
Example #3
0
 public InstallOrchestrator(
     IAppInstaller appInstaller,
     IAppUninstaller appUninstaller,
     IAppBundleInformationParser appBundleInformationParser,
     IDeviceFinder deviceFinder,
     ILogger consoleLogger,
     ILogs logs,
     IFileBackedLog mainLog,
     IErrorKnowledgeBase errorKnowledgeBase,
     IDiagnosticsData diagnosticsData,
     IHelpers helpers)
     : base(appBundleInformationParser, appInstaller, appUninstaller, deviceFinder, consoleLogger, logs, mainLog, errorKnowledgeBase, diagnosticsData, helpers)
 {
 }
Example #4
0
 public JustRunOrchestrator(
     IAppBundleInformationParser appBundleInformationParser,
     IAppInstaller appInstaller,
     IAppUninstaller appUninstaller,
     IAppRunnerFactory appRunnerFactory,
     IDeviceFinder deviceFinder,
     IiOSExitCodeDetector iOSExitCodeDetector,
     IMacCatalystExitCodeDetector macCatalystExitCodeDetector,
     ILogger consoleLogger,
     ILogs logs,
     IFileBackedLog mainLog,
     IErrorKnowledgeBase errorKnowledgeBase,
     IDiagnosticsData diagnosticsData,
     IHelpers helpers)
     : base(appBundleInformationParser, appInstaller, appUninstaller, appRunnerFactory, deviceFinder, iOSExitCodeDetector, macCatalystExitCodeDetector, consoleLogger, logs, mainLog, errorKnowledgeBase, diagnosticsData, helpers)
 {
 }
Example #5
0
 public TestOrchestrator(
     IAppBundleInformationParser appBundleInformationParser,
     IAppInstaller appInstaller,
     IAppUninstaller appUninstaller,
     IAppTesterFactory appTesterFactory,
     IDeviceFinder deviceFinder,
     ILogger consoleLogger,
     ILogs logs,
     IFileBackedLog mainLog,
     IErrorKnowledgeBase errorKnowledgeBase,
     IDiagnosticsData diagnosticsData,
     IHelpers helpers)
     : base(appBundleInformationParser, appInstaller, appUninstaller, deviceFinder, consoleLogger, logs, mainLog, errorKnowledgeBase, diagnosticsData, helpers)
 {
     _appTesterFactory   = appTesterFactory ?? throw new ArgumentNullException(nameof(appTesterFactory));
     _logger             = consoleLogger ?? throw new ArgumentNullException(nameof(consoleLogger));
     _logs               = logs ?? throw new ArgumentNullException(nameof(logs));
     _mainLog            = mainLog ?? throw new ArgumentNullException(nameof(mainLog));
     _errorKnowledgeBase = errorKnowledgeBase ?? throw new ArgumentNullException(nameof(errorKnowledgeBase));
 }
Example #6
0
 protected BaseOrchestrator(
     IAppBundleInformationParser appBundleInformationParser,
     IAppInstaller appInstaller,
     IAppUninstaller appUninstaller,
     IDeviceFinder deviceFinder,
     ILogger consoleLogger,
     ILogs logs,
     IFileBackedLog mainLog,
     IErrorKnowledgeBase errorKnowledgeBase,
     IDiagnosticsData diagnosticsData,
     IHelpers helpers)
 {
     _appBundleInformationParser = appBundleInformationParser ?? throw new ArgumentNullException(nameof(appBundleInformationParser));
     _appInstaller       = appInstaller ?? throw new ArgumentNullException(nameof(appInstaller));
     _appUninstaller     = appUninstaller ?? throw new ArgumentNullException(nameof(appUninstaller));
     _deviceFinder       = deviceFinder ?? throw new ArgumentNullException(nameof(deviceFinder));
     _logger             = consoleLogger ?? throw new ArgumentNullException(nameof(consoleLogger));
     _logs               = logs ?? throw new ArgumentNullException(nameof(logs));
     _mainLog            = mainLog ?? throw new ArgumentNullException(nameof(mainLog));
     _errorKnowledgeBase = errorKnowledgeBase ?? throw new ArgumentNullException(nameof(errorKnowledgeBase));
     _diagnosticsData    = diagnosticsData ?? throw new ArgumentNullException(nameof(diagnosticsData));
     _helpers            = helpers ?? throw new ArgumentNullException(nameof(helpers));
 }
Example #7
0
    public OrchestratorTestBase()
    {
        _logger             = new();
        _mainLog            = new();
        _helpers            = new();
        _errorKnowledgeBase = new();
        _appInstaller       = new();
        _appUninstaller     = new();
        _logs = new();

        _logs.AddFile("system.log", LogType.SystemLog.ToString());

        _simulator = new();
        _simulator.Setup(x => x.UDID).Returns(UDID);
        _simulator.Setup(x => x.Name).Returns(SimulatorName);
        _simulator.Setup(x => x.OSVersion).Returns("13.5");
        _simulator.Setup(x => x.Boot(It.IsAny <ILog>(), It.IsAny <CancellationToken>())).ReturnsAsync(true);
        _simulator.Setup(x => x.GetAppBundlePath(It.IsAny <ILog>(), BundleIdentifier, It.IsAny <CancellationToken>())).ReturnsAsync(AppPath);

        _device = new();
        _device.Setup(x => x.UDID).Returns(UDID);
        _device.Setup(x => x.Name).Returns(DeviceName);
        _device.Setup(x => x.OSVersion).Returns("14.2");

        _appBundleInformation = new AppBundleInformation(
            appName: AppName,
            bundleIdentifier: BundleIdentifier,
            appPath: AppPath,
            launchAppPath: AppPath,
            supports32b: false,
            extension: null,
            bundleExecutable: BundleExecutable);

        _appBundleInformationParser = new Mock <IAppBundleInformationParser>();
        _appBundleInformationParser
        .Setup(x => x.ParseFromAppBundle(
                   Path.GetFullPath(AppPath),
                   It.IsAny <TestTarget>(),
                   _mainLog.Object,
                   It.IsAny <CancellationToken>()))
        .ReturnsAsync(_appBundleInformation);

        _diagnosticsData = new CommandDiagnostics(Mock.Of <Extensions.Logging.ILogger>(), TargetPlatform.Apple, "install");

        _deviceFinder = new Mock <IDeviceFinder>();
        _deviceFinder
        .Setup(x => x.FindDevice(
                   It.Is <TestTargetOs>(t => t.Platform.IsSimulator()),
                   It.IsAny <string?>(),
                   It.IsAny <ILog>(),
                   It.IsAny <bool>(),
                   It.IsAny <CancellationToken>()))
        .ReturnsAsync(new DevicePair(_simulator.Object, null));

        _deviceFinder
        .Setup(x => x.FindDevice(
                   It.Is <TestTargetOs>(t => !t.Platform.IsSimulator()),
                   It.IsAny <string?>(),
                   It.IsAny <ILog>(),
                   It.IsAny <bool>(),
                   It.IsAny <CancellationToken>()))
        .ReturnsAsync(new DevicePair(_device.Object, null));
    }