Ejemplo n.º 1
0
        public async Task StartAsync()
        {
            await Server.StartAsync();

            ChromeOptions options = new ChromeOptions();
            var           isDebug = !Server.PayTester.InContainer;

            if (!isDebug)
            {
                options.AddArguments("headless");              // Comment to view browser
                options.AddArguments("window-size=1200x1000"); // Comment to view browser
            }
            options.AddArgument("shm-size=2g");
            if (Server.PayTester.InContainer)
            {
                options.AddArgument("no-sandbox");
            }
            Driver = new ChromeDriver(Server.PayTester.InContainer ? "/usr/bin" : Directory.GetCurrentDirectory(), options);
            if (isDebug)
            {
                //when running locally, depending on your resolution, the website may go into mobile responsive mode and screw with navigation of tests
                Driver.Manage().Window.Maximize();
            }
            Logs.Tester.LogInformation("Selenium: Using chrome driver");
            Logs.Tester.LogInformation("Selenium: Browsing to " + Server.PayTester.ServerUri);
            Logs.Tester.LogInformation($"Selenium: Resolution {Driver.Manage().Window.Size}");
            Driver.Manage().Timeouts().ImplicitWait = ImplicitWait;
            GoToRegister();
            Driver.AssertNoError();
        }
Ejemplo n.º 2
0
        public async Task StartAsync()
        {
            await Server.StartAsync();

            ChromeOptions options = new ChromeOptions();

            if (Server.PayTester.InContainer)
            {
                // this must be first option https://stackoverflow.com/questions/53073411/selenium-webdriverexceptionchrome-failed-to-start-crashed-as-google-chrome-is#comment102570662_53073789
                options.AddArgument("no-sandbox");
            }

            var isDebug = !Server.PayTester.InContainer;

            if (!isDebug)
            {
                options.AddArguments("headless");              // Comment to view browser
                options.AddArguments("window-size=1200x1000"); // Comment to view browser
            }
            options.AddArgument("shm-size=2g");
            Driver = new ChromeDriver(Server.PayTester.InContainer ? "/usr/bin" : Directory.GetCurrentDirectory(), options);
            if (isDebug)
            {
                //when running locally, depending on your resolution, the website may go into mobile responsive mode and screw with navigation of tests
                Driver.Manage().Window.Maximize();
            }
            Logs.Tester.LogInformation("Selenium: Using chrome driver");
            Logs.Tester.LogInformation("Selenium: Browsing to " + Server.PayTester.ServerUri);
            Logs.Tester.LogInformation($"Selenium: Resolution {Driver.Manage().Window.Size}");
            Driver.Manage().Timeouts().ImplicitWait = ImplicitWait;
            GoToRegister();
            Driver.AssertNoError();
        }