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

Adds a unique id to driver source output XML filenames to prevent overwrites #22

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tipsi-appium-helper",
"version": "3.2.0",
"version": "3.2.1",
"description": "Tipsi Appium Helper",
"main": "src/index.js",
"bin": {
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/source.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import path from 'path'
import fs from 'fs'
import _ from 'lodash'

export default async function () {
const content = await this.driver.getSource()

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.

fs.writeFile(pathToLog, content, 'utf8', (error) => {
if (error) {
console.log('---------------------------------------------------')
Expand Down