This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Issue:116, Issue:173 Verify the nav toolbar buttons[UI Tests] #10822
Closed
TejaswiKarasani
wants to merge
15
commits into
mozilla-mobile:master
from
TejaswiKarasani:navigation_toolbar_button
Closed
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
ed91ab7
Issue:116, Issue:173 Verify the nav toolbar buttons
TejaswiKarasani b63f707
Used a transition OpenHomeScreen
TejaswiKarasani a8b55a2
Changed the logic part to verify page content to check the specific URL
TejaswiKarasani 13d03df
Used browserScreen for conveying the test about the location
TejaswiKarasani 42c8794
Trying out with VerifyPageContent
TejaswiKarasani 3bff7d0
Removed VerifyNavURL
TejaswiKarasani 70f2b66
Commented out the verifyContent and added NavURL back
TejaswiKarasani d0e222b
Commented out verifyNavURLBar()
TejaswiKarasani 73b002a
Added a long time duration
TejaswiKarasani 0820e9e
local changes
TejaswiKarasani 0390a60
updating master to get it sync
TejaswiKarasani 2728c70
commented out both of the verifyNavURL and verifyPageContent()
TejaswiKarasani 8400c2b
commented out verifyXButtonActions() and TestAssetHelper.waitingTime
TejaswiKarasani ca918d1
ucommented verifyPageContent()
TejaswiKarasani 247c2d5
fixed ktlint issue
TejaswiKarasani 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
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt
This file contains 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,74 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
package org.mozilla.fenix.ui | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.uiautomator.UiDevice | ||
import okhttp3.mockwebserver.MockWebServer | ||
import org.junit.After | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher | ||
import org.mozilla.fenix.helpers.HomeActivityTestRule | ||
import org.mozilla.fenix.helpers.TestAssetHelper | ||
import org.mozilla.fenix.ui.robots.homeScreen | ||
import org.mozilla.fenix.ui.robots.navigationToolbar | ||
|
||
class SmokeTest { | ||
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) | ||
private lateinit var mockWebServer: MockWebServer | ||
|
||
@get:Rule | ||
val activityTestRule = HomeActivityTestRule() | ||
|
||
@Before | ||
fun setUp() { | ||
mockWebServer = MockWebServer().apply { | ||
setDispatcher(AndroidAssetDispatcher()) | ||
start() | ||
} | ||
} | ||
|
||
@After | ||
fun tearDown() { | ||
mockWebServer.shutdown() | ||
} | ||
|
||
@Test | ||
fun verifyTheNavToolBarButtonsTest() { | ||
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) | ||
val defaultWebPageTitle = "Test_Page_1" | ||
|
||
// Visit a URL, wait until it's loaded | ||
homeScreen { | ||
navigationToolbar { | ||
}.enterURLAndEnterToBrowser(defaultWebPage.url) { | ||
verifyPageContent(defaultWebPage.content) | ||
|
||
// Verify the items of Nav URL Bar | ||
verifyNavURLBarItems() | ||
|
||
// Verify 'x' button actions | ||
// verifyXButtonActions() | ||
// TestAssetHelper.waitingTime | ||
|
||
// Verify various items after returning back to the initial WebPage | ||
// verifyNavURLBar() | ||
verifyPageContent(defaultWebPage.content) | ||
}.openHomeScreen { | ||
|
||
// Verify items on HomeScreen | ||
verifyHomeScreen() | ||
verifyExistingTabList() | ||
|
||
// Go to the same page again and check for main menu | ||
}.openTab(defaultWebPageTitle) { | ||
clickMenuButton() | ||
verifyMainMenu() | ||
} | ||
} | ||
} | ||
} |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TejaswiKarasani I think the error you are seeing comes from this line...can you try to wait longer just to check that? if it still fails, try commenting out this line...thinking about more options here in the meantime...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other option may be to check the content in the url bar...and see if that works...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I saw in UI Automator, I couldn't find any specific id for the content in the url bar, I just found the whole url under one id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is text (although I'm not sure you can say starts with...the port number will change each time)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I thought it was the whole red highlight box and didn't struck my mind that it is for text inside the red box and by the way there is some particular function for testhelper.longWaitingTime or testhelper.longWaitingTime...and set time for minutes and seconds? or should I create a separate function for the long waiting time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you may be able to use one off those
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah cool.!