Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support more than 1 action on simulator #58

Closed
DanielZlotin opened this issue Dec 1, 2016 · 2 comments
Closed

Support more than 1 action on simulator #58

DanielZlotin opened this issue Dec 1, 2016 · 2 comments

Comments

@DanielZlotin
Copy link
Contributor

DanielZlotin commented Dec 1, 2016

This code works:

    it('starts with video view on first launch', (done) => {
      global.simulator.deleteAndRelaunchApp(() => {
        expect(element(by.id('VideoView'))).toBeVisible();
        done();
      });
    });

    it('does not display video view on second launch', (done) => {
      global.simulator.reloadReactNativeApp(() => {
        expect(element(by.id('VideoView'))).toNotExist();
        done();
      });
    });

while this fails (prints error: _onTestResult is undefined on testFailed):

    it('starts with video screen on first launch only', (done) => {
      global.simulator.deleteAndRelaunchApp(() => {
        expect(element(by.id('VideoView'))).toBeVisible();
        global.simulator.reloadReactNativeApp(() => {
          expect(element(by.id('VideoView'))).toNotExist();
          done();
        });
      });
    });

I tracked the reason to this

Also, #57 would make this code much prettier

@rotemmiz
Copy link
Member

using async await instead of invocaction queue and callbacks will solve this.
#38

@rotemmiz
Copy link
Member

rotemmiz commented Mar 6, 2017

new async await api is no in master, check out the test project. upcoming detox version (5.0.0) breaks the api completely in favor of async await.

device actions are now async await as well, you can now do

    it('starts with video screen on first launch only', () => {
       await device.deleteAndRelaunchApp();
       await expect(element(by.id('VideoView'))).toBeVisible();
       await device.reloadReactNativeApp();
       await expect(element(by.id('VideoView'))).toNotExist();
    });

@rotemmiz rotemmiz closed this as completed Mar 6, 2017
@wix wix locked and limited conversation to collaborators Jul 23, 2018
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants