diff --git a/WordPress/src/androidTest/java/org/wordpress/android/e2e/BlockEditorTests.java b/WordPress/src/androidTest/java/org/wordpress/android/e2e/BlockEditorTests.java index a690b1be3f27..869abcaa2d6b 100644 --- a/WordPress/src/androidTest/java/org/wordpress/android/e2e/BlockEditorTests.java +++ b/WordPress/src/androidTest/java/org/wordpress/android/e2e/BlockEditorTests.java @@ -10,7 +10,6 @@ import org.junit.Rule; import org.junit.Test; import org.wordpress.android.e2e.pages.BlockEditorPage; -import org.wordpress.android.e2e.pages.EditorPage; import org.wordpress.android.e2e.pages.MySitesPage; import org.wordpress.android.e2e.pages.PostPreviewPage; import org.wordpress.android.e2e.pages.SiteSettingsPage; @@ -58,12 +57,7 @@ public void testSwitchToClassicAndPreview() { blockEditorPage.enterTitle(title); - blockEditorPage.switchToClassic(); - - EditorPage editorPage = new EditorPage(); - editorPage.hasTitle(title); - - editorPage.previewPost(); + blockEditorPage.previewPost(); sleep(); new PostPreviewPage(); diff --git a/WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/BlockEditorPage.java b/WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/BlockEditorPage.java index 7311419c587b..41953fecb2fb 100644 --- a/WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/BlockEditorPage.java +++ b/WordPress/src/androidTest/java/org/wordpress/android/e2e/pages/BlockEditorPage.java @@ -13,6 +13,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.withHint; import static androidx.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.matcher.ViewMatchers.withText; import static org.wordpress.android.support.WPSupportUtils.clickOn; import static org.wordpress.android.support.WPSupportUtils.waitForElementToBeDisplayed; @@ -34,8 +35,8 @@ public void enterTitle(String postTitle) { titleField.perform(typeText(postTitle), ViewActions.closeSoftKeyboard()); } - public void switchToClassic() { + public void previewPost() { openActionBarOverflowOrOptionsMenu(ApplicationProvider.getApplicationContext()); - clickOn("Switch to classic editor"); + clickOn(onView(withText(R.string.menu_preview))); } } diff --git a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java index 5c54cfdb5c92..d549f52a3ea0 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.java @@ -1213,25 +1213,15 @@ public boolean onPrepareOptionsMenu(Menu menu) { } } - MenuItem switchToAztecMenuItem = menu.findItem(R.id.menu_switch_to_aztec); MenuItem switchToGutenbergMenuItem = menu.findItem(R.id.menu_switch_to_gutenberg); // The following null checks should basically be redundant but were added to manage // an odd behaviour recorded with Android 8.0.0 // (see https://github.com/wordpress-mobile/WordPress-Android/issues/9748 for more information) - if (switchToAztecMenuItem != null && switchToGutenbergMenuItem != null) { - if (mShowGutenbergEditor) { - // we're showing Gutenberg so, just offer the Aztec switch - switchToAztecMenuItem.setVisible(true); - switchToGutenbergMenuItem.setVisible(false); - } else { - // we're showing Aztec so, hide the "Switch to Aztec" menu - switchToAztecMenuItem.setVisible(false); - - switchToGutenbergMenuItem.setVisible( - shouldSwitchToGutenbergBeVisible(mEditorFragment, mSite) - ); - } + if (switchToGutenbergMenuItem != null) { + boolean switchToGutenbergVisibility = mShowGutenbergEditor ? false + : shouldSwitchToGutenbergBeVisible(mEditorFragment, mSite); + switchToGutenbergMenuItem.setVisible(switchToGutenbergVisibility); } MenuItem contentInfo = menu.findItem(R.id.menu_content_info); @@ -1418,19 +1408,6 @@ public boolean onOptionsItemSelected(final MenuItem item) { } else if (mEditorFragment instanceof GutenbergEditorFragment) { ((GutenbergEditorFragment) mEditorFragment).onToggleHtmlMode(); } - } else if (itemId == R.id.menu_switch_to_aztec) { - // The following boolean check should be always redundant but was added to manage - // an odd behaviour recorded with Android 8.0.0 - // (see https://github.com/wordpress-mobile/WordPress-Android/issues/9748 for more information) - if (mShowGutenbergEditor) { - // let's finish this editing instance and start again, but not letting Gutenberg be used - mRestartEditorOption = RestartEditorOptions.RESTART_SUPPRESS_GUTENBERG; - mPostEditorAnalyticsSession.switchEditor(Editor.CLASSIC); - mPostEditorAnalyticsSession.setOutcome(Outcome.SAVE); - mViewModel.finish(ActivityFinishState.SAVED_LOCALLY); - } else { - logWrongMenuState("Wrong state in menu_switch_to_aztec: menu should not be visible."); - } } else if (itemId == R.id.menu_switch_to_gutenberg) { // The following boolean check should be always redundant but was added to manage // an odd behaviour recorded with Android 8.0.0 diff --git a/WordPress/src/main/res/menu/edit_post.xml b/WordPress/src/main/res/menu/edit_post.xml index 86dbc0950bea..6d0d3e1e11c4 100644 --- a/WordPress/src/main/res/menu/edit_post.xml +++ b/WordPress/src/main/res/menu/edit_post.xml @@ -13,11 +13,6 @@ - - - diff --git a/WordPress/src/main/res/values/strings.xml b/WordPress/src/main/res/values/strings.xml index fd026bbd4ed1..2fb59183df6d 100644 --- a/WordPress/src/main/res/values/strings.xml +++ b/WordPress/src/main/res/values/strings.xml @@ -1613,7 +1613,6 @@ Undo Redo Debug Menu - Switch to classic editor Switch to block editor Content structure