-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Firestore #479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Firestore #479
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a7f9ed3
firestore create user
butterflyforever 849d656
1. Create User in Firstore
butterflyforever 964684b
interaction between runFragment and Forestore
butterflyforever c88db07
adjust timestamp format
butterflyforever 62eb7fe
ListView
butterflyforever db97450
Fix login bug -- adjust postion of check-login function
butterflyforever 92df1df
remove unused code block
butterflyforever 61e98d5
Welcome Page
butterflyforever 303f5ad
adjust the position of logout observer
butterflyforever a06b60e
image button at runFragment
butterflyforever 588851a
fix code review
butterflyforever 0f1f91a
Test
butterflyforever d10f35f
test with mock account info
butterflyforever 3c58154
ViewHolder Pattern in Adapter
butterflyforever File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix code review
- Loading branch information
commit 588851a2f12102903f0f771c7bc5a2de77d2d9cc
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...ical/app/src/androidTest/java/com/google/samples/quickstart/canonical/MapsFragmentTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.google.samples.quickstart.canonical | ||
|
||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.action.ViewActions | ||
import androidx.test.espresso.matcher.ViewMatchers | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.rule.ActivityTestRule | ||
import androidx.test.rule.GrantPermissionRule | ||
import androidx.test.uiautomator.UiDevice | ||
import androidx.test.uiautomator.UiSelector | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
|
||
@RunWith(AndroidJUnit4::class) | ||
class MapsFragmentTest { | ||
|
||
@get:Rule | ||
var activityRule: ActivityTestRule<MainActivity> | ||
= ActivityTestRule(MainActivity::class.java) | ||
|
||
@Rule @JvmField | ||
val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant(android.Manifest.permission.ACCESS_FINE_LOCATION) | ||
|
||
lateinit var device : UiDevice | ||
|
||
@Before | ||
fun setup() { | ||
device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) | ||
// Your google account must have logged in before test. | ||
// Otherwise the main page will be changed to login page, | ||
// and all the test will fail. | ||
// You only need to login the first time you open the app after | ||
// installing it. | ||
} | ||
|
||
|
||
@Test | ||
fun searchDestination() { | ||
onView(ViewMatchers.withId(R.id.bottom_navigation_item_map)) | ||
.perform(ViewActions.click()) | ||
Thread.sleep(3000) | ||
onView(ViewMatchers.withId(R.id.autocomplete_fragment)) | ||
.perform(ViewActions.click()) | ||
val new = device.findObject(UiSelector().text("Search")) | ||
new.text = "Central Park" | ||
Thread.sleep(2000) | ||
device.click(300,800) | ||
Thread.sleep(2000) | ||
} | ||
} |
149 changes: 149 additions & 0 deletions
149
...nical/app/src/androidTest/java/com/google/samples/quickstart/canonical/RunFragmentTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
package com.google.samples.quickstart.canonical | ||
|
||
import androidx.fragment.app.testing.launchFragmentInContainer | ||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.action.ViewActions.click | ||
import androidx.test.espresso.assertion.ViewAssertions.matches | ||
import androidx.test.espresso.matcher.RootMatchers.isDialog | ||
import androidx.test.espresso.matcher.RootMatchers.withDecorView | ||
import androidx.test.espresso.matcher.ViewMatchers.* | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.rule.ActivityTestRule | ||
import org.hamcrest.core.IsNot.not | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
|
||
@RunWith(AndroidJUnit4::class) | ||
class RunFragmentTest { | ||
|
||
@get:Rule | ||
var activityRule: ActivityTestRule<MainActivity> | ||
= ActivityTestRule(MainActivity::class.java) | ||
|
||
@Before | ||
fun makeSureYourAccountHasLoggedIn() { | ||
// Your google account must have logged in before test. | ||
// Otherwise the main page will be changed to login page, | ||
// and all the test will fail. | ||
// You only need to login the first time you open the app after | ||
// installing it. | ||
} | ||
|
||
@Test | ||
fun startClickTest() { | ||
// launchFragmentInContainer<RunFragment>() | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(2000) | ||
onView(withId(R.id.running_chronometer)) | ||
.check(matches(withText("00:02"))) | ||
} | ||
|
||
@Test | ||
fun pauseClickTest() { | ||
// launchFragmentInContainer<RunFragment>() | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(2000) | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(2000) | ||
onView(withId(R.id.running_chronometer)) | ||
.check(matches(withText("00:02"))) | ||
} | ||
|
||
@Test | ||
fun startAndPauseClickTest() { | ||
// launchFragmentInContainer<RunFragment>() | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(2000) | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
onView(withId(R.id.running_chronometer)) | ||
.check(matches(withText("00:03"))) | ||
} | ||
|
||
@Test | ||
fun resetClickWhenWorkingTest() { | ||
// launchFragmentInContainer<RunFragment>() | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(2000) | ||
onView(withId(R.id.reset_btn)) | ||
.perform(click()) | ||
onView(withId(R.id.running_chronometer)) | ||
.check(matches(withText("00:00"))) | ||
} | ||
|
||
@Test | ||
fun resetClickWhenPausingTest() { | ||
// launchFragmentInContainer<RunFragment>() | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(2000) | ||
onView(withId(R.id.running_chronometer)) | ||
.check(matches(withText("00:02"))) | ||
|
||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(2000) | ||
onView(withId(R.id.running_chronometer)) | ||
.check(matches(withText("00:02"))) | ||
|
||
onView(withId(R.id.reset_btn)) | ||
.perform(click()) | ||
onView(withId(R.id.running_chronometer)) | ||
.check(matches(withText("00:00"))) | ||
} | ||
|
||
@Test | ||
fun submitClickWhenWorkingTest() { | ||
// launchFragmentInContainer<RunFragment>() | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(2000) | ||
onView(withId(R.id.running_chronometer)) | ||
.check(matches(withText("00:02"))) | ||
|
||
onView(withId(R.id.submit_btn)) | ||
.perform(click()) | ||
onView(withText("Submission Confirm")) | ||
.inRoot(isDialog()) | ||
.check(matches(isDisplayed())) | ||
} | ||
|
||
@Test | ||
fun submitClickWhenPausingTest() { | ||
// launchFragmentInContainer<RunFragment>() | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(2000) | ||
onView(withId(R.id.start_pause_btn)) | ||
.perform(click()) | ||
Thread.sleep(1000) | ||
|
||
onView(withId(R.id.submit_btn)) | ||
.perform(click()) | ||
onView(withText("Submission Confirm")) | ||
.inRoot(isDialog()) | ||
.check(matches(isDisplayed())) | ||
} | ||
|
||
@Test | ||
fun submitClickBeforeWorkingTest() { | ||
onView(withId(R.id.submit_btn)) | ||
.perform(click()) | ||
onView(withText(R.string.submit_illegal)) | ||
.inRoot(withDecorView(not(activityRule.activity.window.decorView))) | ||
.check(matches(isDisplayed())) | ||
} | ||
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.