Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/ip-1.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyLedesma authored Apr 30, 2024
2 parents ff86a65 + 3e76e75 commit 6ead176
Show file tree
Hide file tree
Showing 29 changed files with 203 additions and 88 deletions.
50 changes: 39 additions & 11 deletions .dev/tests/cypress/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ export function addFormChild( name ) {
cy.get( '.components-popover__content button' ).contains( /insert after|add after/i ).click( { force: true } );
cy.get( '[data-type="coblocks/form"] [data-type="core/paragraph"]' ).click( { force: true } );

cy.get( '.edit-post-header-toolbar' ).find( '.edit-post-header-toolbar__inserter-toggle' ).click( { force: true } );
cy.get( '.block-editor-inserter__search .components-search-control__input' ).click().type( name );
if ( isWP65AtLeast() ) {
cy.get( '.edit-post-header-toolbar' ).find( '.editor-document-tools__inserter-toggle' ).click( { force: true } );

cy.get( '.components-input-control__input' ).click().type( name );
} else {
cy.get( '.edit-post-header-toolbar' ).find( '.edit-post-header-toolbar__inserter-toggle' ).click( { force: true } );

cy.get( '.block-editor-inserter__search .components-search-control__input' ).click().type( name );
}

cy.get( '.editor-block-list-item-coblocks-field-' + name ).first().click( { force: true } );
cy.get( `[data-type="coblocks/field-${ name }"]` ).should( 'exist' ).click( { force: true } );
Expand Down Expand Up @@ -137,8 +144,15 @@ export function addBlockToPost( blockName, clearEditor = false ) {
export function addNewGroupToPost() {
clearBlocks();

cy.get( '.edit-post-header [aria-label="Add block"], .edit-site-header [aria-label="Add block"], .edit-post-header-toolbar__inserter-toggle' ).click();
cy.get( '.block-editor-inserter__search-input,input.block-editor-inserter__search, .components-search-control__input' ).click().type( 'group' );
if ( isWP65AtLeast() ) {
cy.get( '.editor-document-tools__inserter-toggle' ).click();

cy.get( '.components-input-control__input' ).click().type( 'group' );
} else {
cy.get( '.edit-post-header [aria-label="Add block"], .edit-site-header [aria-label="Add block"], .edit-post-header-toolbar__inserter-toggle' ).click();

cy.get( '.block-editor-inserter__search-input,input.block-editor-inserter__search, .components-search-control__input' ).click().type( 'group' );
}

cy.wait( 1000 );

Expand Down Expand Up @@ -196,9 +210,15 @@ export function viewPage() {
}
} );

cy.get( 'button[data-label="Post"]' );
if ( isWP65AtLeast() ) {
cy.get( '[data-tab-id="edit-post/document"]' );

cy.get( '.edit-post-post-url__dropdown button' ).click();
cy.get( '.editor-post-url__panel-dropdown button' ).click();
} else {
cy.get( 'button[data-label="Post"]' );

cy.get( '.edit-post-post-url__dropdown button' ).click();
}

cy.get( '.editor-post-url__link' ).then( ( pageLink ) => {
const linkAddress = Cypress.$( pageLink ).attr( 'href' );
Expand Down Expand Up @@ -461,9 +481,14 @@ export function setColorPanelSetting( settingName, hexColor ) {
* @param {RegExp} panelText The panel label text to open. eg: Color Settings
*/
export function openSettingsPanel( panelText ) {
// Ensure block tab is selected.
if ( Cypress.$( 'button[data-label="Block"]:not(.is-active)' ) ) {
cy.get( 'button[data-label="Block"]' ).click();
if ( isWP65AtLeast() ) {
cy.get( '[data-tab-id="edit-post/block"]' ).click();
} else {
// Ensure block tab is selected.
// eslint-disable-next-line no-lonely-if
if ( Cypress.$( 'button[data-label="Block"]:not(.is-active)' ) ) {
cy.get( 'button[data-label="Block"]' ).click();
}
}

cy.get( '.components-panel__body' )
Expand Down Expand Up @@ -552,7 +577,7 @@ export function addCustomBlockClass( classes, blockID = '' ) {
export function openCoBlocksLabsModal() {
// Open "more" menu.
cy.get( '.edit-post-more-menu button, .interface-more-menu-dropdown button' ).click();
cy.get( '.components-menu-group' ).contains( 'CoBlocks Labs' ).click();
cy.get( '.components-menu-group' ).contains( 'CoBlocks Labs' ).click( { force: true } );

cy.get( '.components-modal__frame' ).contains( 'CoBlocks Labs' ).should( 'exist' );
}
Expand Down Expand Up @@ -588,11 +613,14 @@ export function isNotWPLocalEnv() {
}

// A condition to determine if we are testing on WordPress 6.4+
// This function should be removed in the process of the work for WP 6.5 compatibility
export function isWP64AtLeast() {
return Cypress.$( "[class*='branch-6-4']" ).length > 0 || Cypress.$( "[class*='branch-6-5']" ).length > 0;
}

export function isWP65AtLeast() {
return Cypress.$( "[class*='branch-6-5']" ).length > 0 || Cypress.$( "[class*='branch-6-6']" ).length > 0;
}

function getIframeDocument( containerClass ) {
return cy.get( containerClass + ' iframe' ).its( '0.contentDocument' ).should( 'exist' );
}
Expand Down
2 changes: 1 addition & 1 deletion .dev/tests/phpunit/test-class-coblocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function test_constants() {
$reflection_method->invoke( coblocks() );

$expected = [
'version' => '3.1.6',
'version' => '3.1.8',
'plugin_dir' => str_replace( '.dev/tests/phpunit/', '', plugin_dir_path( __FILE__ ) ),
'plugin_url' => str_replace( '.dev/tests/phpunit/', '', plugin_dir_url( __FILE__ ) ),
'plugin_file' => str_replace( '.dev/tests/phpunit/test-class-coblocks.php', 'class-coblocks.php', __FILE__ ),
Expand Down
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module.exports = {
'sort-imports': [ 'off' ],
'sort-keys': [ 'off' ],
'react/jsx-sort-props': [ 'off' ],
'react-hooks/exhaustive-deps': [ 'off' ],
},

noInlineConfig: false,
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-create-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout-ref != '' && inputs.checkout-ref || github.event.repository.default_branch }}

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
zip -r $ARTIFACT_ZIP $ARTIFACT_PATH
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_ZIP }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy-create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
needs: update
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}

Expand All @@ -98,7 +98,7 @@ jobs:
needs: [ build, tag ]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}

Expand All @@ -113,7 +113,7 @@ jobs:
gh release create $RELEASE_VERSION -n "${{ github.event.milestone.description }}" -t "$RELEASE_VERSION"
- name: Download plugin
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-wordpress-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}

- name: Download plugin
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: build/coblocks
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-wordpress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ inputs.version }}

- name: Download plugin
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: build/coblocks
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/test-e2e-cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
phpVersion:
required: false
type: string
default: "8.2"
default: "8.3"
installPath:
required: false
type: string
Expand All @@ -34,7 +34,7 @@ jobs:
matrix: ${{ steps.setup-spec-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup wp-env
uses: godaddy-wordpress/setup-wp-env@v1
Expand All @@ -103,7 +103,7 @@ jobs:
themes: '["https://downloads.wordpress.org/theme/go.zip"]'

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down Expand Up @@ -175,7 +175,7 @@ jobs:
- name: Upload failure video
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.spec }}-fail.mp4
path: ./.dev/tests/cypress/videos/${{ matrix.spec }}.mp4
Expand Down Expand Up @@ -241,7 +241,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup wp-env
uses: godaddy-wordpress/setup-wp-env@v1
Expand All @@ -252,7 +252,7 @@ jobs:
themes: '["https://downloads.wordpress.org/theme/go.zip"]'

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down Expand Up @@ -324,7 +324,7 @@ jobs:
- name: Upload failure video
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.spec }}-fail.mp4
path: ./.dev/tests/cypress/videos/${{ matrix.spec }}.mp4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- "" # Default theme is TwentyTwentyThree
php: # Test against minimum and latest PHP versions.
- "7.4"
- "8.2"
- "8.3"
with:
wpVersion: "WordPress/WordPress#${{matrix.wp}}"
theme: ${{matrix.theme}}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-php-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
phpVersion:
required: false
type: string
default: '8.1'
default: '8.3'
wpVersion:
required: false
type: string
Expand All @@ -18,10 +18,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/test-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ on:
jobs:
# PHP Unit testing
# Unit testing should be run across WP current, previous, and major before previous.
# Unit tests should be run across all supported versions of PHP.
php_unit_versions_matrix:
strategy:
matrix:
php: ['7.4','8.0','8.1','8.2']
wp: ['6.4', '6.3']
php: ['7.4','8.3']
wp: ['6.4'] # TODO: Add 6.5 when released
name: PHP Unit ${{ matrix.php }} | WP Version ${{ matrix.wp }}
uses: ./.github/workflows/test-php-unit.yml
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-wp-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: ./.github/workflows/date-checker.yml
with:
# WP Next scheduled release date. Should be based on `https://make.wordpress.org/core/6-4/` or later.
scheduled_release_date: "2023-11-7"
scheduled_release_date: "2024-04-02"

# Create WP NEXT Version Constant
set_constant:
Expand All @@ -22,8 +22,8 @@ jobs:
if: needs.check_if_released.outputs.should_run_workflow == 'true'
runs-on: ubuntu-latest
outputs:
# Should be current latest WP Next release on `wordpress.org`. eg: `https://wordpress.org/wordpress-6.4-RC3.zip`
wp_next: "https://wordpress.org/wordpress-6.4-RC3.zip"
# Should be current latest WP Next release on `wordpress.org`. eg: `https://wordpress.org/wordpress-6.5-beta2.zip`
wp_next: "https://wordpress.org/wordpress-6.5-RC4.zip"
steps:
- run: echo "Setting WP Next Constant"

Expand All @@ -35,7 +35,7 @@ jobs:
uses: ./.github/workflows/test-e2e-cypress.yml
with:
wpVersion: ${{ needs.set_constant.outputs.wp_next }}
installPath: "tests-wordpress-6.4-RC3"
installPath: "tests-wordpress-6.5-RC4"
theme: "https://downloads.wordpress.org/theme/go.zip"
concurrency:
group: chrome-wp-next
Expand All @@ -47,7 +47,7 @@ jobs:
name: PHP ${{ matrix.php }} WP Next Version
strategy:
matrix:
php: ['7.4','8.0','8.1','8.2']
php: ['7.4','8.3']
uses: ./.github/workflows/test-php-unit.yml
with:
phpVersion: ${{ matrix.php }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/translation-localization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup GoDaddy Git User
uses: godaddy-wordpress/setup-godaddy-git-user@v1

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down
Loading

0 comments on commit 6ead176

Please sign in to comment.