mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-05 09:13:55 +01:00
Issue-5662-kotlinstyle (#5833)
* *.kt: bulk correction of formatting using ktlint --format * *.kt: replace wildcard imports and second stage auto format ktlint --format * QuizQuestionTest.kt: modified property names to camel case to meet ktlint standard * LevelControllerTest.kt: modified property names to camel case to meet ktlint standard * QuizActivityUnitTest.kt: modified property names to camel case to meet ktlint standard * MediaDetailFragmentUnitTests.kt: modified property names to camel case to meet ktlint standard * UploadWorker.kt: modified property names to camel case to meet ktlint standard * UploadClient.kt: modified property names to camel case to meet ktlint standard * BasePagingPresenter.kt: modified property names to camel case to meet ktlint standard * DescriptionEditActivity.kt: modified property names to camel case to meet ktlint standard * OnSwipeTouchListener.kt: modified property names to camel case to meet ktlint standard * MediaDetailFragmentUnitTests.kt: corrected excessive line length to meet ktlint standard * DepictedItem.kt: corrected property name format and catch format to for ktlint standard * UploadCategoryAdapter.kt: corrected class definition format to meet ktlint standard * CustomSelectorActivity.kt: reformatted function names to first letter lowercase to meet ktlint standard * MediaDetailFragmentUnitTests.kt: fix string literal indentation to meet ktlint standard * NotForUploadDao.kt: file renamed to match class name, new file NotForUploadStatusDao.kt * UploadedDao.kt: file renamed to match class name, new file UploadedStatusDao.kt * Urls.kt: fixed excessive line length for ktLint standard * Snak_partial.kt & Statement_partial.kt: refactored to remove underscores in class names to meet ktLint standard * *.kt: fixed consecutive KDOC error for ktLint * PageableBaseDataSourceTest.kt & UploadPresenterTest.kt: fixed excessive line lengths to meet ktLint standard * CheckboxTriStatesTest.kt: renamed file to match class name to meet ktLint standard * .kt: resolved backing-property-naming error in ktLint, made matching properties public, matched names and refactored * TestConnectionFactory.kt: fixed property naming to adhere to ktLint standard
This commit is contained in:
parent
950539c55c
commit
2d82a430c4
405 changed files with 11032 additions and 9137 deletions
|
|
@ -21,20 +21,23 @@ import fr.free.nrw.commons.kvstore.JsonKvStore
|
|||
import fr.free.nrw.commons.notification.NotificationActivity
|
||||
import org.hamcrest.CoreMatchers
|
||||
import org.hamcrest.Matchers
|
||||
import org.junit.*
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class MainActivityTest {
|
||||
|
||||
@get:Rule
|
||||
var activityRule: ActivityTestRule<*> = ActivityTestRule(LoginActivity::class.java)
|
||||
|
||||
@get:Rule
|
||||
var mGrantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
|
||||
"android.permission.ACCESS_FINE_LOCATION"
|
||||
)
|
||||
var mGrantPermissionRule: GrantPermissionRule =
|
||||
GrantPermissionRule.grant(
|
||||
"android.permission.ACCESS_FINE_LOCATION",
|
||||
)
|
||||
|
||||
private val device: UiDevice =
|
||||
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
|
||||
|
|
@ -48,7 +51,8 @@ class MainActivityTest {
|
|||
UITestHelper.loginUser()
|
||||
UITestHelper.skipWelcome()
|
||||
Intents.init()
|
||||
Intents.intending(CoreMatchers.not(IntentMatchers.isInternal()))
|
||||
Intents
|
||||
.intending(CoreMatchers.not(IntentMatchers.isInternal()))
|
||||
.respondWith(Instrumentation.ActivityResult(Activity.RESULT_OK, null))
|
||||
val context = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
val storeName = context.packageName + "_preferences"
|
||||
|
|
@ -62,137 +66,149 @@ class MainActivityTest {
|
|||
|
||||
@Test
|
||||
fun testNearby() {
|
||||
Espresso.onView(
|
||||
Matchers.allOf(
|
||||
childAtPosition(
|
||||
Espresso
|
||||
.onView(
|
||||
Matchers.allOf(
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.fragment_main_nav_tab_layout),
|
||||
0
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.fragment_main_nav_tab_layout),
|
||||
0,
|
||||
),
|
||||
1,
|
||||
),
|
||||
1
|
||||
ViewMatchers.isDisplayed(),
|
||||
),
|
||||
ViewMatchers.isDisplayed()
|
||||
)
|
||||
).perform(ViewActions.click())
|
||||
Espresso.onView(ViewMatchers.withId(R.id.fragmentContainer))
|
||||
).perform(ViewActions.click())
|
||||
Espresso
|
||||
.onView(ViewMatchers.withId(R.id.fragmentContainer))
|
||||
.check(matches(ViewMatchers.isDisplayed()))
|
||||
UITestHelper.sleep(10000)
|
||||
val actionMenuItemView2 = Espresso.onView(
|
||||
Matchers.allOf(
|
||||
ViewMatchers.withId(R.id.list_sheet), ViewMatchers.withContentDescription("List"),
|
||||
childAtPosition(
|
||||
val actionMenuItemView2 =
|
||||
Espresso.onView(
|
||||
Matchers.allOf(
|
||||
ViewMatchers.withId(R.id.list_sheet),
|
||||
ViewMatchers.withContentDescription("List"),
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.toolbar),
|
||||
1
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.toolbar),
|
||||
1,
|
||||
),
|
||||
0,
|
||||
),
|
||||
0
|
||||
ViewMatchers.isDisplayed(),
|
||||
),
|
||||
ViewMatchers.isDisplayed()
|
||||
)
|
||||
)
|
||||
actionMenuItemView2.perform(ViewActions.click())
|
||||
UITestHelper.sleep(1000)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testExplore() {
|
||||
Espresso.onView(
|
||||
Matchers.allOf(
|
||||
childAtPosition(
|
||||
Espresso
|
||||
.onView(
|
||||
Matchers.allOf(
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.fragment_main_nav_tab_layout),
|
||||
0
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.fragment_main_nav_tab_layout),
|
||||
0,
|
||||
),
|
||||
2,
|
||||
),
|
||||
2
|
||||
ViewMatchers.isDisplayed(),
|
||||
),
|
||||
ViewMatchers.isDisplayed()
|
||||
)
|
||||
).perform(ViewActions.click())
|
||||
Espresso.onView(ViewMatchers.withId(R.id.fragmentContainer))
|
||||
).perform(ViewActions.click())
|
||||
Espresso
|
||||
.onView(ViewMatchers.withId(R.id.fragmentContainer))
|
||||
.check(matches(ViewMatchers.isDisplayed()))
|
||||
UITestHelper.sleep(1000)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testContributions() {
|
||||
Espresso.onView(
|
||||
Matchers.allOf(
|
||||
childAtPosition(
|
||||
Espresso
|
||||
.onView(
|
||||
Matchers.allOf(
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.fragment_main_nav_tab_layout),
|
||||
0
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.fragment_main_nav_tab_layout),
|
||||
0,
|
||||
),
|
||||
0,
|
||||
),
|
||||
0
|
||||
ViewMatchers.isDisplayed(),
|
||||
),
|
||||
ViewMatchers.isDisplayed()
|
||||
)
|
||||
).perform(ViewActions.click())
|
||||
Espresso.onView(ViewMatchers.withId(R.id.fragmentContainer))
|
||||
).perform(ViewActions.click())
|
||||
Espresso
|
||||
.onView(ViewMatchers.withId(R.id.fragmentContainer))
|
||||
.check(matches(ViewMatchers.isDisplayed()))
|
||||
Espresso.onView(
|
||||
Matchers.allOf(
|
||||
ViewMatchers.withId(R.id.contributionImage),
|
||||
childAtPosition(
|
||||
Espresso
|
||||
.onView(
|
||||
Matchers.allOf(
|
||||
ViewMatchers.withId(R.id.contributionImage),
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.contributionsList),
|
||||
0
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.contributionsList),
|
||||
0,
|
||||
),
|
||||
1,
|
||||
),
|
||||
1
|
||||
ViewMatchers.isDisplayed(),
|
||||
),
|
||||
ViewMatchers.isDisplayed()
|
||||
)
|
||||
).perform(ViewActions.click())
|
||||
val actionMenuItemView = Espresso.onView(
|
||||
Matchers.allOf(
|
||||
ViewMatchers.withId(R.id.menu_bookmark_current_image),
|
||||
childAtPosition(
|
||||
).perform(ViewActions.click())
|
||||
val actionMenuItemView =
|
||||
Espresso.onView(
|
||||
Matchers.allOf(
|
||||
ViewMatchers.withId(R.id.menu_bookmark_current_image),
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.toolbar),
|
||||
1
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.toolbar),
|
||||
1,
|
||||
),
|
||||
0,
|
||||
),
|
||||
0
|
||||
ViewMatchers.isDisplayed(),
|
||||
),
|
||||
ViewMatchers.isDisplayed()
|
||||
)
|
||||
)
|
||||
actionMenuItemView.perform(ViewActions.click())
|
||||
UITestHelper.sleep(3000)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testBookmarks() {
|
||||
Espresso.onView(
|
||||
Matchers.allOf(
|
||||
childAtPosition(
|
||||
Espresso
|
||||
.onView(
|
||||
Matchers.allOf(
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.fragment_main_nav_tab_layout),
|
||||
0
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.fragment_main_nav_tab_layout),
|
||||
0,
|
||||
),
|
||||
3,
|
||||
),
|
||||
3
|
||||
ViewMatchers.isDisplayed(),
|
||||
),
|
||||
ViewMatchers.isDisplayed()
|
||||
)
|
||||
).perform(ViewActions.click())
|
||||
).perform(ViewActions.click())
|
||||
UITestHelper.sleep(1000)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testNotifications() {
|
||||
Espresso.onView(
|
||||
Matchers.allOf(
|
||||
ViewMatchers.withId(R.id.notifications),
|
||||
childAtPosition(
|
||||
Espresso
|
||||
.onView(
|
||||
Matchers.allOf(
|
||||
ViewMatchers.withId(R.id.notifications),
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.toolbar),
|
||||
1
|
||||
childAtPosition(
|
||||
ViewMatchers.withId(R.id.toolbar),
|
||||
1,
|
||||
),
|
||||
1,
|
||||
),
|
||||
1
|
||||
ViewMatchers.isDisplayed(),
|
||||
),
|
||||
ViewMatchers.isDisplayed()
|
||||
)
|
||||
).perform(ViewActions.click())
|
||||
).perform(ViewActions.click())
|
||||
Intents.intended(IntentMatchers.hasComponent(NotificationActivity::class.java.name))
|
||||
Espresso.pressBack()
|
||||
UITestHelper.sleep(1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue