Skip to content

Commit

Permalink
Merge pull request #13 from bigbite/feature/delete-release-note
Browse files Browse the repository at this point in the history
[4] Version control change after release note deletion
  • Loading branch information
johnmunster authored Jan 10, 2024
2 parents 76bc057 + bbdffe9 commit ccc97cd
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 2 deletions.
23 changes: 23 additions & 0 deletions cypress/e2e/release-note-version-control.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/// <reference types="cypress" />

describe('release notes version control', () => {
before(() => {
cy.visit('/wp-admin/edit.php?post_type=release-note');
});

it('should change the version accordingly after a release note has been deleted', () => {
//asserts that the version number is the current version
cy.get('#wpadminbar').within(() => {
cy.get('#wp-admin-bar-release-note-version > a').should('contain', 'Version 1.6.0');
})
//deletes the current release note in the post list
cy.get('#the-list').within(() => {
cy.get('#post-5 .row-actions').invoke('attr', 'style', 'position: static').find('.submitdelete').click();
cy.visit('/wp-admin/edit.php?post_type=release-note');
cy.get('tr').should('have.length', 1);
});
//asserts that the version number has changed to the previous release note version
cy.get('#wpadminbar').within(() => {
cy.get('#wp-admin-bar-release-note-version > a').should('contain', 'Version 1.5.0');
}) });
});
80 changes: 79 additions & 1 deletion cypress/seeds/ReleaseNoteSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,89 @@
use WP_Cypress\Seeder\Seeder;
use WP_Cypress\Fixtures;


class ReleaseNoteSeeder extends Seeder {
public function run() {
$release_note_template = '<!-- wp:heading -->
<h2 class="wp-block-heading">Overview</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p> %s </p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2 class="wp-block-heading">Added</h2>
<!-- /wp:heading -->
<!-- wp:list -->
<ul><!-- wp:list-item -->
<li> %s </li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li> %s </li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->
<!-- wp:heading -->
<h2 class="wp-block-heading">Changed</h2>
<!-- /wp:heading -->
<!-- wp:list -->
<ul><!-- wp:list-item -->
<li> %s </li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li> %s </li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->
<!-- wp:heading -->
<h2 class="wp-block-heading">Fixed</h2>
<!-- /wp:heading -->
<!-- wp:list -->
<ul><!-- wp:list-item -->
<li> %s </li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li> %s </li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->';

( new Fixtures\Post([
'post_type' => 'release-note',
'post_date' => date("Y-m-d H:i:s", strtotime("Nov 10, 2023 15:01:10")),
'post_content' => sprintf(
$release_note_template,
$this->faker->realText( 100 ),
$this->faker->realText( 40 ),
$this->faker->realText( 40 ),
$this->faker->realText( 40 ),
$this->faker->realText( 40 ),
$this->faker->realText( 40 ),
$this->faker->realText( 40 ),
'1.5.0'
),
'post_meta' => [
'version' => '1.5.0',
'release_date' => date("Y-m-d", strtotime("Nov 10, 2023")),
]
]))->create(1);

( new Fixtures\Post([
'post_type' => 'release-note',
]) )->create(10);
'post_date' => date("Y-m-d H:i:s", strtotime("Dec 04, 2023 14:22:32")),
'post_content' => sprintf(
$release_note_template,
$this->faker->realText( 100 ),
$this->faker->realText( 40 ),
$this->faker->realText( 40 ),
$this->faker->realText( 40 ),
$this->faker->realText( 40 ),
$this->faker->realText( 40 ),
$this->faker->realText( 40 ),
'1.6.0'
),
'post_meta' => [
'version' => '1.6.0',
'release_date' => date("Y-m-d", strtotime("Dec 04, 2023")),
],

]))->create(1);
}
}

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"watch:dev:all": "webpack --mode=development --watch --env=\"all-projects\"",
"watch:prod": "webpack --mode=production --watch --env=\"project=$npm_config_project\"",
"watch:prod:all": "webpack --mode=production --watch --env=\"all-projects\"",
"test:e2e": "wp-cypress start"
"test:e2e": "wp-cypress stop && wp-cypress start && cypress open"
},
"dependencies": {
"@bigbite/build-tools": "git+ssh://[email protected]:bigbite/build-tools.git#1.0.0-beta.6",
Expand Down

0 comments on commit ccc97cd

Please sign in to comment.