Skip to content

Commit 9dbbe8e

Browse files
committed
Merge branch 'trunk' into issue/16202-remove-msd-default-tab-expr
2 parents a2f7cf3 + 12aa9fa commit 9dbbe8e

31 files changed

Lines changed: 628 additions & 388 deletions

WordPress/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ dependencies {
397397
implementation "androidx.compose.ui:ui:$composeVersion"
398398
implementation "androidx.compose.foundation:foundation:$composeVersion"
399399
implementation "androidx.compose.material:material:$composeVersion"
400+
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycleVersion"
401+
implementation "androidx.compose.ui:ui-tooling-preview:$composeVersion"
402+
debugImplementation "androidx.compose.ui:ui-tooling:$composeVersion"
400403

401404
testImplementation "junit:junit:$jUnitVersion"
402405

WordPress/src/androidTest/java/org/wordpress/android/e2e/BlockEditorTests.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public void setUp() {
2626
wpLogin();
2727
}
2828

29-
String mTitle = "Hello Espresso!";
3029
String mPostText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
3130
String mCategory = "Wedding";
3231
String mTag = "Tag " + Instant.now().toEpochMilli();
@@ -41,27 +40,31 @@ public void setUp() {
4140

4241
@Test
4342
public void publishSimplePost() {
43+
String title = "publishSimplePost";
44+
4445
new MySitesPage()
4546
.go()
4647
.startNewPost();
4748

4849
new BlockEditorPage()
4950
.waitForTitleDisplayed()
50-
.enterTitle(mTitle)
51+
.enterTitle(title)
5152
.enterParagraphText(mPostText)
5253
.publish()
5354
.verifyPostPublished();
5455
}
5556

5657
@Test
5758
public void publishFullPost() {
59+
String title = "publishFullPost";
60+
5861
new MySitesPage()
5962
.go()
6063
.startNewPost();
6164

6265
new BlockEditorPage()
6366
.waitForTitleDisplayed()
64-
.enterTitle(mTitle)
67+
.enterTitle(title)
6568
.enterParagraphText(mPostText)
6669
.addImage()
6770
.addPostSettings(mCategory, mTag)
@@ -73,13 +76,15 @@ public void publishFullPost() {
7376

7477
@Test
7578
public void blockEditorCanDisplayElementAddedInHtmlMode() {
79+
String title = "blockEditorCanDisplayElementAddedInHtmlMode";
80+
7681
new MySitesPage()
7782
.go()
7883
.startNewPost();
7984

8085
new BlockEditorPage()
8186
.waitForTitleDisplayed()
82-
.enterTitle(mTitle)
87+
.enterTitle(title)
8388
.switchToHtmlMode()
8489
.enterParagraphText(mHtmlPost)
8590
.switchToVisualMode()

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ public BlockEditorPage waitForTitleDisplayed() {
4242
}
4343

4444
public BlockEditorPage enterTitle(String postTitle) {
45+
clickOn(titleField);
4546
titleField.perform(typeText(postTitle), ViewActions.closeSoftKeyboard());
4647
return this;
4748
}
4849

4950
public BlockEditorPage enterParagraphText(String paragraphText) {
50-
onView(withHint(R.string.gutenberg_native_start_writing))
51-
.perform(typeText(paragraphText), ViewActions.closeSoftKeyboard());
51+
ViewInteraction startWritingPrompt = onView(withHint(R.string.gutenberg_native_start_writing));
52+
clickOn(startWritingPrompt);
53+
populateTextField(startWritingPrompt, paragraphText);
5254
return this;
5355
}
5456

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import androidx.annotation.StringRes;
99
import androidx.appcompat.widget.SwitchCompat;
1010
import androidx.appcompat.widget.Toolbar;
11+
import androidx.test.core.app.ApplicationProvider;
1112
import androidx.test.espresso.UiController;
1213
import androidx.test.espresso.ViewAction;
1314
import androidx.test.espresso.ViewInteraction;
@@ -20,6 +21,7 @@
2021

2122
import static androidx.test.espresso.Espresso.onData;
2223
import static androidx.test.espresso.Espresso.onView;
24+
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
2325
import static androidx.test.espresso.action.ViewActions.click;
2426
import static androidx.test.espresso.assertion.ViewAssertions.matches;
2527
import static androidx.test.espresso.contrib.RecyclerViewActions.actionOnItem;
@@ -81,7 +83,14 @@ public void startNewPost() {
8183

8284
public void startNewSite() {
8385
switchSite();
84-
clickOn(R.id.menu_add);
86+
// If the device has a narrower display, the menu_add is hidden in the overflow
87+
if (isElementDisplayed(R.id.menu_add)) {
88+
clickOn(R.id.menu_add);
89+
} else {
90+
// open the overflow and then click on the item with text
91+
openActionBarOverflowOrOptionsMenu(ApplicationProvider.getApplicationContext());
92+
onView(withText(getTranslatedString(R.string.site_picker_add_site))).perform(click());
93+
}
8594
}
8695

8796
public void goToSettings() {

WordPress/src/androidTest/java/org/wordpress/android/ui/screenshots/JPScreenshotTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.google.android.libraries.cloudtesting.screenshots.ScreenShotter;
1212

1313
import org.junit.ClassRule;
14+
import org.junit.Ignore;
1415
import org.junit.Test;
1516
import org.wordpress.android.BuildConfig;
1617
import org.wordpress.android.R;
@@ -95,6 +96,7 @@ public static String buildScreenshotName(Screenshots screen) {
9596
}
9697
}
9798

99+
@Ignore("Ignored until there's a way to exclude tests on FTL properly, via `--test-targets` option.")
98100
@Test
99101
public void jPScreenshotTest() {
100102
if (BuildConfig.IS_JETPACK_APP) {
@@ -199,8 +201,6 @@ private void generateSiteTopic() {
199201
clickOn(R.id.nav_sites);
200202
(new MySitesPage()).startNewSite();
201203

202-
waitForElementToBeDisplayedWithoutFailure(R.id.recycler_view);
203-
204204
// Wait for page to load
205205
idleFor(2000);
206206

WordPress/src/androidTest/java/org/wordpress/android/ui/screenshots/WPScreenshotTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class WPScreenshotTest extends BaseTest {
5050

5151
private DemoModeEnabler mDemoModeEnabler = new DemoModeEnabler();
5252

53-
@Ignore
53+
@Ignore("Ignored until there's a way to exclude tests on FTL properly, via `--test-targets` option.")
5454
@Test
5555
public void wPScreenshotTest() {
5656
if (!BuildConfig.IS_JETPACK_APP) {

WordPress/src/main/java/org/wordpress/android/ui/compose/Color.kt

Lines changed: 0 additions & 13 deletions
This file was deleted.

WordPress/src/main/java/org/wordpress/android/ui/compose/WordPressTheme.kt

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.wordpress.android.ui.compose.components
2+
3+
import androidx.compose.foundation.ScrollState
4+
import androidx.compose.foundation.layout.Box
5+
import androidx.compose.foundation.layout.BoxScope
6+
import androidx.compose.foundation.rememberScrollState
7+
import androidx.compose.foundation.verticalScroll
8+
import androidx.compose.runtime.Composable
9+
import androidx.compose.ui.Alignment
10+
import androidx.compose.ui.Modifier
11+
12+
/**
13+
* Box UI component with vertical scroll.
14+
*/
15+
@Composable
16+
fun VerticalScrollBox(
17+
modifier: Modifier = Modifier,
18+
scrollState: ScrollState = rememberScrollState(),
19+
alignment: Alignment = Alignment.TopStart,
20+
content: @Composable BoxScope.() -> Unit
21+
) {
22+
Box(
23+
modifier = modifier.then(Modifier.verticalScroll(scrollState)),
24+
contentAlignment = alignment,
25+
content = content
26+
)
27+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.wordpress.android.ui.compose.theme
2+
3+
import androidx.compose.foundation.isSystemInDarkTheme
4+
import androidx.compose.material.MaterialTheme
5+
import androidx.compose.runtime.Composable
6+
import org.wordpress.android.BuildConfig
7+
8+
/**
9+
* Project's base theme.
10+
*/
11+
@Composable
12+
fun AppTheme(
13+
isDarkTheme: Boolean = isSystemInDarkTheme(),
14+
content: @Composable () -> Unit
15+
) {
16+
val colorPalette = when (BuildConfig.IS_JETPACK_APP) {
17+
true -> JpColorPalette(isDarkTheme)
18+
else -> WpColorPalette(isDarkTheme)
19+
}
20+
21+
MaterialTheme(
22+
colors = colorPalette,
23+
content = content
24+
)
25+
}

0 commit comments

Comments
 (0)