mcdcorp / opentest

Open source test automation tool for web applications, mobile apps and APIs
https://getopentest.org
MIT License
452 stars 108 forks source link

Browser is started even when there are no selenium actions in the test #569

Open TripleG opened 2 years ago

TripleG commented 2 years ago

Is there any reason for browser being started when test contains NO selenium steps in it? Example:

description: Get repo branches from the GitHub API
actors:
  - actor: WEB
    segments:
      - segment: 1
        actions:
          - description: Perform the API call
            action: org.getopentest.actions.HttpRequest
            args:
              url: https://api.github.com/repos/facebook/react/branches
              verb: GET

          - description: Verify that the branches array exists and is not empty
            script: |
              var branches = $output.body;

              if (!branches || (branches.length == 0)) {
                  $fail("Response body invalid or contains no branch elements.");
              } else {
                  $log($format(
                    "The GitHub API returned {0} branches",
                    branches.length));
              }
adrianth commented 2 years ago

A browser will only be started by the initialization code of the very first Selenium keyword that is being executed in a test and is closed at the end of the test (depending on the value of selenium.reuseDriver config property). You should most definitely not see a browser started if there are no Selenium keywords in the test. Please note that if you have selenium.reuseDriver: true, the browser window will remain open forever and that same window will be reused for every test session.