Skip to content

Releases: bigbite/wp-cypress

0.9.3

16 Dec 11:11
Compare
Choose a tag to compare

Changelog

⚠️ 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

09 Aug 14:30
Compare
Choose a tag to compare

Change Log

Fixed

  • Fixes issue where start up on some Linux system would fail due to patchy support of recursive file watching via fs.watch(). [#75]

0.9.1

20 Jul 13:46
0227fd2
Compare
Choose a tag to compare

Change Log

Fixed

  • Fix for Seeder not running outside of CLI

0.9.0

19 Jul 13:39
98c5524
Compare
Choose a tag to compare

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

12 Jan 11:41
22c0c1f
Compare
Choose a tag to compare

Change Log

Added

  • Added ability to be a logged out user in a test using the cy.switchUser command, by passing loggedout

Fixed

  • Issue where uploads folder was not writeable [#48]

0.8.0

04 Nov 16:12
0a55225
Compare
Choose a tag to compare

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 in wp-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 to true for subdirectory or subdomain installs. A url is option is available to set a custom domain which is needed if you plan to use subdomain.

Changed

  • When using cy.switchUser it uses the bypass auth logic instead of visiting wp-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

13 Aug 15:19
Compare
Choose a tag to compare

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

08 Jul 08:24
3fe0504
Compare
Choose a tag to compare

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, the Default 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 the generate 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 );
	}
}

v0.5.4

22 May 16:00
Compare
Choose a tag to compare

Changelog

Fixed

  • Cypress will rerun tests when a file in the integration folder changes, as it's supposed to!

v0.5.3

22 May 13:37
Compare
Choose a tag to compare

Change Log

Fixed

  • Fix import paths when parsing specs
  • Run teardown in context blocks as well as describe blocks
  • Don't error if describe block isn't found