Skip to content
This repository was archived by the owner on Jan 3, 2024. It is now read-only.

Conversation

@mindlapse
Copy link

When there are multiple test failures, this change will save each captured source to a separate file.


return new Promise((resolve) => {
const pathToLog = path.resolve(process.cwd(), 'appium_source.xml')
const pathToLog = path.resolve(process.cwd(), _.uniqueId('appium_source_')+'.xml')
Copy link
Contributor

@igor-lemon igor-lemon Jul 22, 2019

Choose a reason for hiding this comment

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

I think better add date+time as unique label.
appium_source_2019-07-22_10:24:12.xml

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, need to return the final source file name because we put this file into artifacts at a CI.

Copy link
Author

Choose a reason for hiding this comment

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

Okay, I've made both of the changes you've requested - the date format though is ISO8601 standard YYYYMMDDTHHmmss. The ':' character is reserved for filenames on some systems.

resolve()
}
})
return pathToLog
Copy link
Contributor

Choose a reason for hiding this comment

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

We return the promise. You can't return the result from promise via return, you can return some result only via resolve/reject promise methods. Remove return pathToLog and move it to resolve(pathToLog)


return new Promise((resolve) => {
const pathToLog = path.resolve(process.cwd(), 'appium_source.xml')
const pathToLog = path.resolve(process.cwd(), 'appium_source_'+date.format(new Date(), 'YYYYMMDD[T]HHmmss')+'.xml')
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. Sorry, I misled you. We should be able to put the source file with strong naming. We can solve it with some additional param.
export default async function ({ strongSourceFileName = true }) {

You can call await driver.source({ strongSourceFileName: false }) to put unique source files.
2) Let's rename the const to something like sourceFilePath because it's not logs, it's a source of the page.
3) Don't need to include an external library for one simple action. Use native Date

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants