Skip to content

Commit 38e6a45

Browse files
authored
Merge pull request #17369 from wordpress-mobile/uitii-publish-full-post-fix
[UITII] Fix flakiness in "e2ePublishFullPost" while opening menu.
2 parents 5c853f9 + 15af694 commit 38e6a45

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/BlockEditorPage.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
import static org.wordpress.android.support.WPSupportUtils.waitForElementToBeDisplayedWithoutFailure;
2626
import static junit.framework.TestCase.assertTrue;
2727
import static org.wordpress.android.support.WPSupportUtils.withIndex;
28+
import static org.junit.Assert.fail;
2829

2930
public class BlockEditorPage {
3031
private static ViewInteraction titleField = onView(withHint("Add title"));
32+
private static ViewInteraction postSettingButton = onView(withText(R.string.post_settings));
3133

3234
private ViewInteraction mEditor;
3335

@@ -74,10 +76,29 @@ public BlockEditorPage addPostSettings(String categoryName, String tagName) {
7476
return this;
7577
}
7678

77-
public void openPostSetting() {
79+
/**
80+
* Taps the three vertical dots menu button located at the editor screen top right.
81+
* Since the tap does not always succeed on FTL, one retry is used
82+
*/
83+
public void openPostKebabMenu() {
7884
waitForElementToBeDisplayed(R.id.toolbar_main);
85+
86+
// First attempt to tap the kebab menu (three dots)
7987
openActionBarOverflowOrOptionsMenu(ApplicationProvider.getApplicationContext());
80-
clickOn(onView(withText(R.string.post_settings)));
88+
89+
// Check if the attempt succeeded, retry once if not
90+
if (!waitForElementToBeDisplayedWithoutFailure(postSettingButton)) {
91+
openActionBarOverflowOrOptionsMenu(ApplicationProvider.getApplicationContext());
92+
}
93+
94+
if (!waitForElementToBeDisplayedWithoutFailure(postSettingButton)) {
95+
fail("Failed to open post menu.");
96+
}
97+
}
98+
99+
public void openPostSetting() {
100+
openPostKebabMenu();
101+
clickOn(postSettingButton);
81102
}
82103

83104
public void addCategory(String category) {

0 commit comments

Comments
 (0)