|
25 | 25 | import static org.wordpress.android.support.WPSupportUtils.waitForElementToBeDisplayedWithoutFailure; |
26 | 26 | import static junit.framework.TestCase.assertTrue; |
27 | 27 | import static org.wordpress.android.support.WPSupportUtils.withIndex; |
| 28 | +import static org.junit.Assert.fail; |
28 | 29 |
|
29 | 30 | public class BlockEditorPage { |
30 | 31 | private static ViewInteraction titleField = onView(withHint("Add title")); |
| 32 | + private static ViewInteraction postSettingButton = onView(withText(R.string.post_settings)); |
31 | 33 |
|
32 | 34 | private ViewInteraction mEditor; |
33 | 35 |
|
@@ -74,10 +76,29 @@ public BlockEditorPage addPostSettings(String categoryName, String tagName) { |
74 | 76 | return this; |
75 | 77 | } |
76 | 78 |
|
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() { |
78 | 84 | waitForElementToBeDisplayed(R.id.toolbar_main); |
| 85 | + |
| 86 | + // First attempt to tap the kebab menu (three dots) |
79 | 87 | 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); |
81 | 102 | } |
82 | 103 |
|
83 | 104 | public void addCategory(String category) { |
|
0 commit comments