Giter Club home page Giter Club logo

wordpressbehatextension's Issues

Something's changed (dependency tree) issue

Hi, my composer.json is below.

I can't seem to install this library. Whenever I try, I use composer update -vvv --profile and when the dependency tree is evaluated, it never stops. I got up to pass#60 before stopping it. I'd previously let it run to about 120 passes.

This is a child theme to a wordpress install. The composer.json is in the child theme's directory.

My log is attached as a txt file.
log.txt

{
  "name": "qnl/qnl_the7child",
  "description": "QNL Child theme based on The7 Wordpress Theme",
  "minimum-stability": "dev",
  "prefer-stable" : true,
  "license": "proprietary",
  "authors": [
    {
      "name": "Christopher Fern",
      "email": "[email protected]"
    }
  ],
  "require-dev": {
    "phpunit/phpunit": "7.*",
    "behat/gherkin" : "^4.6.2",
    "symfony/event-dispatcher": "4.3.*",

    "stephenharris/wordpress-behat-extension": "dev-master",
    "behat/mink-goutte-driver": "1.2.*",
    "behat/mink-selenium2-driver": "1.4.*",
    "johnpbloch/wordpress": "~4.6.1",

    "cweagans/composer-patches": "^1.6.7",
    "behat/behat": "3.6.*",
    "behat/debug-extension": "1.*",
    "genesis/behat-fail-aid": "3.7.*",
    "roave/security-advisories": "dev-master"
  },
  "require": {
    "php": "7.2.*",
    "dereuromark/media-embed": "0.5.3"
  },
  "autoload": {
    "psr-4": {
      "QNL\\" : "./QNL/"
    }
  },
  "config": {
    "bin-dir": "bin/"
  }
}

"Element is not clickable at point"

Sometimes Selenium cannot click an element because the "Element is not clickable at point". This can be because the target element is underneath the admin bar.

A quick fix might be to set the z-index of the admin bar to 0.

A more robust solution might be to over-ride the Behat-Mink methods to ensure the browser screen is shifted so that the element is visible. Or (if possible) intercept the failure and attempt a few more times with the browser screen adjusted.

Default user(s) and password(s)

Howdy!

A short "improvement" related to the WordPressContext::installWordPress -> TableNode.

Current

Currently the action I have a vanilla wordpress installation will create by default an user admin with password test.

Suggestion

New default: Adding for each role an user

For easier usage and writing tests to different user role's, it would make sense to enhance the existing action, create as default for each role an user in WordPress.

New default: same password as username

Secondly it would make sense to set the password to the username by default. e.G.:

user: admin | pass: admin
...
user: subscriber | pass: subscriber

The current password "test" is an easy to remember password, but it would be much easier to write features when it is the same.

Password optional for default users

Last but not least: the WordPressLoginContext::login could have an improvement by adding the password as "optional" and set it to the given user. This would save some typing and we can write with a default configuration following:

And I am logged in as "admin"
...
And I am logged in as "subscriber"

Please let me know if i can create a pull for this. :-)

Tests sometimes fail at the log-in stage.

I've seen this on Travis and when running locally. It seems for some reason, the web driver (Selenium) sometimes enters the password into the username field.

I'm not sure what the best way forward is. We could:

  • Check for this and try logging-in again
  • Improve the step implementation for logging so that the field is double checked that it's the correct one.

Custom taxonomy not available when WordPressTermContext->insert()

My plugin has a custom taxonomy that works, but when I try to create some terms like:

Background:
  Given [...]
  And there are plugins
        | plugin              | status  |
        | library/library.php | enabled |
  And there are document_tag terms
        | name      | slug | description   |
        | English   | en   |               |
        | Spanish   | es   |               |

...I get an error: "exception 'InvalidArgumentException' with message 'Invalid taxonomy term information schema: Invalid taxonomy.' in vendor/stephenharris/wordpress-behat-extension/src/Context/Terms/WordPressTermTrait.php:21"

This seems to be because the taxonomy is not available/registered when the context runs wp_insert_term(). If I run get_taxonomies() in the exception, my taxonomy isn't listed, but if I run is_plugin_active('library/library.php'), it is active.

I'll keep trying to debug, but would welcome guidance. I'm new to behat, so could definitely be missing something simple.

Note: I can run (and pass) scenarios where the same terms are created, but when setting them up as background, I get an error.

WPTable HTML not parsed correctly in selenium

I'm not sure exactly what's happening yet, but it seems like there's something in WPTableRow or WPTableCell that's incompatible with the HTML/DOM used for post lists, at least with JS on. In Goutte I get passing tests, but in Selenium 2, I get a failure for the same test.

As an example, here is the (lightly edited) output for one of "Then the post list table looks like" feature steps from Goutte:

      | Title            | Author       | Tags   | Date                |
      | Another Doc      | Another User |        | Published2017/01/04 |
      | Multilingual Doc | Another User |        | Published2017/01/03 |
      | English Doc      | Admin        |        | Published2017/01/02 |

The same post list from Selenium 2 gives me an error, "Unable to parse post list table. Found: Array". That array's contents in table node format would be:

      |  |
      | Another User |        | Published2017/01/04 |
      | Another User |        | Published2017/01/03 |
      | Admin        |        | Published2017/01/02 |

Note the missing header row labels and missing title column. I've verified that the WP admin ui is working and shows the expected header row and title column by visiting with a full browser.

Call to undefined function

I would like to use WordPress functions in my own FeatureContext class and write steps which are not presented in WordPressBehatExtension. Behat returns some issue when I try example from documentation. If my behat.yml file looks like this:

default:
  suites:
    default:
      contexts:
        - FeatureContext
        - \StephenHarris\WordPressBehatExtension\Context\WordPressContext
        - \StephenHarris\WordPressBehatExtension\Context\Plugins\WordPressPluginContext
  extensions:
    StephenHarris\WordPressBehatExtension:
      path: '/var/www/wordpress'
      connection:
        db: "wordpress"
        username: "wordpress"
        password: "wordpress"
      flush_database: false
      mail:
        directory: '/tmp/mail'
    Behat\MinkExtension:
      base_url: "http://192.168.33.10"
      browser_name: chrome
      goutte: ~
      selenium2: ~

and my .feature file looks like this:

Feature: Admin activates plugin
  In order to use the plugin
  As a WordPress user
  I should be able to activate it

  Scenario: Enable the dolly plugin
    Given there are plugins
      | plugin    | status  |
      | hello.php | enabled |
    When I go to "/wp-admin/"
    Then I should see a "#dolly" element

I get error when try to run Behat:

PHP Fatal error: Call to undefined function StephenHarris\WordPressBehatExtension\Context\Plugins\activate_plugin() in /home/vagrant/my-plugin/vendor/stephenharris/wordpress-behat-extension/src/Context/Plugins/WordPressPluginContext.php on line 21

What did I do wrong? I use vccw vagrant and run tests after I ssh into it.

Error message for incorrect password when logging in incorrect

When I am logged in as :username with password :password verifies the username and password. If the password is incorrect we should get the message:

Password for user :username incorrect

Instead we se:

Password for user :password incorrect

Perhaps the password should also be included in the error message for clarity.

"Menu item could not be found"

This sometimes occurs when running the Given I go to menu item "Users" step. (See: https://travis-ci.org/stephenharris/WordPressBehatExtension/jobs/167079131)

Running locally I can see the menu is collapsed into its icon view so this is the probable cause (and so is a result of the browser's viewport):

user-13

That could explain why it works on Jenkins but not Travis or locally.

The step definition needs to be defined to cope with the collapsed view, and (potentially?) the mobile view.

Trouble using with MySQL sitting at remote location

Current configuration setup seems to force mysqli connections to connect always to localhost. This creates issues in setups where the database not running on localhost.

Example: Gitlab CI and running MySQL as a Docker service container (which results MySQL being available at hostname mysql, not localhost).

Errors that appear are similar to

PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in 
    /path/to/project/vendor/stephenharris/wordpress-behat-extension/src/Context/Initializer/WordPressContextInitializer.php
    on line 170

Could the behat.yml connection config be expanded to include an option to change the MySQL hostname/IP?

assertPostTypeTerms comparing stale cached terms

I have a scenario that tests bulk editing of a custom post type and custom taxonomy. My first bulk edit works, and this step passes:

Then the document "Multilingual Doc" should have document_tag terms "connections"

But bulk editing the same document again, the expected result is compared against the same $actual_terms as the first time, even though an additional term has been added to the post (verified through screenshot and manually visiting the site), leading to a failed test.

Documentation

A TODO list for documentation.

  • Installation / setting up
    • Stepping up on a vvv instance
    • Stepping up on a Jenkins server
  • Using the helper classes
    • WordPressPostTrait
    • WordPressTermTrait
    • WordPressUserTrait
    • Spin
    • WordPressInboxFactoryAwareContext (making assertions about e-mails)

Overriding Page Object extension's config

We are forcibly setting the namespace of the Page Object extension so that it maps the page name to the appropriate class.

See: https://github.com/stephenharris/WordPressBehatExtension/blob/develop/src/ServiceContainer/WordPressBehatExtension.php#L45-L48

I think this override user's settings. We should, ideally, supplement any user configuration with our own namespaces so that the user's namespaces take precedence, but that our classes are always findable if needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.