These are chat archives for Behat/Behat

28th
Nov 2018
bakedev
@bakedev
Nov 28 2018 10:49
@bharatahuja04 you can write and use some bash script for this and put it into cron.
Other options is a use a some tools to CI
@p2635 can yuou show your behat configuration file and packages which you use in project
Phil
@p2635
Nov 28 2018 12:11

Hi @bakedev , thank you for your help, I've gone a bit further but I still have a problem with my test. I think that it's running the test too fast (before the page is fully loaded). See below (sorry for the long post!), some of the code was written by colleagues so I don't have a full understanding of how it works...

Windows 10, WAMP, Git Bash, selenium-server-standalone-3.141.59.jar, geckodriver-v0.21.0-win32, IEDriverServer_Win32_3.9.0, ChromeDriver 2.44

Git Bash

When running test with GeckoDriver: Fatal error: Class 'Behat\Mink\Exception\ExpectationException' not found in C:\...ElementNotFoundException.php on line 21.

When running test with IEDriver:

  ┌─ @BeforeScenario # FeatureContext::before()
  │
  ╳  Invalid timeout type specified: ms
  ╳  Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
  ╳  System info: host: 'ANON', ip: 'ANON', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
  ╳  Driver info: driver.version: unknown (Exception)
  │

FeatureContext.php

...
    /** @BeforeScenario */
    public function before(BeforeScenarioScope $scope)
    {
        $tags = $scope->getScenario()->getTags();
        if (in_array('skip', $tags)) {
            throw new SkippedException();
        }

       // Reduce the page timeout to expedite test for Selenium2Driver (seems to just work for Chrome)
       $this->getSession()->getDriver()->setTimeouts(['page load' => 60000]);
    }
....

composer.json

{
    "name": "my/test",
    "require": {
        "symfony/css-selector": "v3.4.19",
        "symfony/dom-crawler": "v3.4.19",
        "behat/mink": "1.7.1",
        "behat/mink-extension": "2.3.1",
        "behat/mink-goutte-driver": "1.2.1",
        "behat/mink-selenium2-driver": "1.3.1",
        "phpunit/phpunit": "6.5.13",
        "ramsey/uuid": "3.8.0"
    },
    "autoload": {
        "psr-4": {
            "Jobs\\FunctionalTests\\Contexts\\": "features/bootstrap"
        }
    }
}

behat.yml

# behat.yml
default:
  suites:
    default:
      filters:
        tags: "~@manual_test_only"
  autoload:
    '': %paths.base%/features/bootstrap
  extensions:
      Behat\MinkExtension:
        sessions:
          firefox:
            selenium2:
              browser: 'firefox'
              capabilities:
                extra_capabilities:
                  acceptInsecureCerts: true
                  marionette: true;
           chrome:
             selenium2:
               browser: 'chrome'
               capabilities: {
                 "browserName": "chrome",
                 "browser": "chrome",
                 "version": "70",
                 'chrome': {'switches':['--no-sandbox']}}
           ie11:
             selenium2:
               browser: 'internet explorer'
               wd_host: http://localhost:4444/wd/hub
               capabilities: {
                 "browserName": "internet explorer",
                 "browser": "internet explorer",
                 "version": "11"
                }
Phil
@p2635
Nov 28 2018 12:52
If I use the latest version of GeckoDriver, I get the same result as IEDriver. :(