Skip to content

Commit

Permalink
Merge pull request #1771 from wordpress-mobile/update-master-20200113
Browse files Browse the repository at this point in the history
Update Gutenberg to master
  • Loading branch information
Tug committed Jan 14, 2020
2 parents 6344967 + 65f62ad commit fc03918
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
12 changes: 4 additions & 8 deletions __device-tests__/pages/editor-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 ) {
Expand All @@ -228,7 +225,6 @@ export default class EditorPage {
}
}

removeBlockLocator += `[@${ this.accessibilityIdXPathAttrib }="${ removeButtonIdentifier }"]`;
const removeButton = await this.driver.elementByXPath( removeBlockLocator );
await removeButton.click();
}
Expand Down
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 186 files
11 changes: 11 additions & 0 deletions src/jsdom-patches.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit fc03918

Please sign in to comment.