diff --git a/__device-tests__/pages/editor-page.js b/__device-tests__/pages/editor-page.js index 0cdeb6a8d33cd6..174dc6d4f657fc 100644 --- a/__device-tests__/pages/editor-page.js +++ b/__device-tests__/pages/editor-page.js @@ -48,7 +48,7 @@ export default class EditorPage { // and accessibilityId attributes on this object and selects the block // position uses one based numbering async getBlockAtPosition( position: number, blockName: string, options: { autoscroll: boolean } = { autoscroll: false } ) { - const blockLocator = `//*[contains(@${ this.accessibilityIdXPathAttrib }, "${ blockName } Block. Row ${ position }.")]`; + const blockLocator = `//*[contains(@${ this.accessibilityIdXPathAttrib }, "${ blockName } Block. Row ${ position }")]`; const elements = await this.driver.elementsByXPath( blockLocator ); const lastElementFound = elements[ elements.length - 1 ]; if ( elements.length === 0 && options.autoscroll ) { @@ -212,14 +212,11 @@ export default class EditorPage { throw Error( `No Block at position ${ position }` ); } - const parentId = `${ blockName } Block. Row ${ position }.`; - const parentLocator = `//*[contains(@${ this.accessibilityIdXPathAttrib }, "${ parentId }")]`; - let removeBlockLocator = `${ parentLocator }`; - removeBlockLocator += isAndroid() ? '//*' : '//XCUIElementTypeButton'; - let removeButtonIdentifier = `Remove block at row ${ position }`; + const buttonElementName = isAndroid() ? '//*' : '//XCUIElementTypeButton'; + const removeButtonIdentifier = `Remove block at row ${ position }`; + const removeBlockLocator = `${ buttonElementName }[contains(@${ this.accessibilityIdXPathAttrib }, "${ removeButtonIdentifier }")]`; if ( isAndroid() ) { - removeButtonIdentifier += `, Double tap to remove the block${ this.accessibilityIdSuffix }`; const block = await this.getBlockAtPosition( position, blockName ); let checkList = await this.driver.elementsByXPath( removeBlockLocator ); while ( checkList.length === 0 ) { @@ -228,7 +225,6 @@ export default class EditorPage { } } - removeBlockLocator += `[@${ this.accessibilityIdXPathAttrib }="${ removeButtonIdentifier }"]`; const removeButton = await this.driver.elementByXPath( removeBlockLocator ); await removeButton.click(); } diff --git a/gutenberg b/gutenberg index 73994a8f83df09..0f2ec15ed40192 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 73994a8f83df09abd49e269ae234666d7237da9a +Subproject commit 0f2ec15ed40192a165f79790effa8edaf6504597 diff --git a/src/jsdom-patches.js b/src/jsdom-patches.js index 60d7c220d650f7..3fffeb1169a2c1 100644 --- a/src/jsdom-patches.js +++ b/src/jsdom-patches.js @@ -238,3 +238,14 @@ Object.defineProperties( Node.prototype, { }, }, } ); + +class DOMParser { + // This is required for the stripHTML function, but it doesn't necessarily + // conform to the DOM standard. + // See https://github.com/wordpress-mobile/gutenberg-mobile/pull/1771 + parseFromString( string ) { + return jsdom.html( string ); + } +} + +global.DOMParser = DOMParser;