Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

UI Sync Int Tests fix TPS preference #8489

Merged
merged 1 commit into from
Feb 27, 2020

Conversation

isabelrios
Copy link
Contributor

Sync integration tests were failing due to Bug 1610758 This PR fixes that

Pull Request checklist

  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features. In addition, it includes a screenshot of a successful accessibility scan to ensure no new defects are added to the product.

After merge

  • Milestone: Make sure issues finished by this pull request are added to the milestone of the version currently in development.

To download an APK when reviewing a PR:

  1. click on Show All Checks,
  2. click Details next to "Taskcluster (pull_request)" after it appears and then finishes with a green checkmark,
  3. click on the "Fenix - assemble" task, then click "Run Artifacts".
  4. the APK links should be on the left side of the screen, named for each CPU architecture

@codecov-io
Copy link

codecov-io commented Feb 18, 2020

Codecov Report

Merging #8489 into master will increase coverage by 0.03%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #8489      +/-   ##
============================================
+ Coverage     19.02%   19.06%   +0.03%     
  Complexity      490      490              
============================================
  Files           320      320              
  Lines         12843    12838       -5     
  Branches       1688     1688              
============================================
+ Hits           2443     2447       +4     
+ Misses        10196    10187       -9     
  Partials        204      204
Impacted Files Coverage Δ Complexity Δ
...g/mozilla/fenix/addons/AddonsManagementFragment.kt 0% <0%> (ø) 0% <0%> (ø) ⬇️
...illa/fenix/addons/InstalledAddonDetailsFragment.kt 0% <0%> (ø) 0% <0%> (ø) ⬇️
...rc/main/java/org/mozilla/fenix/FenixApplication.kt 13.44% <0%> (+0.22%) 3% <0%> (ø) ⬇️
...mponents/searchengine/FenixSearchEngineProvider.kt 56.52% <0%> (+4.34%) 10% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 499f38c...fa6998e. Read the comment docs.

@isabelrios isabelrios force-pushed the ui-sync-int-tests-fix-TPS branch 2 times, most recently from 1009537 to 20e3da8 Compare February 24, 2020 16:41
@isabelrios isabelrios changed the title (WIP) UI Sync Int Tests fix TPS preference UI Sync Int Tests fix TPS preference Feb 24, 2020
@isabelrios isabelrios marked this pull request as ready for review February 24, 2020 18:57
@isabelrios
Copy link
Contributor Author

This PR fixes the TPS issue so that we can use it with the new prefs. Also, it adds a condition to run tests only on master as a start. I'm enabling only two tests at the moment to see how they work on the sim on the laptop in MTV. Then, there will be a follow up PR adjusting the timing issues and enabling the rest of tests.

There was a change in fxawebchannel extension and stage sever stop working there, there is a patch to workaround that done by @csadilek (big thanks!!)

@@ -207,8 +209,7 @@ class SyncIntegrationTest {
}

fun historyAfterSyncIsShown() {
val historyEntry = mDevice.findObject(By.text("http://www.example.com/"))
historyEntry.isEnabled()
mDevice.waitNotNull(Until.findObjects(By.text("http://www.example.com/")), TestAssetHelper.waitingTime)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was wondering if we could use a static asset instead here, but I assume http://www.example.com is an URL used by TPS (and we can't change it), true?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to investigate that, on iOS using a static asset did not work because the history was not properly recorded on the iOS device. Also, in this case we are checking on Fenix that the history created on Desktop is shown, so it is kind of static from Fenix side.

I will investigate if creating the history using a static asset on Fenix works, but if possible let's keep that for the follow up PR too

def test_sync_bookmark_from_desktop(tps, gradlewbuild):
os.chdir('app/src/androidTest/java/org/mozilla/fenix/syncintegration/')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this relative path gets repeated over and over. Not sure if it's possible to create a fixture for it instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that would be doable. Let me improve that in a follow up since now I would prefer check that these tests work on the MTV laptop 🙏

import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ui.robots.appContext

class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the purpose of this class? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the class that allows us to workaround the issue with fxawebchannel extension not working for stage. Otherwise we can not sync using stage server

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a comment to this class as it's not obvious, something like:

/**
 * Overrides the application's request interceptor to deactivate the FxA web channel 
 * which is not supported on the staging servers.
 */

@isabelrios
Copy link
Contributor Author

@csadilek sorry for pinging you again, I know you are busy, but just in case this got out of you radar. Just to double check that is safe to land your patch as it is as part of this PR. Thanks again!

Copy link
Contributor

@csadilek csadilek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add one comment (see below), and squash the commits before landing, but yes this is safe to land. It has no impact on app code, just makes FxA work in android tests.

import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ui.robots.appContext

class AppRequestInterceptor(private val context: Context) : RequestInterceptor {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a comment to this class as it's not obvious, something like:

/**
 * Overrides the application's request interceptor to deactivate the FxA web channel 
 * which is not supported on the staging servers.
 */

Sync Int Tests fix TPS preference

add webext navigation

enable only two tests

add comment as per reviewer suggestion
@AaronMT AaronMT merged commit b432f5c into mozilla-mobile:master Feb 27, 2020
@liuche liuche mentioned this pull request Mar 12, 2020
32 tasks
@liuche liuche mentioned this pull request Mar 24, 2020
32 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants