Detox icon indicating copy to clipboard operation
Detox copied to clipboard

Fix future gmsaas incompatibility

Open d4vidi opened this issue 1 year ago • 6 comments

What happened?

According to the gmsaas 1.10.0 documentation:

Marked gmsaas auth whoami command as deprecated.

Since it is used regularly by Detox, it will break in future versions.

cc @igorgn @lilinor

What was the expected behaviour?

N/A

Was it tested on latest Detox?

  • [X] I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: React Native version: Has Fabric (React Native's new rendering system) enabled: (yes/no) Node version: Device model: Android version: Test-runner (select one): jest / other

Detox logs

N/A

Device logs

N/A

More data, please!

No response

d4vidi avatar Feb 07 '24 13:02 d4vidi

Thanks for mentioning @d4vidi ! We released the authentication with API tokens and it introduced the deprecation of this command. For which reason do you need to use this command in the integration?

lilinor avatar Feb 07 '24 15:02 lilinor

@lilinor we have this logic:

async function _validateGmsaasAuth() {
  if (!await this._authService.getLoginEmail()) {
    throw new DetoxRuntimeError({
      message: `Cannot run tests using 'android.genycloud' type devices, because Genymotion was not logged-in to!`,
      hint: `Log-in to Genymotion-cloud by running this command (and following instructions):\n${environment.getGmsaasPath()} auth login --help`,
    });
  }
}

Perhaps we could also check for GENYMOTION_API_TOKEN as well, but would that be enough? I'm not sure I understand what gmsaas auth token ... does.

noomorph avatar Feb 07 '24 15:02 noomorph

Yep that's the code. Thanks @noomorph. @lilinor we pre-validate that gmsaas is properly installed and set up, that's all. Would also appreciate an advice regarding what we might be able to do equivalently.

d4vidi avatar Feb 07 '24 20:02 d4vidi

gmsaas auth whoami is deprecated but rest assured that it won’t be removed unless we have your approval so it won’t break current gmsaas installations with username/pwd authentication. But we have just discovered that detox tests will break if users authenticate with api token as we return the error message : Error: command not supported when using API Token We can do a quick fix where gmsaas auth whomai will return exit code 0 if an API token is set.

We plan in the future versions of gmsaas to add a gmsaas doctor command to verify the whole gmsaas environment which will work with credentials & API token authentication :

  • Android SDK

  • Authentication with a real API call as gmsaas auth whoami only returns the email stored in the config file, there isn’t real check, password could have changed and running the other gmsaas commands like gmsaas list instances, start would fail

Does this sound ok for you?

lilinor avatar Feb 08 '24 13:02 lilinor

@lilinor IMO, a new command like gmsaas auth status may also work.

The idea with exit code = 0/1 sounds good to me.

As for hotfixing the gmsaas auth whoami command, I think it won't be semantic enough for tokens, as it cannot respond conceptually correctly to the question "Who am I?" just because tokens don't work the same.

The idea with gmsaas doctor sounds good as well.

noomorph avatar Feb 08 '24 13:02 noomorph

As you said, using gmsaas auth whoami for API token doesn’t make any sense conceptually. As all our detox users haven’t switched to API tokens, we could also leave it like this and tell them to stick to username/password waiting for gmsaas doctor to come out if they encounter the issue. We could aim to release this command within the month.

lilinor avatar Feb 09 '24 14:02 lilinor

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 repository, read this discussion.

stale[bot] avatar Mar 17 '24 08:03 stale[bot]

Hi @d4vidi & @noomorph ! Just letting you know that we released gmsaas doctor command in our last 1.11.0 version of gmsaas :)

lilinor avatar Apr 04 '24 08:04 lilinor

Hi @d4vidi & @noomorph ! Just letting you know that we released gmsaas doctor command in our last 1.11.0 version of gmsaas :)

Hey Thanks! We have a backlogged issue for that: https://github.com/wix/Detox/issues/4417 Hopefully, we'll get around to it soon enough.

d4vidi avatar Apr 04 '24 16:04 d4vidi