Releases: bigbite/wp-cypress
0.9.3
Changelog
- Bump path-parse from 1.0.6 to 1.0.7 by @dependabot in #79
- Package updates and deprecation fixes. by @ampersarnie in #83
- Default PHP install version to bumped 7.4 by @ampersarnie in #84
⚠️ Due to package updates, the minimum supported Node.js version is now set to v12.22.0
Full Changelog: 0.9.2...0.9.3
0.9.2
0.9.1
0.9.0
Change Log
Added
- Add configurable db port (default:
3306
), so that you can connect using a database IDE [#58] - Add configurable php version (default:
7.3
) [#68] - Add seeder clean routines [#47]
- Bump node-fetch from 2.6.0 to 2.6.1
- Bump lodash from 4.17.20 to 4.17.21
- Bump hosted-git-info from 2.8.8 to 2.8.9
- Bump glob-parent from 5.1.1 to 5.1.2
Changed
- Allow for manual user switching if a password is passed when using
switchUser
function [#59]
Fixed
- Fail if docker desktop is not open. Fixed by checking for docker service/daemon before running wp-cypress setup [#53]
0.8.1
0.8.0
Change Log
Added
- Add
--no-volumes
flag to start command for environments that don't support Docker volume mounting. When using this flag any changes will not be reflected in the test container and it will be slower to create a test container [#42] - Validation for configuration object.
- Added
configFile
option to config object which allows a path to be provided to a php file to define configuration expected inwp-config.php
. - Allow seeds directory to have sub directories for managing larger projects
- Added support for WordPress Multisite. Defaults to
false
but can be set totrue
for subdirectory orsubdomain
installs. Aurl
is option is available to set a custom domain which is needed if you plan to usesubdomain
.
Changed
- When using
cy.switchUser
it uses the bypass auth logic instead of visitingwp-login.php
which helps to speed up tests - Caches WP versions to prevent re-downloading all the WP versions defined in
wp.version
if it changes. - Cache vip mu plugins if used
- Perform soft reset between tests for performance benefits.
Fixed
- Mount wp-content directory directly as a volume (ignoring uploads and upgrade directories), instead of flaky intermediary step
- A more aggressive bypass auth logic is used to prevent previous issues [#25]
- Re-generate default values for each post in post fixture
- Only duplicate tests if there are multiple wp versions supplied in config
Breaking Changes
- Can no longer mount additional plugins or themes when mounting a wp-content folder, this is an intentional design decision to simplify things.
- Remove cypress retries plugin and default number of retries. It is now recommended you configure this yourself using the native support in Cypress versions 5 & above https://docs.cypress.io/guides/guides/test-retries.html
- Config object schema has changed. The new schema should be more stable moving forwards. See below examples of how various different config combinations using the new schema can be utilised for different projects.
v0.7.0
Change Log
Added
- Optionally mount entire wp-content directory, by supplying a path to your wp-content folder using the
wp-content
option. You can still supply additional themes and plugins, however if you supply the mu-plugins path it will use this path as a priority over the mu-plugin folder in your wp-content, if you have one. - If the config option
vip
is true, the vip go mu plugins are included and a path to the vip config is included in the wp-config. If vip is true then the mu-plugins folder provided in the config will be ignored.
Fixed
- Fixed a regression where sometimes cypress would 503 when visiting the root url
- When adding, deleting or renaming an integration test you would need to restart cypress for the multiple versions of WP to work properly. You don't need to do that now, it all should work smoothly.
v0.6.0
Change Log
Changed
- Add the ability to be authenticated with different users #17
- Add ability to have cypress in a non default location by passing
seedsPath
as a config option #36 - Improvements to the seeder #34
- Add the ability to be able to call seeders within seeders, in a specific order.
- Add the ability for wp cypress to call it's own seeders that aren't user generated.
- Various improvements under the hood to php code quality.
Breaking Changes
-
Default Seeder: Previously named,
Init
, theDefault Seeder
will be the seeder that is always ran on reset. It has been renamed to make it easier to understand and to give it more context. -
Fixtures: The most notable changes in this release come in the seeder with the introduction of fixtures. Fixtures replace the
generator
function instantiated with the seeder which is now deprecated. Fixtures are a structured way to create data when seeding. There are some default fixtures for a post, comment and user and will create more in the future and upcoming releases. However, you can create your own fixtures too. Before to create a post using thegenerate
function it looked something like:
<?php
use WP_Cypress\Seeder\Seeder;
use WP_Cypress\Fixtures;
class DefaultSeeder extends Seeder {
public function run() {
$this->generate->posts( [], 3 );
}
}
Instead, using Fixtures, it looks like:
<?php
use WP_Cypress\Seeder\Seeder;
use WP_Cypress\Fixtures;
class DefaultSeeder extends Seeder {
public function run() {
$post = new Fixtures\Post( [] );
$post->create( 3 );
}
}
To create your own fixture simply create a file in your seeds directory with the name of the fixture. For example ExampleCommentFixture.php
. Then extend the Fixture
class and create two methods defaults
and generate
. Defaults the default properties to be generated and the generate function performs the required logic that is ran on create to create your data in the database:
<?php
use WP_Cypress\Fixtures\Fixture;
use WP_Cypress\Utils;
class ExampleCommentFixture extends Fixture {
public function defaults() {
return [
'comment_post_ID' => 1,
'comment_author' => 'admin',
'comment_author_email' => '[email protected]',
'comment_content' => 'This is an example comment fixture',
'user_id' => 1,
'comment_date' => Utils\now(),
];
}
public function generate() {
$id = (int) wp_insert_comment( array_merge( $this->defaults(), $this->properties ) );
}
}
This will be autoloaded and can be executed in any seeder:
<?php
use WP_Cypress\Seeder\Seeder;
class ExampleSeeder extends Seeder {
public function run() {
( new Fixtures\Post([
'import_id' => 10,
'post_title' => 'Post with Custom Comments',
]) )->create();
( new ExampleCommentFixture( [ 'comment_post_ID' => 10 ] ) )->create( 10 );
}
}