Choose an image file to be uploaded for testing in Nightwatch on CircleCI

Currently, I am utilizing Nightwatch.js tests with test runs on a docker container in CircleCi.

During the Nightwatch test on CircleCi, I am facing the challenge of uploading an image from the file system to my service. After some research, I came across this solution:

.setValue('input[type="file"]', require('path').resolve('/home/My-PC/Desktop/img.png'))

However, this method only seems to work from the local machine. Can someone provide guidance on how to upload my file on CircleCi service and what path should be used? Alternatively, if there are any workarounds available, please share. One idea I had was to upload the file to Dropbox and then download it during the test run, but I am unsure about how to implement this with Nightwatch and which path to use to locate the downloaded file.

Answer №1

The reason why I was unable to use a publicly accessible file in my case is because the only option for nightwatch setValue is to upload a file from a file storage.

To solve this issue, I followed the steps outlined in this resource.

What I did was create my own docker image with the necessary files and then published it on Docker Hub. Finally, in the CircleCi config file, I specified the use of this custom image.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for meeting a JavaScript door unlocking condition with an HTML button

In this tutorial, the https://www.w3schools.com/nodejs/nodejs_raspberrypi_webserver_websocket.asp link demonstrates an event handler that works based on an HTML checkbox. I am interested in achieving a similar functionality, but with a button instead, to t ...

Updating the Chromedriver version in PyCharm for use with Selenium and RobotFramework can be easily achieved by following

Currently, I am using PyCharm to execute my robot framework-selenium scripts and encountering a particular issue. SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 91. The current browser ...

Is it possible for Sequelize to utilize a getter or setter within a find query?

When it comes to storing and querying email addresses in my database, I always opt for lowercase strings to prevent duplicate emails such as <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="077274627547627f666a776b62d48ed88e5"> ...

Transforming an R object into a suitable format for the tree layout in d3.js

Following up from a previous question regarding converting ctree output to JSON format for D3 tree layout, I have the following code generated by the use of ctree (from Party package) and I aim to create a recursive function to transform the JSON output. ...

Utilizing AngularJS to selectively filter objects based on specific fields using the OR operator

My collection includes various items with different attributes. For instance, here is the information for one item: {"id":7,"name":"ItemName","status":"Active","statusFrom":"2016-01-04T00:00:00","development":"Started","devStartedFrom":"2016-01-04T00:00:0 ...

Using JavaScript, append a variable to the existing URL

At the moment, I am using this JavaScript code snippet to load a URL based on the dropdown selection... var orderby = jQuery('#dropdown'); var str; orderby.change(function(){ str = jQuery(this).val(); window.lo ...

How to effectively manage Mongoose Query Exceptions in Express.js

Let's imagine a scenario where I need to execute a Mongoose query in an Express post route: app.post("/login",(req,res)=>{ const username = req.body.username const password = req.body.password User.find({username:username},(er ...

AngularJS $scope variable issue

After searching online, I found this code snippet that I tried to implement, but unfortunately, it's not displaying any data. Below is the HTML code: <html data-ng-app=""> <head> <title>Example 4: Using AngularJS Directives an ...

Developing a personalized file upload button in React

I have been working on creating a custom <input type="file"> upload button in React. My goal is to display the name of the uploaded file on the button itself after the upload. I encountered some challenges while trying to create a codepen demo, so I ...

Issue with Global Variable Not Being Updated in Javascript

In my code snippet below, I am struggling to update a global variable within a callback function. function FunctionOne() { var result = ""; for (var i = 0; i < 10; i++) { AjaxFunction(function (data) { result += data; ...

There seems to be an issue with the way Meteor and React are displaying data

Having trouble displaying paint data in my code - all I see is [object,object]. Tried using .toString() without success. Any assistance would be appreciated. I understand that this indicates objects inside arrays but unsure how the array is generated or h ...

Unable to retrieve data from the JSON object

I'm struggling to extract the data value from a JSON object. Let me share my code snippet: var ab_id = $( "#ab_id" ).val(); $.ajax({ type: 'GET', contentType: 'application/json', url: 'edit_account.php', ...

Issue: Upon attempting to connect to a vsftpd server deployed on AWS using the npm module ssh2-sftp-client, all designated authentication methods have failed

Code snippet for connecting to the vsftpd server sftp.connect({ host: "3.6.75.65" port: "22" username: "ashish-ftp" password: "*******" }) .then(() => { console.log("result") }) .catch((err)=>{ ...

When using a function linked to an API request, an uncaught TypeError is thrown: Unable to access the 'includes' property of an undefined value

Utilizing the movie DB API (), I am displaying the results of my call on my page using Vue. The API supplies all the necessary data for me to achieve my objective, as demonstrated in this image https://i.stack.imgur.com/vP4I2.jpg Beneath each show's ...

Utilize D3 to Rotate Text within an SVG in Circular Motion, Following by Self-rotation

In my visualization, the labels are arranged around the center of a circle by rotation. However, this results in the labels on the left side of the circle appearing upside down. Is there a way to rotate the labels on the left side independently after the i ...

Is it acceptable to use the return value of false in order to resolve the ESLint consistent-return error when working with asynchronous functions

When working with ExpressJS, I encountered a situation where I needed to execute and adhere to ESLint rules in my code. One particular rule that caused an issue is "consistent-return", which flagged the following code snippet: function getUsers( req, res, ...

Using AngularJS to dynamically modify filter choices

Seeking something similar to this example in the documentation, but with a unique input that can serve as a filter for "any", "name", or "phone" properties. The role switching is triggered by clicking an anchor tag. Check out the code snippet here: http:// ...

What is the best way to make a canvas element always follow the movement of the mouse cursor

Currently, I am delving into the world of HTML5 canvas and experimenting with a program that rotates a triangle to face the location of the mouse pointer. The functionality is mostly there, but it seems to skip half of the intended rotation. I am curious i ...

How to Use JQuery to Capitalize the First Letter of Every Word in a Sentence

How can I capitalize the first letter of each word in a text field using JQuery? I've been struggling to achieve this. Here is the Bootstrap code that I'm currently using to extract data from a text field when a button is submitted <button cl ...

What is the best way to choose elements that are currently visible using selectors?

Hey everyone, I have a question regarding XPath. The issue is related to identifying visible elements only. Previously, there was a solution provided for selecting visible elements using the XPath expression: //div[not(contains(@style,'display:none&ap ...