Closed edgarfroes closed 1 year ago
@dmitry-zaitsev is this problem getting tackled on 1.19.3
or 1.19.4
?
I also faced this whenever studio are running. Killing studio and then running test would be fine.
``` java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:9080 at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:297) at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207) at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) at xcuitest.XCTestDriverClient.runningAppId(XCTestDriverClient.kt:55) at ios.xctest.XCTestIOSDevice.activeAppId(XCTestIOSDevice.kt:191) at ios.xctest.XCTestIOSDevice.contentDescriptor(XCTestIOSDevice.kt:48) at ios.LocalIOSDevice.contentDescriptor(LocalIOSDevice.kt:32) at maestro.drivers.IOSDriver.contentDescriptor(IOSDriver.kt:175) at maestro.Maestro$findElementWithTimeout$1.invoke(Maestro.kt:344) at maestro.Maestro$findElementWithTimeout$1.invoke(Maestro.kt:343) at maestro.utils.MaestroTimer.withTimeout(MaestroTimer.kt:16) at maestro.Maestro.findElementWithTimeout(Maestro.kt:343) at maestro.orchestra.Orchestra.findElement(Orchestra.kt:646) at maestro.orchestra.Orchestra.evaluateCondition(Orchestra.kt:374) at maestro.orchestra.Orchestra.assertConditionCommand(Orchestra.kt:204) at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:174) at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:137) at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:91) at maestro.cli.runner.MaestroCommandRunner.runCommands(MaestroCommandRunner.kt:120) at maestro.cli.runner.TestRunner$runContinuous$watchFiles$1$2$1.invoke(TestRunner.kt:88) at maestro.cli.runner.TestRunner$runContinuous$watchFiles$1$2$1.invoke(TestRunner.kt:87) at maestro.cli.runner.TestRunner.runCatching(TestRunner.kt:123) at maestro.cli.runner.TestRunner.access$runCatching(TestRunner.kt:23) at maestro.cli.runner.TestRunner$runContinuous$watchFiles$1$2.invoke(TestRunner.kt:87) at maestro.cli.runner.TestRunner$runContinuous$watchFiles$1$2.invoke(TestRunner.kt:75) at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30) Suppressed: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:9080 ... 39 more Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.base/java.net.Socket.connect(Socket.java:615) at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295) ... 38 more Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.base/java.net.Socket.connect(Socket.java:615) at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295) ... 38 more ```
@idrakimuhamad the problem is that my CI is failing 100% of times due to the same error.
Below's the log the the error that's happening in the CI (Codemagic):
``` bash java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:9080 at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:297) at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207) at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) at xcuitest.XCTestDriverClient.runningAppId(XCTestDriverClient.kt:55) at ios.xctest.XCTestIOSDevice.activeAppId(XCTestIOSDevice.kt:191) at ios.xctest.XCTestIOSDevice.contentDescriptor(XCTestIOSDevice.kt:48) at ios.LocalIOSDevice.contentDescriptor(LocalIOSDevice.kt:32) at maestro.drivers.IOSDriver.contentDescriptor(IOSDriver.kt:175) at maestro.Maestro$findElementWithTimeout$1.invoke(Maestro.kt:344) at maestro.Maestro$findElementWithTimeout$1.invoke(Maestro.kt:343) at maestro.utils.MaestroTimer.withTimeout(MaestroTimer.kt:16) at maestro.Maestro.findElementWithTimeout(Maestro.kt:343) at maestro.orchestra.Orchestra.findElement(Orchestra.kt:646) at maestro.orchestra.Orchestra.findElement$default(Orchestra.kt:628) at maestro.orchestra.Orchestra.tapOnElement(Orchestra.kt:558) at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:159) at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:443) at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:358) at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:185) at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:443) at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:358) at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:185) at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:137) at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:91) at maestro.orchestra.Orchestra.runFlow$default(Orchestra.kt:72) at maestro.cli.runner.TestSuiteInteractor.runFlow(TestSuiteInteractor.kt:136) at maestro.cli.runner.TestSuiteInteractor.runTestSuite(TestSuiteInteractor.kt:67) at maestro.cli.runner.TestSuiteInteractor.runTestSuite(TestSuiteInteractor.kt:45) at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:118) at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:100) at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:91) at maestro.cli.command.TestCommand.call(TestCommand.kt:100) at maestro.cli.command.TestCommand.call(TestCommand.kt:39) at picocli.CommandLine.executeUserObject(CommandLine.java:1933) at picocli.CommandLine.access$1200(CommandLine.java:145) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332) at picocli.CommandLine$RunLast.handle(CommandLine.java:2326) at picocli.CommandLine$RunLast.handle(CommandLine.java:2291) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159) at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22) at picocli.CommandLine.execute(CommandLine.java:2058) at maestro.cli.AppKt.main(App.kt:122) Suppressed: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:9080 ... 55 more Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.base/java.net.Socket.connect(Socket.java:615) at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295) ... 54 more Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.base/java.net.Socket.connect(Socket.java:615) at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295) ... 54 more ```
Below's the log the the error that's happening in the CI (Codemagic):
Hey @edgarfroes , Are you running maestro test command directly on CI?
@idrakimuhamad Can you see if you are able to reproduce this in the latest version? If yes can you describe the steps will try to repro on my end
@amanjeetsingh150 I'm blocked because of https://github.com/mobile-dev-inc/maestro/issues/646, can't run any tests anymore.
@amanjeetsingh150 Is there anything I can do to speed this up? The tests were working just fine on CI on maestro 1.16.4, but they started to fail all of a sudden about 3 days ago without changes to workflows or environment versioning.
@amanjeetsingh150 I downgraded to 1.16.4
and it's working for now. It had a bug where env variables didn't support apostrophes (which is now fixed on 1.17.x
), so the downgraded version will work for now, but it's still failing on the CI with 1.17.5
so the issue is still valid.
Hey @edgarfroes, are you using the maestro cloud or integrated maestro differently on your CI?
@amanjeetsingh150 custom CI hosted on Codemagic.
i faced the same issue locally when i had the Meastro studio open and trying to run a flow on simulator , after refreshing terminal the issue resolved but probabely there is a bug underneath
I can confirm this is happening in 1.21.0 too
Update
This issue doesn't happen if I already have a studio running, and then run a test. It only happen when I'm already running a test in continuous mode, and then running the studio.
On version 1.5, I've ran a test in continuous mode, and then ran studio. The app says some error happened and ask to refresh. In the terminal the below error were thrown.
After refreshing the web app, the studio working fine.
In latest version (1.21) however, doing the same throwing the same error, but it keeps repeating infinitely and the web app never loaded.
I don't want to be that guy, but can't you folks add E2E testing to test maestro itself? iOS is simply broken.
@edgarfroes the challenge is that this issue is not reproducible on our machines (both Intel and M1), but we have some leads now.
Could you please check if you have anything running on port 9080 on your machine before you start Maestro (Studio or test, doesn't matter)? Maestro is using that port to communicate with iOS devices
@dmitry-zaitsev there are no services running on 9080. Here's the result of running netstat -a -n | grep 'LISTEN '
:
Here's the log dump: 2023-01-27_185824.zip
@edgarfroes something is preventing us form installing and launching iOS driver on your simulator on 9080 port. This could be your Simulator settings or some other software interfering on your workstation, due to that it is hard to pinpoint the issue. Anything that comes to mind by any chance?
@dmitry-zaitsev you are right the ios driver is not getting installed on the device after I upgrade
It worked with previously with
@edgarfroes what is your CI VM configurations/ tools?
@dmitry-zaitsev I am sure you are running in CI for the cloud. Would it be possible to share the iOS VM specs? So that we can use same configs/specs to run iOS to reproduce?
Hey folks, there is a confusion here. There are 2 separate issues getting discussed here which are not related to each other. The necessary fixes for both of them will be released in next versions.
Hey folks, this should be fixed in the new version of maestro cli 1.22.1. Feel free to open issue in case you still face difficulties.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue. Thank you for helping keep us our issue tracker clean!
Similarly to #595 and https://github.com/mobile-dev-inc/dadb/issues/48, this error occurs intermittently when trying to run flows with
maestro test
. In my local environment, this tends to happen when I have another terminal tab runningmaestro studio
at the same time that I try to runmaestro test
, whether themaestro studio
process is running or if the process had been closed a few seconds ago (conflicting background process?).Maestro version 1.19.2 (installed via curl) Environment: Mac Pro M1 Max
Click to see the complete log
``` bash java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:9080 at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:297) at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207) at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) at xcuitest.XCTestDriverClient.runningAppId(XCTestDriverClient.kt:55) at ios.xctest.XCTestIOSDevice.activeAppId(XCTestIOSDevice.kt:191) at ios.xctest.XCTestIOSDevice.contentDescriptor(XCTestIOSDevice.kt:48) at ios.LocalIOSDevice.contentDescriptor(LocalIOSDevice.kt:32) at maestro.drivers.IOSDriver.contentDescriptor(IOSDriver.kt:175) at maestro.Maestro$findElementWithTimeout$1.invoke(Maestro.kt:344) at maestro.Maestro$findElementWithTimeout$1.invoke(Maestro.kt:343) at maestro.utils.MaestroTimer.withTimeout(MaestroTimer.kt:16) at maestro.Maestro.findElementWithTimeout(Maestro.kt:343) at maestro.orchestra.Orchestra.findElement(Orchestra.kt:646) at maestro.orchestra.Orchestra.findElement$default(Orchestra.kt:628) at maestro.orchestra.Orchestra.tapOnElement(Orchestra.kt:558) at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:159) at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:443) at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:358) at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:185) at maestro.orchestra.Orchestra.runSubFlow(Orchestra.kt:443) at maestro.orchestra.Orchestra.runFlowCommand(Orchestra.kt:358) at maestro.orchestra.Orchestra.executeCommand(Orchestra.kt:185) at maestro.orchestra.Orchestra.executeCommands(Orchestra.kt:137) at maestro.orchestra.Orchestra.runFlow(Orchestra.kt:91) at maestro.orchestra.Orchestra.runFlow$default(Orchestra.kt:72) at maestro.cli.runner.TestSuiteInteractor.runFlow(TestSuiteInteractor.kt:136) at maestro.cli.runner.TestSuiteInteractor.runTestSuite(TestSuiteInteractor.kt:67) at maestro.cli.runner.TestSuiteInteractor.runTestSuite(TestSuiteInteractor.kt:45) at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:118) at maestro.cli.command.TestCommand$call$1.invoke(TestCommand.kt:100) at maestro.cli.session.MaestroSessionManager.newSession(MaestroSessionManager.kt:91) at maestro.cli.command.TestCommand.call(TestCommand.kt:100) at maestro.cli.command.TestCommand.call(TestCommand.kt:39) at picocli.CommandLine.executeUserObject(CommandLine.java:1933) at picocli.CommandLine.access$1200(CommandLine.java:145) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332) at picocli.CommandLine$RunLast.handle(CommandLine.java:2326) at picocli.CommandLine$RunLast.handle(CommandLine.java:2291) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159) at maestro.cli.DisableAnsiMixin$Companion.executionStrategy(DisableAnsiMixin.kt:22) at picocli.CommandLine.execute(CommandLine.java:2058) at maestro.cli.AppKt.main(App.kt:122) Suppressed: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:9080 ... 55 more Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.base/java.net.Socket.connect(Socket.java:615) at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295) ... 54 more Caused by: java.net.ConnectException: Connection refused (Connection refused) at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.base/java.net.Socket.connect(Socket.java:615) at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:128) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295) ... 54 more ```