public void TestFullResetNoResetMutualExclusivity()
		{
			DefaultAppiumAppSettings settings = new DefaultAppiumAppSettings();
			settings.PerformFullAndroidReset = true;
			settings.ResetApplicationState = false;

			AppiumServerRunner setup = new AppiumServerRunner("", "", settings);

			Assert.That(setup.ContainsArgument<FullResetArgument>(), Is.True);
			Assert.That(setup.ContainsArgument<NoResetArgument>(), Is.False);
		}
        public void TestFullResetNoResetMutualExclusivity()
        {
            DefaultAppiumAppSettings settings = new DefaultAppiumAppSettings();

            settings.PerformFullAndroidReset = true;
            settings.ResetApplicationState   = false;

            AppiumServerRunner setup = new AppiumServerRunner("", "", settings);

            Assert.That(setup.ContainsArgument <FullResetArgument>(), Is.True);
            Assert.That(setup.ContainsArgument <NoResetArgument>(), Is.False);
        }
        public void TestPrelauchApplicationUsage()
        {
            DefaultAppiumAppSettings settings = new DefaultAppiumAppSettings();

            AppiumServerRunner setup = new AppiumServerRunner(NODE_RUNNER, WORKING_DIR, settings);

            // keep artifacts not enabled by default
            Assert.That(setup.ContainsArgument <PrelauchApplicationArgument>(), Is.False);

            // keep artifacts enabled
            settings.PrelaunchApplication = true;
            setup.Setup(settings);

            Assert.That(setup.ContainsArgument <PrelauchApplicationArgument>(), Is.True);
        }
        public void TestQuietLoggingUsage()
        {
            DefaultAppiumAppSettings settings = new DefaultAppiumAppSettings();

            AppiumServerRunner setup = new AppiumServerRunner(NODE_RUNNER, WORKING_DIR, settings);

            // quiet logging not enabled by default
            Assert.That(setup.ContainsArgument <QuietLoggingArgument>(), Is.False);

            // quiet logging enabled
            settings.QuietLogging = true;
            setup.Setup(settings);

            Assert.That(setup.ContainsArgument <QuietLoggingArgument>(), Is.True);
        }
        public void TestDeveloperModeBreakOnAppStartUsage()
        {
            DefaultAppiumAppSettings settings = new DefaultAppiumAppSettings();

            settings.UseDeveloperMode        = true;
            settings.BreakOnApplicationStart = true;

            AppiumServerRunner setup = new AppiumServerRunner(NODE_RUNNER, WORKING_DIR, settings);

            Assert.That(setup.ContainsArgument <BreakOnAppStartArgument>(), Is.True);

            // reset for negative case
            settings.BreakOnApplicationStart = false;
            setup.Setup(settings);
            Assert.That(setup.ContainsArgument <BreakOnAppStartArgument>(), Is.False);
        }
		public void TestAllDeveloperSettingsIgnoredWhenDevModeDisabled()
		{
			DefaultAppiumAppSettings settings = new DefaultAppiumAppSettings();
			settings.UseDeveloperMode = false;
			settings.UseExternalNodeJSBinary = true;
			settings.ExternalNodeJSBinary = "testNodeJs";
			settings.UseExternalAppiumPackage = true;
			settings.ExternalAppiumPackage = "extApp";
			settings.UseNodeJSDebugging = true;
			settings.NodeJSDebugPort = 1234;
			settings.BreakOnApplicationStart = true;

			AppiumServerRunner setup = new AppiumServerRunner(NODE_RUNNER, WORKING_DIR, settings);

			Assert.That(setup.Filename, Is.EqualTo(NODE_RUNNER));
			Assert.That(setup.WorkingDirectory, Is.EqualTo(WORKING_DIR));
			Assert.That(setup.ContainsArgument<NodeJSDebugArgument>(), Is.False);
			Assert.That(setup.ContainsArgument<BreakOnAppStartArgument>(), Is.False);
		}
        public void TestAllDeveloperSettingsIgnoredWhenDevModeDisabled()
        {
            DefaultAppiumAppSettings settings = new DefaultAppiumAppSettings();

            settings.UseDeveloperMode         = false;
            settings.UseExternalNodeJSBinary  = true;
            settings.ExternalNodeJSBinary     = "testNodeJs";
            settings.UseExternalAppiumPackage = true;
            settings.ExternalAppiumPackage    = "extApp";
            settings.UseNodeJSDebugging       = true;
            settings.NodeJSDebugPort          = 1234;
            settings.BreakOnApplicationStart  = true;

            AppiumServerRunner setup = new AppiumServerRunner(NODE_RUNNER, WORKING_DIR, settings);

            Assert.That(setup.Filename, Is.EqualTo(NODE_RUNNER));
            Assert.That(setup.WorkingDirectory, Is.EqualTo(WORKING_DIR));
            Assert.That(setup.ContainsArgument <NodeJSDebugArgument>(), Is.False);
            Assert.That(setup.ContainsArgument <BreakOnAppStartArgument>(), Is.False);
        }
		public void TestPrelauchApplicationUsage()
		{
			DefaultAppiumAppSettings settings = new DefaultAppiumAppSettings();

			AppiumServerRunner setup = new AppiumServerRunner(NODE_RUNNER, WORKING_DIR, settings);

			// keep artifacts not enabled by default
			Assert.That(setup.ContainsArgument<PrelauchApplicationArgument>(), Is.False);

			// keep artifacts enabled
			settings.PrelaunchApplication = true;
			setup.Setup(settings);

			Assert.That(setup.ContainsArgument<PrelauchApplicationArgument>(), Is.True);
		}
		public void TestQuietLoggingUsage()
		{
			DefaultAppiumAppSettings settings = new DefaultAppiumAppSettings();

			AppiumServerRunner setup = new AppiumServerRunner(NODE_RUNNER, WORKING_DIR, settings);

			// quiet logging not enabled by default
			Assert.That(setup.ContainsArgument<QuietLoggingArgument>(), Is.False);

			// quiet logging enabled
			settings.QuietLogging = true;
			setup.Setup(settings);

			Assert.That(setup.ContainsArgument<QuietLoggingArgument>(), Is.True);
		}
		public void TestDeveloperModeBreakOnAppStartUsage()
		{
			DefaultAppiumAppSettings settings = new DefaultAppiumAppSettings();
			settings.UseDeveloperMode = true;
			settings.BreakOnApplicationStart = true;

			AppiumServerRunner setup = new AppiumServerRunner(NODE_RUNNER, WORKING_DIR, settings);

			Assert.That(setup.ContainsArgument<BreakOnAppStartArgument>(), Is.True);
			
			// reset for negative case
			settings.BreakOnApplicationStart = false;
			setup.Setup(settings);
			Assert.That(setup.ContainsArgument<BreakOnAppStartArgument>(), Is.False);
		}