Protractor: ERROR loading configuration file - javascript

After installing protractor and starting selenium webdriver, I have a problem about run config.js file on example folder on protractor: ERROR loading configuration file config.js, as in the below picture:
The config.js file is a default file on example folder. I didn't change anything.

For Protractor 3.2.2, within the Protractor folder there is a folder called example which contains conf.js. You need to cd to the example folder and then run the command protractor conf.js.

This problem is your command cannot find file config.js. Need to run command exactly folder.

It is throwing up the following error in the dialog box
Failed to load extension from : C:\Users....\Appdata\local\Temp\scoped_dir7816_9439\internal.Lodaing of unpacked extensions is disabled by the administrator

Related

How to get output of the JS file using VS Code

When I run the code, nothing shows in "Output" tab. I installed nodejs as well as Code runner extension. How to fix this issue?
enter image description here
I want to get the output of my code.
Install Node.js from https://nodejs.org.
open VS Code.
from the file tab at the top, choose open folder.
navigate to your working directory where your project is open.
from the terminal tab at the top, choose new terminal.
in the terminal, write the following command:
node sample_1.js
replace the sample_1.js with your file name
This is the top menu
and this is the terminal:
--
and you don't need a code runner extension, every time you want to run your JavaScript code, write the command
node YOUR_FILE_NAME.js
Otherwise, if you want something to automatically detect the changes you make to your file and automatically run the code when you save the file, you'll need a package like nodemon.
to install nodemon, in the same working directory, open up the terminal and write the following commands:
npm init -y
and then:
npx nodemon sample_1.js
replace the sample_1.js with your file name
Nodemon will keep running in the background and every change you make to any of your files in your working directory will make nodemon reload, and you'll see the changes in the terminal immediately.
I fixed that issue. I installed JavaScript Debugger(Nightly). After that now OUTPUT tab shows output of the js file.
https://marketplace.visualstudio.com/items?itemName=ms-vscode.js-debug-nightly

Cypress - install it on empty project

I am trying to install cypress on an empty project. However, cypress is not installed in the package.js file and cypress is not included on the project. How can I make it work? I cannot install cypress as part of the development project, so i am trying to create a separate test automation project with cypress.
Steps to install cypress:
Step 1: Create your project folder, go inside the folder from the terminal using cd folder_path/folder_name and run npm init. This will create your package.json file inside your project folder. You can do this in a sperate project or create some folder in your development project and do it there as well.
Step 2: Now, Run the command npm install cypress --save-dev. This will add the cypress as a dev dependency inside your package.json file. Once you have successfully installed this, you should see one more file package-lock.json and an folder node_modules being created
Step 3: Run the command node_modules/.bin/cypress open or node_modules/.bin/cypress run to run cypress.
You need to add --save or --save-dev to save it to package.json file. eg: npm install cypress --save. https://docs.npmjs.com/cli/v6/commands/npm-install
Normally you install Cypress into your dev project, but I see you can't do that.
Go to https://www.cypress.io, middle of the page is Download now.
After downloading, unzip to a folder, open bash or cmd prompt in that folder and type Cypress.
You get some warnings about installing into your project being preferred, but it works fine.
There's a To get started... box on the runner. Choose the same folder, and Cypress will set up the testing folder structure
/cypress
/integration
/examples -- lots of sample tests here
/support
/plugins
/fixtures
etc

Protractor - 'More than one config specified' error when tests are run via npm run but only if --capabilities.chromeOptions.binary param is used

I have a problem with running protractor scripts defined in package.json on Windows 10 machine - locally and on virtual machine.
I have package.json and protractor.conf.js with standard content.
Protractor script in package.json looks as follows:
"run-tests": "protractor protractor.conf.js --baseUrl=https://some-website --capabilities.chromeOptions.binary='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'",
However, when I run it with npm run run-tests I receive error:
Error: more than one config file specified
Removing --capabilities.chromeOptions.binary param fixes the issue, but I do need it on my virtual machine.
Similarly, when I execute the full command directly in terminal tests are run without a hitch, i.e.:
protractor protractor.conf.js --baseUrl=https://some-website --capabilities.chromeOptions.binary='C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'
I noticed that when I use npm run backslash characters in the path displayed in terminal are already escaped:
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
However, even quadrupling backslashes i.e. writing:
'C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe'
does not help with the problem.
Do you have any ideas? Or do you perhaps know alternative method to pass the said value to binary param in protractor.conf.js?
Edit: running terminal in administrator mode does not help either.
Ok, I found the solution here:
Protractor option does not work in package.json script
Basically you have to use escaped double quotes enveloping path to file. So it goes like this:
"{some other stuff} --capabilities.chromeOptions.binary=\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\""

How does this javascript import of kurento-utils get recognized?

On this line:
https://github.com/Kurento/kurento-tutorial-java/blob/master/kurento-player/src/main/resources/static/index.html#L24
This javascript file is imported. However, there is no file called "kurento-utils.js" in this package. So how does this work? Is this some magic of bower?
Where does that file come from and how can I get it to be accessible in my code?
When I run this code, I get:
(index):281 Uncaught ReferenceError: kurentoUtils is not defined
Thank you!
Where is no magic:
git clone https://github.com/Kurento/kurento-utils-js
cd kurento-utils-js-master
npm install
To build the browser version of the library you'll only need to exec the grunt task runner and they will be generated on the dist folder. Alternatively, if you don't have it globally installed, you can run a local copy by executing:
node_modules/.bin/grunt
(for windows i run grunt.cmd)
cd kurento-utils-js-master/dist
Here we are
copy kurento-utils.js in your resource folder

Can't run a javascript file through node.js

I'm trying to figure out node.js and nothing is working. I can run code using node.js via writing it in the terminal, but I want to run an external js file.
Right now, I have my node.js installed here "C:\Program Files\nodejs\node.exe"
I then made a js file and wrote console.log("Hello World"); and saved it in the same location and called it test.js.
I then opened up a command prompt and tried everything to try run it but nothing works.
The PowerPoint my teacher gave to me says to do "node test.js" and it should output Hello World.
When I try it, it says error cannot find test.js, so I wrote the full file path and it says, c:\program is undefined or something. Can someone please tell me what to write in the command prompt so I can output Hello World via the test.js file I've got saved in the same location as node.exe?
I am using windows if that helps.
You need to put test.js your current directory. If you just open CMD, your current directory defaults to your user directory. Instead of putting your js file next to the node.exe, you have to put it in the directory your cmd is in.
Example:
create test.js in C:\Users\yourname\Documents\test.js
then open CMD and cd C:\Users\yourname\Documents\ to set your CMD's current directory to your documents folder.
From there, node test.js will run the test.js file you have in C:\Users\yourname\Documents\

Categories

Resources