Skip to content

Commit

Permalink
Use a different locator depending on the type of site for clicking th…
Browse files Browse the repository at this point in the history
…e Instagram block "Embed" button (#77228)
  • Loading branch information
fullofcaffeine committed May 23, 2023
1 parent a973c91 commit 3ef59a2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/calypso-e2e/src/lib/blocks/block-flows/instagram.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { envVariables } from '../../..';
import { BlockFlow, EditorContext, PublishedPostContext } from '.';

interface ConfigurationData {
Expand Down Expand Up @@ -34,7 +35,17 @@ export class InstagramBlockFlow implements BlockFlow {
await editorCanvas
.getByPlaceholder( 'Enter URL to embed here…' )
.fill( this.configurationData.embedUrl );
await editorCanvas.getByRole( 'button', { name: 'Embed' } ).click();

if ( envVariables.TEST_ON_ATOMIC ) {
await editorCanvas.getByRole( 'button', { name: 'Embed' } ).click();
} else {
// For some reason, the hierarchy/selector changes for simple sites. Probably
// because it's running from within the Gutenframe?
await editorCanvas
.getByRole( 'document', { name: 'Block: Embed' } )
.getByRole( 'button', { name: 'Embed' } )
.click();
}

await editorCanvas.getByTitle( 'Embedded content from instagram.com' ).waitFor();
}
Expand Down

0 comments on commit 3ef59a2

Please sign in to comment.