Blocks: Update wp-env config to use production WP (#49704)

This commit is contained in:
Bart Kalisz 2024-08-01 11:59:42 +02:00 committed by GitHub
parent e65e8bf83a
commit 63e212f9ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 42 additions and 69 deletions

View File

@ -1,5 +1,5 @@
{
"core": "https://wordpress.org/wordpress-6.6-RC2.zip",
"core": null,
"plugins": [
"https://github.com/WP-API/Basic-Auth/archive/master.zip",
"https://downloads.wordpress.org/plugin/wordpress-importer.0.8.zip",

View File

@ -49,7 +49,7 @@ test.describe( 'Single Product template', () => {
await admin.visitSiteEditor( {
postType: testData.templateType,
} );
await editor.revertTemplateCreation( testData.templateName );
await editor.revertTemplate( { templateName: testData.templateName } );
await page.goto( testData.permalink );
// Verify the edits are no longer visible.

View File

@ -53,7 +53,7 @@ test.describe( 'Single Product Template', () => {
await admin.visitSiteEditor( {
postType: testData.templateType,
} );
await editor.revertTemplateCustomizations( {
await editor.revertTemplate( {
templateName: testData.templateName,
} );
await page.goto( testData.permalink );

View File

@ -58,7 +58,7 @@ test.describe( 'Template customization', () => {
await admin.visitSiteEditor( {
postType: testData.templateType,
} );
await editor.revertTemplateCustomizations( {
await editor.revertTemplate( {
templateName: testData.templateName,
} );
await testData.visitPage( { frontendUtils, page } );
@ -97,7 +97,7 @@ test.describe( 'Template customization', () => {
await admin.visitSiteEditor( {
postType: testData.templateType,
} );
await editor.revertTemplateCustomizations( {
await editor.revertTemplate( {
templateName:
testData.fallbackTemplate?.templateName || '',
} );
@ -180,7 +180,7 @@ test.describe( 'Template customization', () => {
postType: testData.templateType,
} );
await editor.revertTemplateCustomizations( {
await editor.revertTemplate( {
templateName: testData.templateName,
} );

View File

@ -67,7 +67,7 @@ test.describe( 'Template customization', () => {
await admin.visitSiteEditor( {
postType: testData.templateType,
} );
await editor.revertTemplateCustomizations( {
await editor.revertTemplate( {
templateName: testData.templateName,
} );
await testData.visitPage( { frontendUtils, page } );

View File

@ -90,9 +90,8 @@ test.describe( 'Template part customization', () => {
await admin.visitSiteEditor( {
postType: 'wp_template_part',
} );
await editor.revertTemplateCustomizations( {
await editor.revertTemplate( {
templateName,
templateType: 'wp_template_part',
} );
await testUtils.openMiniCart();

View File

@ -89,9 +89,8 @@ test.describe( 'Template part customization', () => {
await admin.visitSiteEditor( {
postType: 'wp_template_part',
} );
await editor.revertTemplateCustomizations( {
await editor.revertTemplate( {
templateName,
templateType: 'wp_template_part',
} );
await testUtils.openMiniCart();
await expect( page.getByText( userText ) ).toBeHidden();
@ -158,9 +157,8 @@ test.describe( 'Template part customization', () => {
postType: 'wp_template_part',
} );
await editor.revertTemplateCustomizations( {
await editor.revertTemplate( {
templateName,
templateType: 'wp_template_part',
} );
await testUtils.openMiniCart();

View File

@ -2,7 +2,6 @@
* External dependencies
*/
import { Editor as CoreEditor } from '@wordpress/e2e-test-utils-playwright';
import { expect } from '@woocommerce/e2e-utils';
export class Editor extends CoreEditor {
async getBlockByName( name: string ) {
@ -72,54 +71,20 @@ export class Editor extends CoreEditor {
}
}
async revertTemplateCreation( templateName: string ) {
async revertTemplate( { templateName }: { templateName: string } ) {
await this.page.getByPlaceholder( 'Search' ).fill( templateName );
await this.page.getByLabel( templateName, { exact: true } ).click();
const deletedNotice = this.page
await this.page.getByLabel( 'Actions' ).click();
await this.page
.getByRole( 'menuitem', { name: /Reset|Delete/ } )
.click();
await this.page.getByRole( 'button', { name: /Reset|Delete/ } ).click();
await this.page
.getByLabel( 'Dismiss this notice' )
.getByText( `"${ templateName }" deleted.` );
// Wait until search has finished.
const searchResults = this.page.getByLabel( 'Actions' );
const initialSearchResultsCount = await searchResults.count();
await expect
.poll( async () => await searchResults.count() )
.toBeLessThan( initialSearchResultsCount );
await searchResults.first().click();
await this.page.getByRole( 'menuitem', { name: 'Delete' } ).click();
await this.page.getByRole( 'button', { name: 'Delete' } ).click();
await expect( deletedNotice ).toBeVisible();
}
async revertTemplateCustomizations( {
templateName,
}: {
templateName: string;
} ) {
await this.page.getByPlaceholder( 'Search' ).fill( templateName );
const resetNotice = this.page
.getByLabel( 'Dismiss this notice' )
.getByText( `"${ templateName }" reset.` );
const savedButton = this.page.getByRole( 'button', {
name: 'Saved',
} );
// Wait until search has finished.
const searchResults = this.page.getByLabel( 'Actions' );
const initialSearchResultsCount = await searchResults.count();
await expect
.poll( async () => await searchResults.count() )
.toBeLessThan( initialSearchResultsCount );
await searchResults.first().click();
await this.page.getByRole( 'menuitem', { name: 'Reset' } ).click();
await this.page.getByRole( 'button', { name: 'Reset' } ).click();
await expect( resetNotice ).toBeVisible();
await expect( savedButton ).toBeVisible();
.getByText( /reset|deleted/ )
.waitFor();
}
async publishAndVisitPost() {

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Update WP version to 6.6 in Blocks wp-env config.

View File

@ -306,19 +306,26 @@ test.describe( 'Store owner can complete the core profiler', () => {
).toBeVisible();
// confirm that the optional plugins are present
await expect(
page.getByText( 'Pinterest for WooCommerce', { exact: true } )
page.locator( '.plugin-title', {
hasText: 'Pinterest for WooCommerce',
} )
).toBeVisible();
await expect(
page.locator( '.plugin-title', {
hasText: /Google for WooCommerce|Google Listings & Ads/,
} )
).toBeVisible();
await expect(
page
.getByRole( 'cell', {
name: 'Google for WooCommerce Get',
} )
.getByRole( 'strong' )
).toBeVisible();
await expect( page.getByText( 'MailPoet' ) ).toBeHidden();
await expect( page.getByText( 'Jetpack' ) ).toBeHidden();
page.locator( '.plugin-title', {
hasText: 'MailPoet',
} )
).toBeHidden();
await expect(
page.locator( '.plugin-title', {
hasText: 'Jetpack',
} )
).toBeHidden();
} );
await test.step( 'Confirm that information from core profiler saved', async () => {