How to load images via file open dialog in TestCafe - testing

Background info:
Our application depends on different sets of medical images (due to the medical environment we can't share our code). In each image, a set of test cases is run. Each time we need to manually select a new image, which of course we want to automate. The loading of images is fairly complex, but our devs created a button that covers all that. This button opens a File open dialog.
My Question:
How can I open a file dialog window and import new images with TestCafe?
We've tried:
t.setFilesToUpload (which not seems to work because it needs a selector where the images get uploaded to?)
List item clicking the button (it does not open the dialog
window)

Related

Move filepond input to a different location in the DOM

I'm in the middle of building the file uploading part of our system, and our design has two flows in which you can upload a file:
Drag 'n drop onto the page
Click the "Upload file" button which presents a modal.
If I drag 'n drop a file onto the page, I want to show a small popup in the bottom corner showing the upload progress of each file.
If I go through the modal, I get the option to drag 'n drop or browse files. It then shows me the same progress in the modal, however I have the option of closing the modal which should then show me that same small box in the corner with the upload progress.
From what I've been able to determine from the docs of FilePond, this doesn't sound like it would be possible. Every demo I've found links the FilePond instance to a single input and since it builds its own UI, the drop zone would also be built. Fine for the modal window but not for the full page drag 'n drop. So I have a couple of questions:
Can I make anything a dropzone without it building the UI?
If so, when I drop files can I specify where to display the uploading progress?
Is it possible to move the progress from one area of the DOM to another (going from modal to the corner)?
I'm building this in Vue.j, so the plan was to use Vuex to manage the uploads and their progress which would make it easy to render the progress in different parts of the DOM. I love the look of FilePond for what it offers visually but if I can't get it to work with our designs then we may need to look at something else.

Can I make popup screen or file upload automatically with selenium?

Good morning. I have a web page control with selenium. However, when I click the button of the site, a pop-up screen appears and I want to test that the file attachment is saved by pressing the file attachment button in it. Can you control selenium with two windows (parent, child-popup) going up and down?
I guess you want to interact with file upload dialog which is native window via selenium. That is not possible. However you can select file to upload using sendKeys without the dialog being opened.
Something like that
fileInput.sendKeys("/path/to/local/file");

How to handle external applications in a selenium-test?

I am writing a test that verifies that a warning to the user before the user opens a document. If the user says that they still would like to open the document, the document opens in an external application (pdf or word).
But now I have an external application over the browser window, and it messes up for other tests.
So, what are the best practices around this kind of issue? Rewrite of the appliction to allow for not opening documents in test?
Added description:
The problem is twofold.
1) It starts processes (word and acrobat) that fills the desctop and requires resources from the test-slave
2) The external process seems to interfer with other tests since (guessing here) it is located over the browser window.
what i understood from your post is, the document(word/pdf) is opening in the browser window hence you are not able to proceed with further steps. If so, you can verify the Title to make sure the document is opened in browser window and can navigate back using below snippet.
driver.navigate().back();
Hope this helps.
What I understand from the line
'But now I have an external application over the browser window, and it messes up for other tests.'
is that once user clicks on open button a new window opens up (Window based application) since you have mentioned PDF or Word.
You can use robot class in such cases, below code snippet will close the current active window:
Robot rbt = new Robot();
rbt.keyPress(KeyEvent.VK_ALT);
rbt.keyPress(KeyEvent.VK_F4);
rbt.keyRelease(KeyEvent.VK_ALT);
rbt.keyRelease(KeyEvent.VK_F4);
Make sure you deal with sync issues properly so that intended window is closed instead of AUT.

PDFtron close a tool when doing Frame.GoBack()

Im using PDFtron on a windows store app project.
I have a page with a back button and a pdf viewer where i can edit the pdfs.
When im editing a pdf i have a tool bar with options like the ones in the samples, but i have a issue when i choose a Free Text tool and start writing on the pdf, if i press the back button while the Free Text tool is active ( the cursor is bliking) the text i wrote appears in the screen on the next page i navigate to.
How can i solve this?
The TextBox in question is part of the PDFViewCtrlTools that are used to create annotations. It is shipped with the sample application and is fully open source.
The TextBox is inside a popup, positioned to align itself on top of the PDFViewCtrl in the position where you tapped.
This TextBox needs to be closed before you go back. It is quite easy to do so by calling ToolManager.CreateDefaultTool(). In general, I would recommend taking a look at the samples and see what they're doing when the user tries to navigate away from the page.
Everytime you navigate away from a page with PDFViewCtrl, the ToolManager should call CreateDefaultTool so that whatever current tool is active (in this case the FreeTextCreate tool) can close itself and clean up.

flex 3 screenshot of the scene

i want to snapshot of the flex scene and save it as a image. It likes printscreen button and paste it to paint and save
there will a button save it to desktop and when pressed it, flex will save the screenshot of scene to the desktop, i searched on the net but couldn't find a working code
It looks like there is a way to do it, but it requires some serverside work. Basically the data is sent to the server and the server saves it.
What you would probably want to do since you want the user to have the screenshot is create the files on the server then have it open a web page where they can download and save it.
more information is here http://www.boyzoid.com/blog/index.cfm/2007/9/17/Doing-screenshots-in-Flex-and-sending-them-to-ColdFusion