Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Safari callback #213

Closed
ignaciosantise opened this issue Jul 27, 2017 · 10 comments
Closed

Safari callback #213

ignaciosantise opened this issue Jul 27, 2017 · 10 comments

Comments

@ignaciosantise
Copy link

My app has a login with Google, and it opens safari to do that. When i run detox, it logins successfully but it doesn't go back to my application as expected. Instead of that, it remains in safari with the caption "Website name"

screen shot 2017-07-27 at 12 37 21 pm

Any idea of what's happening?

Additional info

  • react-native: 0.45.0
  • iOS: 10.3
@rotemmiz
Copy link
Member

Does it work as expected when you run it manually ? or are you obligated to press the done button ?
If the behaviour is different when running the Detox test, please provide the test code.

@isnifer
Copy link
Contributor

isnifer commented Aug 15, 2017

@rotemmiz SFSafariViewController is not supported by EarlGrey now.
@ignaciosantise How did you log in via detox?

@ignaciosantise
Copy link
Author

@rotemmiz yes, if i run it manually it works as expected.

@isnifer i'm not logging in via detox, i log in with safari before running the test, so it remembers the account when i run detox

@rotemmiz
Copy link
Member

Please post your test code here.

@isnifer
Copy link
Contributor

isnifer commented Aug 15, 2017

@ignaciosantise cheater, haha

@ignaciosantise
Copy link
Author

@isnifer i could't find another solution 👼

@rotemmiz here is the test code!

describe('Example', () => {
  beforeEach(async () => {
    await device.reloadReactNative();
  });

  it('Grant notification permission', async () => {
    await device.launchApp({permissions: {notifications: 'YES'}});
  });

  it('should have a login screen', async () => {
    await expect(element(by.id('loginButton'))).toBeVisible();
  });

  it('Tap login button tap', async () => {
    await element(by.id('loginButton')).tap();
  });

  it('should see the dashboard list', async () => {
    await waitFor(element(by.label('Enviados'))).toExist().withTimeout(8000);
  });
})

@rotemmiz
Copy link
Member

Not sure what you're doing there, I can't make any sense from this suite.
Seems like these are 4 different tests (which probably need to be merged into 1).
In the 3rd test loginButton is tapped, but then you reload react native before the 4th test. So this tap doesn't hold for the 4th test. Is that what you intend to do ?

@ignaciosantise
Copy link
Author

Ohh, you are right! i have to merge the tests. Clearly my mistake! Thanks for that!

@rotemmiz
Copy link
Member

anyway, take a look at manual synchronization tests API https://github.com/wix/detox/blob/master/docs/APIRef.waitFor.md
You have to use expect after waitFor. waitFor will never fail a test.

But please, try not to use waitFor, Detox should wait until all the actions complete before continuing to the next action.

@ignaciosantise
Copy link
Author

@rotemmiz @isnifer Thanks for your help! 🎉

@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants