示例#1
0
        /* MISCELLENOUS ACTIONS */

        public IActionSyntaxProvider WithConfig(FluentSettings settings)
        {
            // Execute
            ((ActionSyntaxProvider)_actionSyntaxProvider).WithConfig(settings);

            // After
            return(this);
        }
示例#2
0
        public ICommandProvider WithConfig(FluentSettings settings)
        {
            this.Settings = settings;

            if (settings.WindowMaximized)
            {
                this.browser.ShowWindow(WatiNCore.Native.Windows.NativeMethods.WindowShowStyle.ShowMaximized);
            }
            // If the browser size has changed since the last config change, update it
            else if (settings.WindowWidth.HasValue && settings.WindowHeight.HasValue)
            {
                this.browser.SizeWindow(settings.WindowWidth.Value, settings.WindowHeight.Value);
            }

            return(this);
        }
        public bool SaveScreenshot(FluentSettings settings, byte[] contents, string fileName)
        {
            try
            {
                if (!string.IsNullOrEmpty(settings.ScreenshotPrefix))
                    fileName = settings.ScreenshotPrefix + fileName;

                if (fileName.Substring(0, fileName.Length - 4) != ".png")
                    fileName += ".png";

                File.WriteAllBytes(Path.Combine(settings.ScreenshotPath, fileName), contents);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
        public bool SaveScreenshot(FluentSettings settings, byte[] contents, string fileName)
        {
            try
            {
                if (!string.IsNullOrEmpty(settings.ScreenshotPrefix))
                {
                    fileName = settings.ScreenshotPrefix + fileName;
                }

                if (fileName.Substring(0, fileName.Length - 4) != ".png")
                {
                    fileName += ".png";
                }

                File.WriteAllBytes(Path.Combine(settings.ScreenshotPath, fileName), contents);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#5
0
        public ICommandProvider WithConfig(FluentSettings settings)
        {
            // If an alert is open, the world ends if we touch the size property. Ignore this and let it get set by the next command chain
            try
            {
                if (settings.WindowMaximized)
                {
                    // store window size back before maximizing so we can 'undo' this action if necessary
                    // this code intentionally touches this.Settings before its been replaced with the local
                    // configuration code, so that when the With.___.Then block is completed, the outer settings
                    // object has the correct window size to work with.
                    var windowSize = _webDriver.Manage().Window.Size;
                    if (!this.Settings.WindowWidth.HasValue)
                    {
                        this.Settings.WindowWidth = windowSize.Width;
                    }

                    if (!this.Settings.WindowHeight.HasValue)
                    {
                        this.Settings.WindowHeight = windowSize.Height;
                    }

                    this._webDriver.Manage().Window.Maximize();
                }
                // If the browser size has changed since the last config change, update it
                else if (settings.WindowWidth.HasValue && settings.WindowHeight.HasValue)
                {
                    this._webDriver.Manage().Window.Size = new Size(settings.WindowWidth.Value, settings.WindowHeight.Value);
                }
            }
            catch (UnhandledAlertException) { }

            this.Settings = settings;

            return(this);
        }
示例#6
0
 public WithSyntaxProvider(IActionSyntaxProvider actionSyntaxProvider)
 {
     this.actionSyntaxProvider = actionSyntaxProvider;
     this.inlineSettings       = FluentSettings.Current.Clone();
 }
 public ICommandProvider WithConfig(FluentSettings settings)
 {
     Parallel.ForEach(this.commandProviders, x => x.WithConfig(settings));
     return(this);
 }
示例#8
0
 public FluentConfig Configure(FluentSettings settings)
 {
     FluentSettings.Current = settings;
     return(this);
 }
示例#9
0
 internal ActionSyntaxProvider WithConfig(FluentSettings settings)
 {
     this.commandProvider.WithConfig(settings);
     this.settings = settings;
     return(this);
 }
示例#10
0
 public ActionSyntaxProvider(ICommandProvider commandProvider, IAssertProvider assertProvider, FluentSettings settings)
 {
     this.commandProvider = commandProvider.WithConfig(settings);
     this.assertProvider  = assertProvider;
     this.settings        = settings;
 }
 internal ActionSyntaxProvider WithConfig(FluentSettings settings)
 {
     this.commandProvider.WithConfig(settings);
     this.settings = settings;
     return this;
 }
 public FluentConfig Configure(FluentSettings settings)
 {
     FluentSettings.Current = settings;
     return this;
 }
 public ICommandProvider WithConfig(FluentSettings settings)
 {
     Parallel.ForEach(this.commandProviders, x => x.WithConfig(settings));
     return this;
 }
        public ICommandProvider WithConfig(FluentSettings settings)
        {
            // If an alert is open, the world ends if we touch the size property. Ignore this and let it get set by the next command chain
            try
            {
                if (settings.WindowMaximized)
                {
                    // store window size back before maximizing so we can 'undo' this action if necessary
                    // this code intentionally touches this.Settings before its been replaced with the local
                    // configuration code, so that when the With.___.Then block is completed, the outer settings
                    // object has the correct window size to work with.
                    var windowSize = webDriver.Manage().Window.Size;
                    if (!this.Settings.WindowWidth.HasValue)
                        this.Settings.WindowWidth = windowSize.Width;

                    if (!this.Settings.WindowHeight.HasValue)
                        this.Settings.WindowHeight = windowSize.Height;

                    this.webDriver.Manage().Window.Maximize();
                }
                // If the browser size has changed since the last config change, update it
                else if (settings.WindowWidth.HasValue && settings.WindowHeight.HasValue)
                {
                    this.webDriver.Manage().Window.Size = new Size(settings.WindowWidth.Value, settings.WindowHeight.Value);
                }
            }
            catch (UnhandledAlertException) { }

            this.Settings = settings;

            return this;
        }
 public WithSyntaxProvider(IActionSyntaxProvider actionSyntaxProvider)
 {
     this.actionSyntaxProvider = actionSyntaxProvider;
     this.inlineSettings = FluentSettings.Current.Clone();
 }
 public ActionSyntaxProvider(ICommandProvider commandProvider, IAssertProvider assertProvider, FluentSettings settings)
 {
     this.commandProvider = commandProvider.WithConfig(settings);
     this.assertProvider = assertProvider;
     this.settings = settings;
 }
        public ICommandProvider WithConfig(FluentSettings settings)
        {
            this.Settings = settings;

            if (settings.WindowMaximized)
            {
                this.browser.ShowWindow(WatiNCore.Native.Windows.NativeMethods.WindowShowStyle.ShowMaximized);
            }
            // If the browser size has changed since the last config change, update it
            else if (settings.WindowWidth.HasValue && settings.WindowHeight.HasValue)
            {
                this.browser.SizeWindow(settings.WindowWidth.Value, settings.WindowHeight.Value);
            }

            return this;
        }