Skip to content

Commit

Permalink
E2E tests fix in GB build (#95282)
Browse files Browse the repository at this point in the history
* Add block flow for test

* Revert "Add block flow for test"

This reverts commit 1472a47.

* Fix issues on blocks test for Gutenberg

* Fix tests

* Fix twitter fallback causing issues for social icon
  • Loading branch information
Imran92 authored Oct 10, 2024
1 parent db951d4 commit 22a9430
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/calypso-e2e/src/lib/blocks/block-flows/instagram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ export class InstagramBlockFlow implements BlockFlow {
this.configurationData = configurationData;
}

blockSidebarName = 'Instagram';
blockSidebarName = 'Instagram Embed';
blockTestFallBackName = 'Instagram';
blockEditorSelector = '[aria-label="Block: Embed"]:has-text("Instagram URL")';
noSearch = false;

/**
* Configure the block in the editor with the configuration data from the constructor
Expand Down
1 change: 0 additions & 1 deletion packages/calypso-e2e/src/lib/blocks/block-flows/twitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export class TwitterBlockFlow implements BlockFlow {
}

blockSidebarName = 'Twitter Embed';
blockTestFallBackName = 'Twitter';
blockEditorSelector = blockParentSelector;

/**
Expand Down
1 change: 1 addition & 0 deletions packages/calypso-e2e/src/lib/blocks/block-flows/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface BlockFlow {
blockTestName?: string;
blockTestFallBackName?: string;
blockEditorSelector: string;
noSearch?: boolean;
configure?( context: EditorContext ): Promise< void >;
validateAfterPublish?( context: PublishedPostContext ): Promise< void >;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/calypso-e2e/src/lib/blocks/block-flows/youtube.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const selectors = {
embedUrlInput: `${ blockParentSelector } input`,
embedButton: `${ blockParentSelector } button:has-text("Embed")`,
editorYouTubeIframe: 'iframe[title="Embedded content from www.youtube.com"]',
publishedYouTubeIframe: `iframe.youtube-player`,
publishedYouTubeIframe: '',
};

/**
Expand All @@ -26,10 +26,10 @@ export class YouTubeBlockFlow implements BlockFlow {
*/
constructor( configurationData: ConfigurationData ) {
this.configurationData = configurationData;
selectors.publishedYouTubeIframe = `iframe[title="${ this.configurationData.expectedVideoTitle }"]`;
}

blockSidebarName = 'YouTube Embed';
blockTestFallBackName = 'YouTube';
blockEditorSelector = blockParentSelector;

/**
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/blocks/blocks__core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { createBlockTests } from './shared/block-smoke-testing';
const blockFlows: BlockFlow[] = [
new YouTubeBlockFlow( {
embedUrl: 'https://www.youtube.com/watch?v=twGLN4lug-I',
expectedVideoTitle: 'Getting Started on @wordpress-com',
expectedVideoTitle: 'Getting started on @wordpressdotcom',
} ),
new LayoutGridBlockFlow( {
leftColumnText: DataHelper.getRandomPhrase(),
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/specs/blocks/shared/block-smoke-testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ export function createBlockTests( specName: string, blockFlows: BlockFlow[] ): v
const blockHandle = await editorPage.addBlockFromSidebar(
blockFlow.blockSidebarName,
blockFlow.blockEditorSelector,
{ noSearch: true, blockFallBackName: blockFlow.blockTestFallBackName }
{
noSearch: blockFlow.noSearch === false ? false : true,
blockFallBackName: blockFlow.blockTestFallBackName,
}
);
const id = await blockHandle.getAttribute( 'id' );
const editorCanvas = await editorPage.getEditorCanvas();
Expand Down

0 comments on commit 22a9430

Please sign in to comment.