Skip to content

Conversation

mykola-mokhnach
Copy link
Contributor

As per appium/appium#7741

Please double check whether the flow is correct and matches to what was discussed in that thread.

if (_.isUndefined(duration)) {
// TODO: Replace the block after deprecated stuff is removed
// seconds = Number.MAX_SAFE_INTEGER;
log.warn(`commands.background: Application under test will never be restored in the future if no duration is provided.\n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A template that spans two lines will keep the formatting. So this will have two newlines in it. Also, it will get printed weirdly in our logs, since the prefix will be skipped. I'd rather see this on a single line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this message is a bit confusing. It makes it seem like the application will not be restored, not that the behavior will change at some point in time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, one single line or two log.warn calls, one per line

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also also the commands.background part seems geared toward developers of Appium, whereas it is really for end users.

Copy link
Member

@jlipps jlipps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, just the comment about log formatting but the logic looks sound

if (_.isUndefined(duration)) {
// TODO: Replace the block after deprecated stuff is removed
// seconds = Number.MAX_SAFE_INTEGER;
log.warn(`commands.background: Application under test will never be restored in the future if no duration is provided.\n
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, one single line or two log.warn calls, one per line

Copy link
Contributor

@imurchie imurchie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm confused. I thought the point of the original issue was to give access to /wda/homescreen?

if (_.isUndefined(duration)) {
// TODO: Replace the block after deprecated stuff is removed
// seconds = Number.MAX_SAFE_INTEGER;
log.warn(`commands.background: Application under test will never be restored in the future if no duration is provided.\n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this message is a bit confusing. It makes it seem like the application will not be restored, not that the behavior will change at some point in time.

if (_.isUndefined(duration)) {
// TODO: Replace the block after deprecated stuff is removed
// seconds = Number.MAX_SAFE_INTEGER;
log.warn(`commands.background: Application under test will never be restored in the future if no duration is provided.\n
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also also the commands.background part seems geared toward developers of Appium, whereas it is really for end users.

if (duration >= 0) {
seconds = duration;
} else {
seconds = Number.MAX_SAFE_INTEGER;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

@mykola-mokhnach
Copy link
Contributor Author

I guess I'm confused. I thought the point of the original issue was to give access to /wda/homescreen

Yep, I've almost forgotten about one important thing. Fixed now. Friday...

// seconds = Number.MAX_SAFE_INTEGER;
log.warn('commands.background: Application under test will never be restored in the future if no duration is provided. ' +
'See https://github.com/appium/appium/issues/7741');
seconds = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel uncomfortable with all the over-determination of seconds here. I'd rather use this logic to build up the endpoint and params, and then act on that below.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree. Changed the logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants