I want to set the 'Text File Input' step's default 'encoding' to 'UTF-8' so that every time I drag the step onto the canvas it is automatically populated. How would I configure this?
Related
describe ('Upload Test' , function(){
it('Upload Test' , function(){
cy.visit('https://document.online-convert.com/convert/csv-to-excel')
cy.get('#fileUploadButton').click()
const catalogue ='../integration/Example.csv';
cy.get('#file').attachFile(catalogue);
cy.get('#multifile-submit-button-main').click()
})
})
i tried to upload the csv file and click on convert it, At cypress test result it shows that the file have been uploaded but actually its not.
enter image description here
I hope you're using cypress-file-upload. Your file seems to be in the integration folder. I would suggest putting all the files required for Cypress tests inside cypress/fixtures folder and calling them as fixtures.
I would also higly suggest to use cypress-file-upload.
With it you can do it like that:
First, you get your input field for the file. Then you can use .attachFile to declare the source and give it a name
cy.get('.FileInput input[type=file]')
.attachFile({filePath: 'Example.csv', fileName});
There are a couple of events attached to the input that need to be fired after you attach the file.
The user will click the "Choose file" and the OS opens a file selection dialog. Since Cypress can't control that dialog, you are effective replacing that step with .attachFile(...).
As soon as the file is attached, the upload begins automatically and when complete, the file name appears in the file list element.
The element we need to attach to is <input id="fileUploadInput" type="file">.
If you inspect this element, and look at it's event listeners there's a change event and a custom event fileuploadsubmit that look useful
This is the code that works for me
const catalogue = "../fixtures/example.csv";
cy.get('#fileUploadInput')
.attachFile(catalogue)
// this just confirms the internal file property of the element
// i.e confirm the attachFile worked
// You can leave it out, it does not affect the process
cy.get('#fileUploadInput')
.its('0.files')
.its('0')
.its('name')
.should('eq', 'example.csv')
// Now trigger the change event
cy.get('#fileUploadInput')
.trigger('change', {force:true}) // force because the input is hidden
// And the fileuploadsubmit event
// Note that after change event, the input is detached from DOM
// so we need to re-query for the id
cy.get('#fileUploadInput')
.trigger('fileuploadsubmit', {force:true})
// Confirm the file is in the file list
// if it's a large file, allow enough time with a timeout option
cy.contains('span', 'example.csv', {timeout: 10000})
// Now start the conversion
cy.get('#multifile-submit-button-main').click()
I am struggling saving a base64 string (a downloaded pdf) to a 'named' file, as in, I want to name this file 'statement 1' for instance.
Share.share({
url: base64data,
title: 'statement 1',
message: 'statement 1',
});
This now shows the following:
YEAH - so far so good...
Now I hit 'Save to Files'
and this appears:
Strangly it shows 2 Items to be saved and when I 'Save' it saves it like this:
The PDF document is the correct document and the text file actually contains the name of the file.
Not ideal. How can I simply save this PDF with the name 'statement 1'?
Seems such a simple thing but I am stuck...
Any help much appreciated!
try to use API without message and title parameters like below. Providing message property causes to create a .txt file. User can rename the pdf file once dialog pops up.
Share.share({
url: base64data,
});
I want to create a parameter that contains a list of string (list of hub codes). This list of string is created by reading an external csv file (this list could contain the different codes depending on the hub codes in the CSV file)
What I want is to find a easy auto way to perform batch runs by each hub code in the list.
So this question is:
1) how to add and set a new parameter directly from the code (during the initialization when reading the CSV) instead of GUI parameter panel?
2) how to avoid manual configuration of hub list in the batch run configuration
Something like this for adding the parameters should work in your ContextBuilder.
Parameters params = RunEnvironment.getInstance().getParameters();
((DefaultParameters)params).addParameter("foo", "Big Foo", Integer.class, 3, false);
You would read the csv file to get the parameter name and value.
I'm not sure I completely understand the batch run configuration question, but each batch run has a run number associated with it
RunState.getInstance().getRunInfo().getRunNumber()
If you can associate line numbers in your csv parameter file with run number (e.g. run number 1 should use line 1, and so on), then each batch run would use a different parameter line.
I added some custom properties in the 'updateAttribute' processor using the '+' button. For example: I declared a property 'DBConnectionURL' and gave the value as 'jdbc:mysql://localhost:3306/test'. Then, in the 'DBCPConnectionPool' service controller, I simple used the value'${DBConnectionURL}' for 'Database Connection URL' property. But, I manually gave the value for 'DBConnectionURL' property.I want a way where I can feed the value dynamically from a file, so that i just need to change the value in the file and the value for 'DBConnectionURL' changes dynamically based on the value present in the file. Is there a way to do it?
Rishab,
You have to use nifi variable registry.
In conf/nifi.properties, you could configure the below configuration in it for dynamically update a value in your data flow.
nifi.variable.registry.properties=./dynamic.properties
You can give your variables in that file dynamic.properties it should present in conf directory.
For an example, If dynamic.properties files contains below values
DBCPURL= jdbc://<host>:<port>
you can use that in your data flow by using ${DBCPURL}
Note: You should restart nifi services if you change any configuration in conf/nifi.properties.Otherwise your changes not worked in dataflow.
Feel free to accept it be answer if it worked for you.
If we add an image through the Upload Media action inside Sitecore Rocks, the image will serialize completely with all the binary data it needs to be reproduced:
----field----
field: {40E50ED9-BA07-4702-992E-A912738D32DC}
name: Blob
key: blob
content-length: 46816
R0lGOD... /*Binary data here*/
However, when we try adding an image through the Sitecore GUI, the image is not stored as binary data and cannot be given to others. It simply holds a path:
----field----
field: {40E50ED9-BA07-4702-992E-A912738D32DC}
name: Blob
key: blob
content-length: 46816
/static/files/media_files/2/2/4/{22481B01-4210-413A-AABB-5A7EE3387D7F}some-imge-file.png
How do we get the Sitecore GUI to store it the same way as Rocks?
We are one 7.5 using Unicorn.
That looks like your config is set to store images as files rather than in the database. Check the following setting to see if it is true or false:
<setting name="Media.UploadAsFiles" value="false">
See this post for more information: http://firebreaksice.com/storing-sitecore-media-in-the-database-vs-the-file-system/
Alternatively, do you have any customization in the media upload dialogs?