Search code examples
reactjsselenium-chromedriverchrome-web-driverwebdriver-manager

After test:report:chrome Report generation done, Terminal not closing the instance, it keeps running


I am using protector, selenium for running the UI automation.

For chrome driver I am using webdriver-manager for testing the UI Automation. It run successfully, browser also close but it keeps running the terminal instance can anyone help me on this?

config.directConnect = false;
        config.seleniumAddress = "http://127.0.0.1:4444/wd/hub";
        config.capabilities.chromeOptions = chromeOptions = {
          args: [
            "--no-sandbox",
            "--disable-infobars",
            "--disable-dev-shm-usage",
            "--disable-extensions",
            "--log-level=3",
            "--disable-gpu",
            "--start-maximized"
          ].concat(isCI ? ["--headless"] : []), // run in headless mode on the CI server
          prefs: {
            "download.default_directory": downloadDir
          }
        };
        config.serenity = {
          outputDirectory: `${process.cwd()}/test_reports_chrome`,
          runner: "cucumber",
          crew: [
            ArtifactArchiver.storingArtifactsAt("./test_reports_chrome"),
            ConsoleReporter.forDarkTerminals(),
            Photographer.whoWill(TakePhotosOfInteractions), // or Photographer.whoWill(TakePhotosOfFailures),
            new SerenityBDDReporter()
          ]

Terminal Instance


Solution

  • you should add -r for script in package.json

    "test:chrome": "npm-run-all -p -r webdriver:chrome execute:chrome",
    

    -p = Run commands in parallel.

    -r = Kill all commands when one of them finishes with zero.

    Running npm run test:chrome will start Selenium driver, start http server (to serve you files) and run protractor tests. Once all tests are finished, it will close the http server and the selenium driver.