From 4b0efecbc29fb44b40d122a8939b887a2de4fd1f Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Mon, 13 Jan 2020 10:08:13 +0100 Subject: [PATCH 1/4] Update Gutenberg --- gutenberg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gutenberg b/gutenberg index 73994a8f83df09..0f2ec15ed40192 160000 --- a/gutenberg +++ b/gutenberg @@ -1 +1 @@ -Subproject commit 73994a8f83df09abd49e269ae234666d7237da9a +Subproject commit 0f2ec15ed40192a165f79790effa8edaf6504597 From 4a62b9c505d666a7bb74eca5be2a16eda1b9f100 Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Mon, 13 Jan 2020 10:22:18 +0100 Subject: [PATCH 2/4] Adds missing DOMParser implementation --- src/jsdom-patches.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/jsdom-patches.js b/src/jsdom-patches.js index 60d7c220d650f7..cbba755e5b7972 100644 --- a/src/jsdom-patches.js +++ b/src/jsdom-patches.js @@ -238,3 +238,11 @@ Object.defineProperties( Node.prototype, { }, }, } ); + +class DOMParser { + parseFromString( string ) { + return jsdom.html( string ); + } +} + +global.DOMParser = DOMParser; From 397397bbea5b73b77cfd3ff6e1d97f62c7c208ce Mon Sep 17 00:00:00 2001 From: Jorge Bernal Date: Tue, 14 Jan 2020 11:04:33 +0100 Subject: [PATCH 3/4] Add comment on DOMParser --- src/jsdom-patches.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/jsdom-patches.js b/src/jsdom-patches.js index cbba755e5b7972..3fffeb1169a2c1 100644 --- a/src/jsdom-patches.js +++ b/src/jsdom-patches.js @@ -240,6 +240,9 @@ 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 ); } From 76278729c9b960aab6ef24e5582637dbe490f9c3 Mon Sep 17 00:00:00 2001 From: Matthew Kevins Date: Tue, 14 Jan 2020 21:09:00 +1000 Subject: [PATCH 4/4] Modify XPath methods to fix failing mobile UI tests --- __device-tests__/pages/editor-page.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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(); }