sensiolabs/BehatPageObjectExtension

Scenario works fine on pc but fails on Docker/Bitbucket

Closed this issue · 3 comments

When I execute the Features from my mac to the Staging site, all is fine.

When I run w/in Docker against the same Staging site, I get the error shown below.

Here is the error from running w/in Docker on Bitbucket

  @javascript
  Scenario: I can create Voice files                                                                         # features/temp/adminWayIn.feature:22
    When I go to the "Admin menu" page                                                                       # ThinkwellContext::iGoToThePage()
    And I click the "Way In" link                                                                            # ThinkwellContext::iClickTheLink()
      Could not find a class for the "Way In" element. None of the configured namespaces worked: "\Page\Element\WayIn" (InvalidArgumentException)
    Then I should see the "Voice list" page                                                                  # ThinkwellContext::iShouldSeeThePage()

Here is yaml

default:
  suites:
    home:
       paths: ["%paths.base%/features/temp/home.feature"]
       contexts: [ThinkWellContext]
    wayin:
       paths: ["%paths.base%/features/temp/adminWayIn.feature"]
       contexts: [ThinkWellContext]
    music:
       paths: ["%paths.base%/features/temp/adminMusic.feature"]
       contexts: [ThinkWellContext]

  extensions:
    Behat\MinkExtension:
      browser_name: 'chrome'
      goutte: ~
      javascript_session: selenium2
      selenium2:
        wd_host: http://0.0.0.0:4444/wd/hub
        capabilities: { "browser": "chrome", "version": "", 'chrome': {'switches':['--start-maximized']}}
      base_url: https://www.twlw.dev

    SensioLabs\Behat\PageObjectExtension:
      namespaces:
        page:
          - Page

staging: #for bitbucket pipeline
  extensions:
    Behat\MinkExtension:
      base_url: http://twlw.staging.wpengine.com
      selenium2:
        # http://selenium is the URL alias to the Selenium docker container.
        wd_host: http://127.0.0.1:4444/wd/hub
        capabilities:
          browser: chrome
          chrome:
            switches:
              - "--headless"
              - "--start-maximized" 

My directory structure: features/bootstrap/Page

I've not had to do anything specifically for an Element

Is this a issue w/ composer install having different versions or what?

I updated the yml as shown by adding the namespaces:

    SensioLabs\Behat\PageObjectExtension:
      namespaces:
        page: [Page]
        element: [Page]

Now I get this slightly different message

  @javascript
  Scenario: I can create Voice files                                                                         # features/temp/adminWayIn.feature:22
    When I go to the "Admin menu" page                                                                       # ThinkwellContext::iGoToThePage()
    And I click the "Way In" link                                                                            # ThinkwellContext::iClickTheLink()
      Could not find a class for the "Way In" element. None of the configured namespaces worked: "\Page\WayIn" (InvalidArgumentException)

Here is the definition of the link on this page:

        $xpath = array("xpath" => "//a[@href='edit.php?post_type=voice']");
        $parent->_addToElements("Way In", $xpath);

Again, this works fine on my Mac

I found that the path to a class I was trying to create works on Mac but not on Linux. Once I used __DIR__, it works on both now.

I found that the path to a class I was trying to create works on Mac but not on Linux

Double check your letter-casing.