Fixes #1169: Add a test for the no internet connection page #1644
Conversation
@farhanpatel does Firefox iOS have any UI tests that check how the app handles connectivity issues? I'm not sure that such a test would be helpful since it requires manually turning off connectivity on the physical device (and thus would never be run on BuddyBuild) based on the info in this PR. How has Firefox iOS handled it or do you have advice for how we could handle it here? |
Hey @oliviabrown9 , So sorry I saw this late. We don't have any tests that I know of that test no network connectivity. We have tests to test things like FxA being down or Pocket not returning trending stories. But these are usually done by stubbing the API. Blocking all internet traffic to simulate offline isn't something we've tried. I wonder if you could use NSAppTransportSecurity in the info.plist to do this. You might need a different scheme just for these offline tests. |
I like more tests and this specific case is an area we don't cover well. Let's investigate if we can run this in a way with the network disabled or maybe with a mocked API. |
@isabelrios what do you think of this one? not sure if we should keep it around or close it. |
Oh sorry I missed this comment and it is been more than two weeks, I will take a look soon |
I have rebased latest main and checked this test. It looks like it is passing in all scenarios, don't think it is working as it is now. @vldmrkl I know it is been a while, not sure whether you will be interested in contributing still. I think this is a nice test to have but it will need some work. |
} | ||
|
||
func testConnectivity() { | ||
if !ReachabilityTest.isConnectedToNetwork() { |
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.
This if statement is never reached. The connection is always on and so the test always pass, in order to make this test checking when the device is offline we would need to force that status on the device for it and so be able to check what happens.
Let's close for now and re-open if needed/requested in the future |
This PR contains a fix for #1164.
I added a XCUI test for this page. I learned that there is no way to turn off network on iOS Simulator programatically, so in order to use this test, you should turn off network on your computer, where you run the project.
Also, I added a check for the internet connectity. If there is no internet connectivity – test runs. In order to implement it, I referenced this article.
CC: @oliviabrown9