Detox icon indicating copy to clipboard operation
Detox copied to clipboard

Detox support for multiple interacting devices?

Open sunweiyang opened this issue 8 years ago • 19 comments

I'm a developer for a RN video chat education app that connects pairs of users. Detox looks fantastic for testing single app instances, but I was not able to find anything about testing multiple app instances on more than one device interacting with each other. Is it possible to do this kind of testing with Detox on multiple simulators/emulators?

sunweiyang avatar Nov 08 '17 04:11 sunweiyang

Not possible at the moment without some work on your part. Theoretically you could run two different tests in two different shells, with two different configurations for each test. I assume this could work.

That’s an interesting scenario. We plan to support concurrent testing on several devices, but that’s different.

LeoNatan avatar Nov 08 '17 09:11 LeoNatan

what @LeoNatan said. This currently out of the scope of the projects for us.

rotemmiz avatar Nov 12 '17 14:11 rotemmiz

I was able to achieve something similar for testing a chat app. Basically, it works as @LeoNatan described: two detox instances with different configurations and a simple HTTP server for syncing between two instances (one may need to wait for another instance before performing an action) and sharing the context (such as sharing username just created).

Right now I did all basic tests such as sign in, search, exchanging messages. I'll continue with this approach with adding more and more tests, and if it works well, I'm planning to write a blog post or/and add an example repository.

I must say, I love Detox :)

ptmt avatar Nov 24 '17 19:11 ptmt

@ptmt This looks awesome! Please let us know when the post and/or example is live.

sunweiyang avatar Dec 02 '17 01:12 sunweiyang

There you go https://github.com/ptmt/inter-device-detox

It's an experiment and I'm really bad at writing notes for it. Anyway, it's a few lines of js, so you can get inspiration and do better. I'll continue experimenting with this since I found it really handy not just for tests, but for reproducing the environment from the scratch.

ptmt avatar Dec 11 '17 15:12 ptmt

Hi @LeoNatan, do you know how far is the plan you mentioned above? (running concurrent devices with the same set of tests)

I am currently scripting a rake script (or fastlane) to run multiple instances of detox on a collection of iOS simulators (and possibly a collection of android emulators as well).

rodrigoelp avatar Nov 01 '18 05:11 rodrigoelp

Multiple instances of detox is supported on iOS from 7.4.0. this requires a t at runner with parallel execution support, like Jest.

rotemmiz avatar Nov 01 '18 06:11 rotemmiz

I meant, running the test in variants of devices... iPhone 8, iPhone xs, iPhone SE, etc, at the same time. Is that documented anywhere?

I've been digging through the cli and I can see there is a way to provide the number of workers and maybe provide a device name with a given artefact so it doesn't need to recompile the code. But I've been unable to find a way to provide multiple simulators to test variations based on screen size or os variations.

Ideally, what I wanted to do is:

detox test -o e2e/someconfig.json -p ios -a ci/the.ipa -devices "iPhone 8, iPhone XS, iPhone XS Max, iPhone SE" -c 'device configuration'

rodrigoelp avatar Nov 01 '18 11:11 rodrigoelp

No, it's not supported, but you can just run it in two different commands, either one after the other, or by sending one one process to background with shell, something like detox test -c ios.sim.iphonex& detox test -c ios.sim.iphone8

rotemmiz avatar Nov 01 '18 11:11 rotemmiz

Probably a better idea to run both in background and then wait for both:

detox test -c ios.sim.iphonex&
detox test -c ios.sim.iphone8&
wait

LeoNatan avatar Nov 01 '18 11:11 LeoNatan

What he said

rotemmiz avatar Nov 01 '18 11:11 rotemmiz

That's basically what I am doing :)

rodrigoelp avatar Nov 02 '18 00:11 rodrigoelp

This should be fixed by #1144

manuquentin avatar Aug 23 '19 19:08 manuquentin

the fixed in which version is? Can we do detox test -o e2e/someconfig.json -p ios -a ci/the.ipa -devices "iPhone 8, iPhone XS, iPhone XS Max, iPhone SE" -c 'device configuration'.

or have to specify each device separated? @manuquentin

TammyTorres avatar May 14 '20 20:05 TammyTorres

the fixed in which version is? Can we do detox test -o e2e/someconfig.json -p ios -a ci/the.ipa -devices "iPhone 8, iPhone XS, iPhone XS Max, iPhone SE" -c 'device configuration'.

or have to specify each device separated? @manuquentin

Have you figured this out? Is this in the documentation somewhere?

hsavit1 avatar Jul 15 '20 19:07 hsavit1

+1

olexandr13 avatar Feb 26 '21 15:02 olexandr13

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this reporsitory, read this discussion.

stale[bot] avatar May 25 '22 23:05 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Jun 11 '22 02:06 stale[bot]

Reopened because we might want to support that one day.

d4vidi avatar Jun 12 '22 12:06 d4vidi