Protractor CSV file upload doesn't work - protractor

I have problem when trying to upload a csv of excel files via protractor. File is valid. When I upload it manually everything is fine. But for some reason, upload with protractor says that size is 0, and type is not recognized.
Screenshot of file details after upload
Upload code:
var fileToUpload = './test.csv';
var absolutePath = path.resolve(__dirname, fileToUpload);
element(by.css("input[type=\"file\"]")).sendKeys(absolutePath);
Also I have tried with absolute path, without path.resolve, and also I have tried with xlsx file. Problem remains the same.

I believe I've found the cause. From my tests it seems like the File type is missing, see below:
For a .csv file:
File
lastModified: 1468589472000
lastModifiedDate: Fri Jul 15 2016 14:31:12 GMT+0100 (BST)
name: "valid-import.csv"
size: 198
type: ""
webkitRelativePath: ""
For a .svg file:
File
lastModified: 1468587182000
lastModifiedDate: Fri Jul 15 2016 13:53:02 GMT+0100 (BST)
name: "valid-import.svg"
size: 1030
type: "image/svg+xml"
webkitRelativePath: ""
Note the missing type attribute — I'm trying to dig further into this, if I find anything I'll update this answer.

Related

Azure Release Notes Wiki Markdown date

I am completely new to this so any help and explanation would be appreciated.
I have a created a template that will generate my release notes in our wiki. I am using the Generate Release Notes Markdown (crossplatform) extension by Richard Fennell.
In the template section of the extension, I use this short and simple template:
# {{releaseDetails.name}}
**Date** : {{releaseDetails.modifiedOn}}
**Build Number**: {{buildDetails.buildNumber}}
{{#forEach workItems}}
{{#if isFirst}}## Work Items{{/if}}
- **{{lookup this.fields 'System.WorkItemType'}}** #{{this.id}}
{{/forEach}}
The output is as follows:
Release-17
Date : Mon Dec 05 2022 18:19:37 GMT+0000 (Coordinated Universal Time)
Build Number: 20221026.4
Everything is good except I would like to change the date and time format to just show Mon 12/05/2022 12:19 PM. That's it. I don't want the military time or the GMT +0000 stuff in there.
EX:
Release-17
Date : Mon 12/05/2022 12:19:37 PM
Build Number: 20221026.4
Does anyone know how to format the date properly? Any help is appreciated.
Thanks!
Searched forums and have not been able to find any solutions.
To modify the time zone and date format in Generate Release Notes Markdown, you need to add custom Javascript extenstion module in the Generate Release Notes Markdown task -> Custom Handlebars Extension.
Here is an example:
Javascript module
module.exports = {date_formatter(theDate) {
return theDate.toLocaleString("location");
}};
Task sample:
- task: XplatGenerateReleaseNotes#3
displayName: 'Generate Release Notes based on Release Comparison API'
inputs:
outputfile: '$(System.DefaultWorkingDirectory)/releasenotes.md'
templateLocation: InLine
inlinetemplate: |
# {{releaseDetails.name}}
**Date** : {{date_formatter releaseDetails.modifiedOn }}
**Build Number**: {{buildDetails.buildNumber}}
{{#forEach workItems}}
{{#if isFirst}}## Work Items{{/if}}
- **{{lookup this.fields 'System.WorkItemType'}}** #{{this.id}}
{{/forEach}}
replaceFile: true
customHandlebarsExtensionCode: |
module.exports = {date_formatter(theDate) {
return theDate.toLocaleString("location");
}};
Refer to this sample: date_formatter.js and Handlebar Extensions

Mercurial: How can I change default tag message template?

I would like to use some prefix labels in commit messages to quickly identify the kind of commit when viewing the revision log, and for ability to quickly filter down the log.
Some of the prefixes I intend to use are (TAG:, MERGE:, TEST:, STABLE:, TRUE-UP:, FIX():, FEATURE():, & possibly others).
Additionally, for tags I would like to change the default message to be a little more descriptive, like so:
TAG: Added tag v3.4 for e90d0caa766 created on 2022-09-22 01:05:00
Applied fix for foobar.
For tagging, Mercurial seems to not open the editor so I can examine the tag message, so my attempts to debug this have been tedious.
I've tried adding the following to my repo hgrc config file:
[committemplate]
changeset.tag = "TAG: Added tag {tag} for {node|short} created on {date|isodate}\n{desc}"
I've also played around with the [hooks] section and pretag hook.
Additionally, I've tried on the command line with various formatting adjustments:
hg tag -r . -m 'TAG: Added tag {tag} for {node|short} created on {date|isodate}\n{desc}' test4
For the command line attempt above none of this populates the template fields in the message, and for the other attempts in the hgrc config file, this has not altered the commit message not once or even errored.
What am I missing here?
[committemplate] work, if it was added to hgrc (tried at repo-level, not globally), but somehow not in expected form (see below)
Just note: if you'll use "Added tag" wording, you, maybe want to limit area of modified message to only adding tags (hg tag can remove tags also, BTW) with changeset.tag.add
My test-case
Hg 6.2.2
No redefined committemplate in global config
Dumb oneliner for changeset.tag and later for changeset.tag.add
Tagging pure in CLI (due to total fails in THG)
Some logs
Plain hg tag -r 0 0.1 + hg tag --remove 0.1 used with changeset.tag redefined (default messages used by hg)
changeset: 2:006c40256d9b
user: lazybadger
date: Thu Sep 22 17:05:15 2022 +0500
summary: Removed tag 0.1
changeset: 1:1927f74a0ec0
user: lazybadger
date: Thu Sep 22 17:02:46 2022 +0500
summary: Added tag 0.1 for changeset 8385f66bee57
Tagging with -e additional option (BEWARE: tag inserted in editor by hand, {tag} nor {tags} are not expanded in changeset.tag.* text)
changeset: 7:5aee36e13e4d
tag: lazybadger
date: Thu Sep 22 17:13:43 2022 +0500
summary: TAGGING: Tag 0.3 added
...
changeset: 3:9a4b0a117fb1
user: lazybadger
date: Thu Sep 22 17:06:23 2022 +0500
summary: TAG: Tag 0.1 touched

Relative path MS Word with INCLUDETEXT

I am trying to use INCLUDETEXT to automate a Table of Contents with number of pages from various other .docm files in folders below main folder.
I have trouble using relative paths in MS Word per: relative path includetext in MS Word
Here is my effort which results in an
"Error! Not a valid filename":
{INCLUDETEXT "{FILENAME \P } \..\..\Div 22 Plumbing\SECTION 22 07 80.DOCM" Pages}
Div 22... folder is one level the FILENAME path. Pages is a bookmark in the .docm file.
I tried like this too with same negative result:
{INCLUDETEXT "{FILENAME \P } \\..\\Div 22 Plumbing\SECTION 22 07 80.DOCM" Pages}
I am able to get the contents of Pages into my TOC if I just use the INCLUDETEXT from an external file in the same folder, I just can't seem to get the contents from a file in a subfolder.
in your example, you put this:
{INCLUDETEXT "{FILENAME \P } \\..\\Div 22 Plumbing\SECTION 22 07 80.DOCM" Pages}
did you mean this:
{INCLUDETEXT "{FILENAME \P } \\..\\Div 22 Plumbing\\SECTION 22 07 80.DOCM" Pages}

Angular file upload - return name uploaded file

I'm using an angular-file-upload directive. When I uploading file I getting file's name before upload on callback.
$$hashKey: "object:19"_file: FilelastModified: 1429780959000lastModifiedDate: Thu Apr 23 2015 12:22:39 GMT+0300 (MSK)name: "av_1.png"size: 1278type: "image/png"webkitRelativePath: "" trueisUploading: falsemethod: "POST"progress: 100removeAfterUpload: false
name: "av_1.png" - name before upload
But I need to get name of file after upload. Name turns in 16 bit encoding and looks like 68b714b12c6a4336500a4c5a4b53c60e.png for example.
How can I return file's name after upload?

Learning when was the last time a file is accessed

I was wondering if learning when was the last time a file is accessed is possible. I mean like when a .dll file in windows is used by any other program. I wonder if are there any features in any operating system that keeps a file's last access date, or extensions.
Thanks!
Unix provides the stat command or the fstat() function to fetch the last access time of a file.
eos$ stat file
File: `file'
Size: 280486 Blocks: 548 IO Block: 4096 regular file
Device: 12h/18d Inode: 1963857568 Links: 1
Access: (0600/-rw-------) Uid: (83991/ vshesha) Gid: ( 108/ abcd)
Access: 2014-09-16 15:39:09.000000000 -0400
Modify: 2014-09-16 15:39:09.000000002 -0400
Change: 2014-09-16 15:39:09.000000000 -0400
For Windows see this post
This is a feature of a filesystem/OS. In case of Windows and it's default file system NTFS, you need to enable the feature first: http://www.groovypost.com/howto/microsoft/enable-last-access-time-stamp-to-files-folder-windows-7/
In the cmd prompt, Type in "fsutil behavior set disablelastaccess 0" and press enter.
Restart your PC for changes to take affect
Usually all file systems save the file access time.
For example, take a look at NTFS for Windows. Or ext2, and older version of the file system commonly used in linux.