{"id":20036176,"url":"https://github.com/vccw-team/wordpress-mink-extension","last_synced_at":"2025-07-19T16:34:58.937Z","repository":{"id":57077147,"uuid":"72276155","full_name":"vccw-team/wordpress-mink-extension","owner":"vccw-team","description":"WordPress extension for the Behat","archived":false,"fork":false,"pushed_at":"2017-10-20T17:15:39.000Z","size":318,"stargazers_count":12,"open_issues_count":3,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-05T05:35:30.454Z","etag":null,"topics":["behat","mink","phantomjs","wordpress"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vccw-team.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-29T09:28:33.000Z","updated_at":"2020-02-15T10:36:21.000Z","dependencies_parsed_at":"2022-08-24T14:40:40.738Z","dependency_job_id":null,"html_url":"https://github.com/vccw-team/wordpress-mink-extension","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/vccw-team/wordpress-mink-extension","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vccw-team%2Fwordpress-mink-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vccw-team%2Fwordpress-mink-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vccw-team%2Fwordpress-mink-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vccw-team%2Fwordpress-mink-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vccw-team","download_url":"https://codeload.github.com/vccw-team/wordpress-mink-extension/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vccw-team%2Fwordpress-mink-extension/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265966062,"owners_count":23857056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["behat","mink","phantomjs","wordpress"],"created_at":"2024-11-13T10:11:12.928Z","updated_at":"2025-07-19T16:34:58.912Z","avatar_url":"https://github.com/vccw-team.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WordPress Extension for the Behat/Mink\n\n[![Build Status](https://travis-ci.org/vccw-team/wordpress-mink-extension.svg?branch=master)](https://travis-ci.org/vccw-team/wordpress-mink-extension)\n[![Latest Stable Version](https://poser.pugx.org/vccw-team/wordpress-extension/v/stable)](https://packagist.org/packages/vccw-team/wordpress-extension)\n[![Total Downloads](https://poser.pugx.org/vccw-team/wordpress-extension/downloads)](https://packagist.org/packages/vccw-team/wordpress-extension)\n[![Latest Unstable Version](https://poser.pugx.org/vccw-team/wordpress-extension/v/unstable)](https://packagist.org/packages/vccw-team/wordpress-extension)\n[![License](https://poser.pugx.org/vccw-team/wordpress-extension/license)](https://packagist.org/packages/vccw-team/wordpress-extension)\n\n## Requires\n\n* WordPress 4.6 or later\n* PHP 5.6 or later\n\n## Getting Started\n\n### Install dependencies\n\nThe recomended way to install is by using Composer.\n\n```\n$ composer require vccw-team/wordpress-extension:@stable\n```\n\n### Initialize Behat\n\nAfter that you will be able to initialize the project.\n\n```\n$ vendor/bin/behat --init\n```\n\n### Configuration\n\nPlace the `behat.yml` like following.\n\n```\ndefault:\n  suites:\n    default:\n      paths:\n        - %paths.base%/features\n      contexts:\n        - FeatureContext\n        - VCCW\\Behat\\Mink\\WordPressExtension\\Context\\WordPressContext\n        - Behat\\MinkExtension\\Context\\MinkContext\n  extensions:\n    VCCW\\Behat\\Mink\\WordPressExtension:\n      roles:\n        administrator:\n          username: admin\n          password: admin\n        editor:\n          username: editor\n          password: editor\n    Behat\\MinkExtension:\n      base_url: http://127.0.0.1:8080\n      default_session: default\n      sessions:\n        default:\n          selenium2:\n            wd_host: http://127.0.0.1:4444/wd/hub\n        goutte:\n          goutte: ~\n\n```\n\n* Add user accounts of your WordPress site into `VCCW\\Behat\\Mink\\WordPressExtension \u003e roles`.\n* Update value of the `Behat\\MinkExtension \u003e base_url` to your hostname.\n* You can add multiple user like following.\n\n```\n  extensions:\n    VCCW\\Behat\\Mink\\WordPressExtension:\n      roles:\n        administrator:\n          username: admin\n          password: admin\n        editor:\n          username: editor\n          password: editor\n```\n\nSee:\nhttps://github.com/vccw-team/wordpress-extension/blob/master/behat.yml.dist\n\n### Write features\n\nYou can write features with Gherkin language.\n\nhttps://github.com/cucumber/cucumber/wiki/Gherkin\n\nExample `*.feature` are in the following.\n\nhttps://github.com/vccw-team/wordpress-extension/tree/master/features\n\n#### Examples\n\nLogin as the administrator role and I should see \"Dashboard\".\n\n```\nFeature: I login as the specfic role\n\n  Scenario: Login as the \"administrator\" role\n\n    When I login as the \"administrator\" role\n    Then I should see \"Welcome to WordPress!\"\n```\n\nSelenium2 driver can't retrieve the HTTP response.\nSo you have to use `@mink::goutte` tag like following in your `*.feature`.\nBut goutte driver can't exec JavaScript.\n\n```\nFeature: HTTP response\n\n  @mink:goutte\n  Scenario: Check http status code\n\n    When I am on \"/\"\n    Then the HTTP status should be 200\n\n    When I am on \"/the-page-not-found\"\n    Then the HTTP status should be 404\n```\n\nRun to see contexts.\n\n```\n$ vendor/bin/behat -di --lang=en\n```\n\n### Install headless browser\n\nFollowing is an exmaple for PhantomJS.\n\n```\n$ npm install phantomjs-prebuilt --save\n$ node_modules/.bin/phantomjs --webdriver=4444 --ignore-ssl-errors=yes --cookies-file=/tmp/webdriver_cookie.txt\n```\n\n### Run tests\n\n```\n$ vendor/bin/behat\n```\n\n### Running tests as npm-scripts\n\nFollowing is an example to run phantomjs and tests automatically.\n\nSave following as `bin/run-tests.js`.\n\n```\nconst phantomjs = require( 'phantomjs-prebuilt' )\nconst spawn = require( 'child_process' ).spawn\n\nconst argv = process.argv\nargv.shift()\nargv.shift()\n\nphantomjs.run(\n  '--webdriver=4444',\n  '--ignore-ssl-errors=yes',\n  '--cookies-file=/tmp/webdriver_cookie.txt'\n).then( program =\u003e {\n  const behat = spawn( 'vendor/bin/behat', argv, { stdio: \"inherit\" } )\n  behat.on( 'exit', ( code ) =\u003e {\n    program.kill()\n    process.exit( code );\n  } )\n} )\n```\n\nAdd it to `package.json`.\n\n```\n{\n  \"scripts\": {\n    \"test\": \"/usr/bin/env node bin/run-tests.js\"\n  },\n}\n```\n\nThen just run:\n\n```\n$ npm test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvccw-team%2Fwordpress-mink-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvccw-team%2Fwordpress-mink-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvccw-team%2Fwordpress-mink-extension/lists"}