Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
6ea1d57
Release script: Update react-native-editor version to 1.76.0
jhnstn May 11, 2022
bcddcbc
Release script: Update with changes from 'npm run core preios'
jhnstn May 11, 2022
678bd2f
Update Changelog
jhnstn May 11, 2022
21b838c
Release script: Update react-native-editor version to 1.76.1
May 20, 2022
7f79f52
Release script: Update with changes from 'npm run core preios'
May 20, 2022
981471e
[Mobile] - BlockList - Add internal onLayout from CellRendererCompone…
May 18, 2022
0087e3d
[Mobile] - Fix Drag & Drop Chip positioning issue with RTL languages …
May 18, 2022
5c6fe0d
[RNMobile] Add drag & drop help guide in Help & Support screen (#40961)
fluiddot May 19, 2022
09d4368
[RNMobile] Fix drag mode not being enabled when long-pressing over Sh…
fluiddot May 20, 2022
c951e59
Mobile - Update changelog
May 20, 2022
d0b2cea
Translate NEW badge in Move blocks help screen
fluiddot May 20, 2022
132bc3a
Release script: Update react-native-editor version to 1.77.0
SiobhyB May 24, 2022
cb4105f
Release script: Update with changes from 'npm run core preios'
SiobhyB May 24, 2022
639598f
[RNMobile] Improve text read by screen readers for BottomSheetSelectC…
SiobhyB May 13, 2022
3fe5683
[RNMobile] Add 'Insert from URL' option to Image block (#40334)
derekblank May 23, 2022
a6dd494
[RNMobile] - E2E Simplify heading and lists blocks functions (#40670)
jostnes May 16, 2022
1b3391e
Add ruby version file (#41013)
jhnstn May 12, 2022
148f835
[RNMobile] Improvements to Getting Started Guides (#40964)
SiobhyB May 23, 2022
a046a61
update expected html for file block (#41300)
jostnes May 25, 2022
ede6624
Add waitForVisible() to all blocks (#41126)
jostnes May 25, 2022
2daf775
Update CHANGELOG
SiobhyB May 26, 2022
d8fbfbd
Revert "update expected html for file block (#41300)"
SiobhyB May 26, 2022
efc0f2c
[RNMobile] Ensure post title gets focused when is notified from nativ…
fluiddot May 26, 2022
4c714af
Release script: Update react-native-editor version to 1.77.1
fluiddot Jun 2, 2022
9365c4e
Release script: Update with changes from 'npm run core preios'
fluiddot Jun 2, 2022
ad2c8e4
[RNMobile] Bump `react-native-reanimated` version to `2.4.1-wp-3` (#4…
fluiddot Jun 2, 2022
f10a378
Update react-native-editor changelog
fluiddot Jun 2, 2022
4cfbd82
Release script: Update react-native-editor version to 1.78.0
fluiddot Jun 10, 2022
5b447b4
Release script: Update with changes from 'npm run core preios'
fluiddot Jun 10, 2022
8bd8d90
[RNMobile] Bump `react-native-gesture-handler` to version `2.3.2` (#4…
fluiddot May 27, 2022
bdaaf6e
Update react-native-editor changelog
fluiddot Jun 10, 2022
6e13c9e
Release script: Update react-native-editor version to 1.78.1
SiobhyB Jun 16, 2022
32ab484
Release script: Update with changes from 'npm run core preios'
SiobhyB Jun 16, 2022
4ae461c
[RNMobile] Gallery block: Re-introduce `v1` (#41533)
fluiddot Jun 14, 2022
01adee1
[RNMobile] Fix missing translations for locales that include region (…
fluiddot Jun 14, 2022
b1352b7
Update CHANGELOG
SiobhyB Jun 16, 2022
77417b6
Release script: Update react-native-editor version to 1.79.0
dcalhoun Jul 7, 2022
4e35a9d
Release script: Update with changes from 'npm run core preios'
dcalhoun Jul 7, 2022
2f31836
[RNMobile] Add integration tests to cover Drag & Drop functionality (…
fluiddot May 31, 2022
fb5f7e4
[Mobile] - Add E2E tests for the Drag & Drop blocks feature (#41368)
May 31, 2022
aee2a06
Mobile - Skip some of the Drag & Drop E2E on iOS (#41529)
Jun 3, 2022
c7a740c
where it can change to use clickIfClickable(), add new param for wait…
jostnes Jun 2, 2022
83444ec
[RNMobile] Add 'Insert from URL' option to Video block (#41493)
derekblank Jun 9, 2022
d407e8f
Upgrade Aztec to v1.5.9 (#41828)
derekblank Jun 22, 2022
720843b
fix: Image block preserves alt text from media library (#41839)
dcalhoun Jun 23, 2022
94e8c68
[RNMobile] Implement recovery option for invalid blocks (#41988)
SiobhyB Jul 4, 2022
95a1894
docs: Update change log
dcalhoun Jul 7, 2022
c9c1e6b
[RNMobile] Upgrades Gradle to 7.4.2 & Android Gradle Plugin to 7.2.1 …
oguzkocer Jul 7, 2022
581fc70
Update Aztec-Android version to v1.6.0 (#42243)
oguzkocer Jul 7, 2022
5f7855f
Release script: Update react-native-editor version to 1.79.1
dcalhoun Jul 19, 2022
170b21a
Release script: Update with changes from 'npm run core preios'
dcalhoun Jul 19, 2022
62e7ef0
fix: Workaround Android 12 webview crash (#42517)
dcalhoun Jul 19, 2022
c905e8d
Merge branch 'trunk' of github.com:WordPress/gutenberg into rnmobile/…
dcalhoun Jul 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
where it can change to use clickIfClickable(), add new param for wait…
…ForVisible() to control return value (#41367)

Co-authored-by: jos <[email protected]>
  • Loading branch information
2 people authored and dcalhoun committed Jul 7, 2022
commit c7a740ca64c87ec1cf6f953b5e2c33c5c1e14f9d
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ describe( 'Gutenberg Editor tests for Block insertion 2', () => {
} );

it( 'inserts between 2 existing blocks', async () => {
const headingBlockElement = await editorPage.getBlockAtPosition(
blockNames.heading
);
const firstBlock = await editorPage.getFirstBlockVisible();
await firstBlock.click();

await headingBlockElement.click();
await editorPage.addNewBlock( blockNames.separator );

const expectedHtml = [
Expand Down
31 changes: 9 additions & 22 deletions packages/react-native-editor/__device-tests__/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import testData from './helpers/test-data';

describe( 'Gutenberg Editor Image Block tests', () => {
it( 'should be able to add an image block', async () => {
await editorPage.addNewBlock( blockNames.image );
await editorPage.closePicker();
// iOS only test - Can only add image from media library on iOS
if ( ! isAndroid() ) {
await editorPage.addNewBlock( blockNames.image );
await editorPage.closePicker();

const imageBlock = await editorPage.getBlockAtPosition(
blockNames.image
);
const imageBlock = await editorPage.getBlockAtPosition(
blockNames.image
);

// Can only add image from media library on iOS
if ( ! isAndroid() ) {
await editorPage.selectEmptyImageBlock( imageBlock );
await editorPage.chooseMediaLibrary();

Expand All @@ -31,27 +31,14 @@ describe( 'Gutenberg Editor Image Block tests', () => {
true
);
await editorPage.dismissKeyboard();
}
await editorPage.addNewBlock( blockNames.paragraph );
const paragraphBlockElement = await editorPage.getTextBlockAtPosition(
blockNames.paragraph,
2
);
if ( isAndroid() ) {
await paragraphBlockElement.click();
}

await editorPage.sendTextToParagraphBlock( 2, testData.shortText );

// skip HTML check for Android since we couldn't add image from media library
/* eslint-disable jest/no-conditional-expect */
if ( ! isAndroid() ) {
await editorPage.addNewBlock( blockNames.paragraph );
await editorPage.sendTextToParagraphBlock( 2, testData.shortText );
const html = await editorPage.getHtmlContent();

expect( html.toLowerCase() ).toBe(
testData.imageShorteHtml.toLowerCase()
);
}
/* eslint-enable jest/no-conditional-expect */
} );
} );
27 changes: 22 additions & 5 deletions packages/react-native-editor/__device-tests__/helpers/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,13 +516,15 @@ const waitForMediaLibrary = async ( driver ) => {
* @param {string} driver
* @param {string} elementLocator
* @param {number} maxIteration - Default value is 25
* @param {string} elementToReturn - Options are allElements, lastElement, firstElement. Defaults to "firstElement"
* @param {number} iteration - Default value is 0
* @return {string} - Returns the first element found, empty string if not found
*/
const waitForVisible = async (
driver,
elementLocator,
maxIteration = 25,
elementToReturn = 'firstElement',
iteration = 0
) => {
const timeout = 1000;
Expand All @@ -539,35 +541,47 @@ const waitForVisible = async (
await driver.sleep( timeout );
}

const element = await driver.elementsByXPath( elementLocator );
if ( element.length === 0 ) {
const elements = await driver.elementsByXPath( elementLocator );
if ( elements.length === 0 ) {
// if locator is not visible, try again
return waitForVisible(
driver,
elementLocator,
maxIteration,
elementToReturn,
iteration + 1
);
}

return element[ 0 ];
switch ( elementToReturn ) {
case 'allElements':
return elements;
case 'lastElement':
return elements[ elements.length - 1 ];
default:
// Default is to return first element
return elements[ 0 ];
}
};

/**
* @param {string} driver
* @param {string} elementLocator
* @param {number} maxIteration - Default value is 25, can be adjusted to be less to wait for element to not be visible
* @param {string} elementToReturn - Options are allElements, lastElement, firstElement. Defaults to "firstElement"
* @return {boolean} - Returns true if element is found, false otherwise
*/
const isElementVisible = async (
driver,
elementLocator,
maxIteration = 25
maxIteration = 25,
elementToReturn = 'firstElement'
) => {
const element = await waitForVisible(
driver,
elementLocator,
maxIteration
maxIteration,
elementToReturn
);

// if there is no element, return false
Expand All @@ -582,12 +596,14 @@ const clickIfClickable = async (
driver,
elementLocator,
maxIteration = 25,
elementToReturn = 'firstElement',
iteration = 0
) => {
const element = await waitForVisible(
driver,
elementLocator,
maxIteration,
elementToReturn,
iteration
);

Expand All @@ -606,6 +622,7 @@ const clickIfClickable = async (
driver,
elementLocator,
maxIteration,
elementToReturn,
iteration + 1
);
}
Expand Down
59 changes: 21 additions & 38 deletions packages/react-native-editor/__device-tests__/pages/editor-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ class EditorPage {
if ( ! isAndroid() ) {
const textBlockLocator = `(//XCUIElementTypeButton[contains(@name, "${ blockName } Block. Row ${ position }")])`;

const textBlock = await waitForVisible(
this.driver,
textBlockLocator
);
await textBlock.click();
await clickIfClickable( this.driver, textBlockLocator );
}

const blockLocator = isAndroid()
Expand Down Expand Up @@ -151,9 +147,12 @@ class EditorPage {

async getLastBlockVisible() {
const firstBlockLocator = `//*[contains(@${ this.accessibilityIdXPathAttrib }, " Block. Row ")]`;
await waitForVisible( this.driver, firstBlockLocator );
const elements = await this.driver.elementsByXPath( firstBlockLocator );
return elements[ elements.length - 1 ];
return await waitForVisible(
this.driver,
firstBlockLocator,
25,
'lastElement'
);
}

async hasBlockAtPosition( position = 1, blockName = '' ) {
Expand Down Expand Up @@ -243,12 +242,10 @@ class EditorPage {
// Sometimes double tap is not enough for paste menu to appear, so we also long press.
await longPressMiddleOfElement( this.driver, htmlContentView );

const pasteButton = await waitForVisible(
await clickIfClickable(
this.driver,
'//XCUIElementTypeMenuItem[@name="Paste"]'
);

await pasteButton.click();
}

await toggleHtmlMode( this.driver, false );
Expand All @@ -262,10 +259,11 @@ class EditorPage {
if ( isAndroid() ) {
return await this.driver.hideDeviceKeyboard();
}
const hideKeyboardToolbarButton = await this.driver.elementByXPath(

await clickIfClickable(
this.driver,
'//XCUIElementTypeButton[@name="Hide keyboard"]'
);
await hideKeyboardToolbarButton.click();
}

async dismissAndroidClipboardSmartSuggestion() {
Expand Down Expand Up @@ -645,11 +643,7 @@ class EditorPage {
? `//android.widget.Button[@content-desc="WordPress Media Library"]`
: `//XCUIElementTypeButton[@name="WordPress Media Library"]`;

const mediaLibraryButton = await waitForVisible(
this.driver,
mediaLibraryLocator
);
await mediaLibraryButton.click();
await clickIfClickable( this.driver, mediaLibraryLocator );
}

async enterCaptionToSelectedImageBlock( caption, clear = true ) {
Expand All @@ -669,11 +663,10 @@ class EditorPage {

await swipeDown( this.driver );
} else {
const cancelButton = await waitForVisible(
await clickIfClickable(
this.driver,
'//XCUIElementTypeButton[@name="Cancel"]'
);
await cancelButton.click();
}
}

Expand Down Expand Up @@ -703,42 +696,32 @@ class EditorPage {

const elementName = isAndroid() ? '//*' : '//XCUIElementTypeOther';

const locator = `${ elementName }[starts-with(@${ this.accessibilityIdXPathAttrib }, "Hide search heading")]`;
const hideSearchHeadingToggle = await waitForVisible(
const hideSearchHeadingToggleLocator = `${ elementName }[starts-with(@${ this.accessibilityIdXPathAttrib }, "Hide search heading")]`;
return await clickIfClickable(
this.driver,
locator
hideSearchHeadingToggleLocator
);

return await hideSearchHeadingToggle.click();
}

async changeSearchButtonPositionSetting( block, buttonPosition ) {
await this.openBlockSettings( block );

const elementName = isAndroid() ? '//*' : '//XCUIElementTypeButton';

const locator = `${ elementName }[starts-with(@${ this.accessibilityIdXPathAttrib }, "Button position")]`;
let optionMenuButton = await waitForVisible( this.driver, locator );
await optionMenuButton.click();
const optionMenuLocator = `${ elementName }[starts-with(@${ this.accessibilityIdXPathAttrib }, "Button position")]`;
await clickIfClickable( this.driver, optionMenuLocator );

const optionMenuButtonLocator = `${ elementName }[contains(@${ this.accessibilityIdXPathAttrib }, "${ buttonPosition }")]`;
optionMenuButton = await waitForVisible(
this.driver,
optionMenuButtonLocator
);

return await optionMenuButton.click();
return await clickIfClickable( this.driver, optionMenuButtonLocator );
}

async toggleSearchIconOnlySetting( block ) {
await this.openBlockSettings( block );

const elementName = isAndroid() ? '//*' : '//XCUIElementTypeOther';

const locator = `${ elementName }[starts-with(@${ this.accessibilityIdXPathAttrib }, "Use icon button")]`;
const useIconButton = await waitForVisible( this.driver, locator );

return await useIconButton.click();
const useIconButtonLocator = `${ elementName }[starts-with(@${ this.accessibilityIdXPathAttrib }, "Use icon button")]`;
return await clickIfClickable( this.driver, useIconButtonLocator );
}

async isSearchSettingsVisible() {
Expand Down