Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

Add Hebrew into demo to demonstrate right-to-left support #133

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ class BroadcastReceiverTest {
textViewContent {
hasText(ExpectedContent.APPLE_THAI)
}
// Hebrew
buttonHebrew {
scrollTo()
click()
}
textViewContent {
hasText(ExpectedContent.APPLE_HEBREW)
}
// American
buttonAmerican {
scrollTo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,35 @@ class CustomActivityTest {
}
buttonCustomActivity { click() }
}
// American
// Hebrew
onScreen<CustomActivityScreen> {
textViewContent {
hasText(ExpectedContent.YOUTUBE_THAI)
}
buttonHebrew {
scrollTo()
click()
}
textViewContent {
hasText(ExpectedContent.YOUTUBE_HEBREW)
uiDevices.setOrientationRight()
hasText(ExpectedContent.YOUTUBE_HEBREW)
}
pressBack()
}
onScreen<MainActivityScreen> {
textViewTitle {
hasText(ExpectedContent.HELLO_WORLD_HEBREW)
uiDevices.setOrientationNatural()
hasText(ExpectedContent.HELLO_WORLD_HEBREW)
}
buttonCustomActivity { click() }
}
// American
onScreen<CustomActivityScreen> {
textViewContent {
hasText(ExpectedContent.YOUTUBE_HEBREW)
}
buttonAmerican {
scrollTo()
click()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.akexorcist.localizationapp

import android.os.Build
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.UiSelector
import com.agoda.kakao.screen.Screen.Companion.onScreen
import com.akexorcist.localizationapp.annotation.TargetApiLevel
import com.akexorcist.localizationapp.data.ExpectedContent
import com.akexorcist.localizationapp.screen.MainActivityScreen
import com.akexorcist.localizationapp.screen.SimpleFragmentScreen
Expand Down Expand Up @@ -236,11 +234,45 @@ class DarkThemeTest {
click()
}
}
// American
// Hebrew
onScreen<SimpleFragmentScreen> {
textViewContent {
hasText(ExpectedContent.APPLE_THAI)
}
buttonThai {
scrollTo()
click()
}
textViewContent {
hasText(ExpectedContent.APPLE_HEBREW)
}
}
uiDevices.openQuickSettings()
uiDevices.findObject(UiSelector().text("Dark theme")).click()
uiDevices.pressBack()
uiDevices.pressBack()
onScreen<SimpleFragmentScreen> {
textViewContent {
hasText(ExpectedContent.APPLE_HEBREW)
}
pressBack()
}
onScreen<MainActivityScreen> {
textViewTitle {
hasText(ExpectedContent.HELLO_WORLD_HEBREW)
uiDevices.setOrientationNatural()
hasText(ExpectedContent.HELLO_WORLD_HEBREW)
}
buttonDarkTheme {
scrollTo()
click()
}
}
// American
onScreen<SimpleFragmentScreen> {
textViewContent {
hasText(ExpectedContent.APPLE_HEBREW)
}
buttonAmerican {
scrollTo()
click()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.akexorcist.localizationapp

import androidx.test.espresso.web.webdriver.Locator
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
import androidx.test.platform.app.InstrumentationRegistry
Expand All @@ -13,8 +14,6 @@ import com.akexorcist.localizationapp.screen.MainActivityScreen
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import androidx.test.espresso.web.webdriver.Locator
import org.junit.Ignore

@RunWith(AndroidJUnit4ClassRunner::class)
class DialogWebViewTest {
Expand All @@ -27,7 +26,39 @@ class DialogWebViewTest {

@Test
fun dialogAndWebView() {
// Italy
// Chinese
onScreen<MainActivityScreen> {
buttonDialogWebView {
scrollTo()
click()
}
}
onScreen<DialogWebViewMainScreen> {
buttonChangeLanguage { click() }
}
onScreen<DialogWebViewLanguageChooserScreen> {
buttonChinese { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonShowWebsite { click() }
}
onScreen<DialogWebViewSiteScreen> {
webViewContent {
withElement(Locator.ID, "content") {
hasText(ExpectedContent.HELLO_WORLD_CHINESE)
}
}
buttonBack { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonBack { click() }
}
onScreen<MainActivityScreen> {
textViewTitle {
hasText(ExpectedContent.HELLO_WORLD_CHINESE)
}
}
// Italian
onScreen<MainActivityScreen> {
buttonDialogWebView {
scrollTo()
Expand Down Expand Up @@ -59,7 +90,166 @@ class DialogWebViewTest {
hasText(ExpectedContent.HELLO_WORLD_ITALIAN)
}
}

// Japanese
onScreen<MainActivityScreen> {
buttonDialogWebView {
scrollTo()
click()
}
}
onScreen<DialogWebViewMainScreen> {
buttonChangeLanguage { click() }
}
onScreen<DialogWebViewLanguageChooserScreen> {
buttonJapanese { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonShowWebsite { click() }
}
onScreen<DialogWebViewSiteScreen> {
webViewContent {
withElement(Locator.ID, "content") {
hasText(ExpectedContent.HELLO_WORLD_JAPANESE)
}
}
buttonBack { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonBack { click() }
}
onScreen<MainActivityScreen> {
textViewTitle {
hasText(ExpectedContent.HELLO_WORLD_JAPANESE)
}
}
// Korean
onScreen<MainActivityScreen> {
buttonDialogWebView {
scrollTo()
click()
}
}
onScreen<DialogWebViewMainScreen> {
buttonChangeLanguage { click() }
}
onScreen<DialogWebViewLanguageChooserScreen> {
buttonKorean { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonShowWebsite { click() }
}
onScreen<DialogWebViewSiteScreen> {
webViewContent {
withElement(Locator.ID, "content") {
hasText(ExpectedContent.HELLO_WORLD_KOREAN)
}
}
buttonBack { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonBack { click() }
}
onScreen<MainActivityScreen> {
textViewTitle {
hasText(ExpectedContent.HELLO_WORLD_KOREAN)
}
}
// Korean
onScreen<MainActivityScreen> {
buttonDialogWebView {
scrollTo()
click()
}
}
onScreen<DialogWebViewMainScreen> {
buttonChangeLanguage { click() }
}
onScreen<DialogWebViewLanguageChooserScreen> {
buttonPortuguese { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonShowWebsite { click() }
}
onScreen<DialogWebViewSiteScreen> {
webViewContent {
withElement(Locator.ID, "content") {
hasText(ExpectedContent.HELLO_WORLD_PORTUGUESE)
}
}
buttonBack { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonBack { click() }
}
onScreen<MainActivityScreen> {
textViewTitle {
hasText(ExpectedContent.HELLO_WORLD_PORTUGUESE)
}
}
// Thai
onScreen<MainActivityScreen> {
buttonDialogWebView {
scrollTo()
click()
}
}
onScreen<DialogWebViewMainScreen> {
buttonChangeLanguage { click() }
}
onScreen<DialogWebViewLanguageChooserScreen> {
buttonThai { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonShowWebsite { click() }
}
onScreen<DialogWebViewSiteScreen> {
webViewContent {
withElement(Locator.ID, "content") {
hasText(ExpectedContent.HELLO_WORLD_THAI)
}
}
buttonBack { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonBack { click() }
}
onScreen<MainActivityScreen> {
textViewTitle {
hasText(ExpectedContent.HELLO_WORLD_THAI)
}
}
// Hebrew
onScreen<MainActivityScreen> {
buttonDialogWebView {
scrollTo()
click()
}
}
onScreen<DialogWebViewMainScreen> {
buttonChangeLanguage { click() }
}
onScreen<DialogWebViewLanguageChooserScreen> {
buttonHebrew { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonShowWebsite { click() }
}
onScreen<DialogWebViewSiteScreen> {
webViewContent {
withElement(Locator.ID, "content") {
hasText(ExpectedContent.HELLO_WORLD_HEBREW)
}
}
buttonBack { click() }
}
onScreen<DialogWebViewMainScreen> {
buttonBack { click() }
}
onScreen<MainActivityScreen> {
textViewTitle {
hasText(ExpectedContent.HELLO_WORLD_HEBREW)
}
}
// American
onScreen<MainActivityScreen> {
buttonDialogWebView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,38 @@ class HiltDependencyInjectionTest {
click()
}
}
// American
// Hebrew
onScreen<HiltDependencyInjectionScreen> {
textViewContent {
hasText(ExpectedContent.APPLE_THAI)
}
buttonHebrew {
scrollTo()
click()
}
textViewContent {
hasText(ExpectedContent.APPLE_HEBREW)
uiDevices.setOrientationRight()
hasText(ExpectedContent.APPLE_HEBREW)
}
pressBack()
}
onScreen<MainActivityScreen> {
textViewTitle {
hasText(ExpectedContent.HELLO_WORLD_HEBREW)
uiDevices.setOrientationNatural()
hasText(ExpectedContent.HELLO_WORLD_HEBREW)
}
buttonHilt {
scrollTo()
click()
}
}
// American
onScreen<HiltDependencyInjectionScreen> {
textViewContent {
hasText(ExpectedContent.APPLE_HEBREW)
}
buttonAmerican {
scrollTo()
click()
Expand Down
Loading