Skip to content

Commit

Permalink
Revert "Gutenberg: Trigger E2E suite for v9.9.x upgrade (#49599)"
Browse files Browse the repository at this point in the history
This reverts commit 30f1c62.
  • Loading branch information
WunderBart authored and fullofcaffeine committed Feb 15, 2021
1 parent 892a94a commit 6aaba61
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 60 deletions.
51 changes: 6 additions & 45 deletions test/e2e/lib/gutenberg/gutenberg-editor-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,11 @@ export default class GutenbergEditorComponent extends AsyncBaseContainer {
`.edit-post-layout__inserter-panel .block-editor-block-types-list button.editor-block-list-item-${ prefix }${ blockClass }, ${ deprecatedInserterBlockItemSelector }`
);

const insertedBlockSelectorStr = `.block-editor-block-list__block.${
initsWithChildFocus ? 'has-child-selected' : 'is-selected'
}[aria-label*='${ ariaLabel }']`;

let insertedBlockSelector = By.css( insertedBlockSelectorStr );
const insertedBlockSelector = By.css(
`.block-editor-block-list__block.${
initsWithChildFocus ? 'has-child-selected' : 'is-selected'
}[aria-label*='${ ariaLabel }']`
);

await this.openBlockInserterAndSearch( title );

Expand All @@ -409,46 +409,7 @@ export default class GutenbergEditorComponent extends AsyncBaseContainer {
// The normal click is needed to avoid hovering the element, which seems
// to cause the element to become stale.
await driverHelper.clickWhenClickable( this.driver, inserterBlockItemSelector );

await driverHelper
.waitTillPresentAndDisplayed( this.driver, insertedBlockSelector )
.catch( () => {
/**
* Temporary workaround for https://github.com/WordPress/gutenberg/issues/28932.
* More context: p1612999643307600-slack-C7YPUHBB2.
*
* Why not skipping the step? Because:
* - The bug is not critical;
* - We still want the rest of the step*[0] to run, ideally;
* - While the bug is not critical and AFAIK it only happens in a single step
* in the Desktop viewport, it's possible it could manifest in other situations and
* break more tests while we don't have a fix upstream.
*
* *[0] https://github.com/Automattic/wp-calypso/blob/trunk/test/e2e/specs/wp-calypso-gutenberg-post-editor-spec.js#L72
*
* The change also tries to be as less intrusive as possible and only takes place if
* an element that's expected to be found, can't.
*
* What are we doing here, exactly?
*
* At this point, the block has been just inserted in the editor.
*
* We then try to find it with the selector generated by `getInserterBlockSelector()` above,
* by default it includes the `is-selected` CSS class, which assumes the block is focused/selected
* in the editor.
*
* If we can't find it (which means we fell into the buggy scenario described in the issue above), we
* regenerate the selector, this time making sure that it doesn't include an `is-selected` class selector
* as part of it. This should be enugh for the rest of the code to find it and proceed as expected.
*
* ToDo: Once the fix for https://github.com/WordPress/gutenberg/issues/28932 is available,
* revert this.
*/

// No need to wait here as if we got to this point, we already waited
// for the `waitTillPresentAndDisplayed`'s timeout.
insertedBlockSelector = By.css( insertedBlockSelectorStr.replace( '.is-selected', '' ) );
} );
await driverHelper.waitTillPresentAndDisplayed( this.driver, insertedBlockSelector );

return this.driver.findElement( insertedBlockSelector ).getAttribute( 'id' );
}
Expand Down
9 changes: 1 addition & 8 deletions test/e2e/specs/wp-calypso-gutenberg-page-editor-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import assert from 'assert';
import config from 'config';
import { By } from 'selenium-webdriver';

/**
* Internal dependencies
Expand Down Expand Up @@ -65,13 +64,7 @@ describe( `[${ host }] Calypso Gutenberg Editor: Pages (${ screenSize })`, funct
const gEditorComponent = await GutenbergEditorComponent.Expect( driver );
await gEditorComponent.enterTitle( pageTitle );
await gEditorComponent.enterText( pageQuote );
const imageBlockId = await gEditorComponent.addImage( fileDetails );

// Force-select the image block. Workaround for https://github.com/WordPress/gutenberg/issues/28932.
// This is needed or the sidebar won't have the contextual settings for the block, and the step will fail.
// ToDo: Once the fix for https://github.com/WordPress/gutenberg/issues/28932 is available,
// revert this and the assignment above.
await driverHelper.clickWhenClickable( driver, By.css( `#${ imageBlockId }` ) );
await gEditorComponent.addImage( fileDetails );

await gEditorComponent.openSidebar();
const gEditorSidebarComponent = await GutenbergEditorSidebarComponent.Expect( driver );
Expand Down
8 changes: 1 addition & 7 deletions test/e2e/specs/wp-calypso-gutenberg-post-editor-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,7 @@ describe( `[${ host }] Calypso Gutenberg Editor: Posts (${ screenSize })`, funct
const gEditorComponent = await GutenbergEditorComponent.Expect( driver );
await gEditorComponent.enterTitle( blogPostTitle );
await gEditorComponent.enterText( blogPostQuote );
const imageBlockId = await gEditorComponent.addImage( fileDetails );

// Force-select the image block. Workaround for https://github.com/WordPress/gutenberg/issues/28932.
// This is needed or the sidebar won't have the contextual settings for the block, and the step will fail.
// ToDo: Once the fix for https://github.com/WordPress/gutenberg/issues/28932 is available,
// revert this and the assignment above.
await driverHelper.clickWhenClickable( driver, By.css( `#${ imageBlockId }` ) );
await gEditorComponent.addImage( fileDetails );

await gEditorComponent.openSidebar();
const gEditorSidebarComponent = await GutenbergEditorSidebarComponent.Expect( driver );
Expand Down

0 comments on commit 6aaba61

Please sign in to comment.