Run chrome lighthouse's audit from command line - google-chrome

I would like to write a script which run (from the chrome's binary) its lighthouse's audit with a url given.
I didn't manage to find how to do it, but since there is even a chrome extension doing I assume it should be feasible right ?

Google Lighthouse can be ran using the command line. To run it from the command line, you must first install:
Google Chrome for Desktop
Node.js v6 or later.
To install the Lighthouse CLI, open a command line and type the following command:
npm install -g lighthouse
To run an audit with Lighthouse, type:
lighthouse https://example.com
By default, Lighthouse writes the report to an HTML file. You can control the output format by passing flags.
You will notice that a Chrome window is opened every time you run Lighthouse. If you don't want a window to be opened, you can run it in headless mode:
lighthouse https://example.com/ --chrome-flags="--headless"
For the complete list of options, type:
lighthouse --help
Take a look at the Lighthouse source code repository for additional documentation and examples.

You can use/test via npx:
npm i npx -g
Then, directly run from your terminal without using a package.json created or installing globally & without opening a chrome browser instance:
npx lighthouse <URL> --only-categories="performance,seo,Accessibility" --chrome-flags="--headless"

Related

Why is shadow-cljs returning this error message on "Stale Output"? How to guarantee the watch for this building is running?

I am new to Clojure and not a pro in Javascript. I am watching the free part of the course on Reagent.
Following the instructions on the course's repo, after doing the git clone and the npm install, the author indicates running $ npm run dev. Everything seems to work fine. I can see the app on my http://localhost:3000/.
The favicon with the app's logo and its name is loaded on the corner of the browser's tab:
However, on the bottom of the web page, there is this error message from shadow-cljs:
shadow-cljs - Stale Output! Your loaded JS was not produced by the
running shadow-cljs instance. Is the watch for this build running?
Why is this happening? How should I fix it?
How to guarantee that the watch for this building is running?
Is there a simple command to run on terminal to check this?
Obs. 1: If this is relevant, my operational system is NixOS and this is my config file.
Obs. 2: I am not sure if this question is connected to my previous question on npm and Cider (Emacs IDE for Clojure) that happened while working with this same repo.
It is likely that this is due to you running npm run dev AND cider-jack-in.
I don't use emacs, so I'm not exactly sure what cider-jack-in does, but I believe it launches a new JVM. Since the npm run dev also did that you end up with two running JVMs, which also means two running shadow-cljs instances. That is not ideal and they will start interfering with each other leading to errors such as yours.
So, either you run npm run dev and use emacs to connect to that server. cider-connect or whatever is called should do that.
Or you don't run npm run dev at all and instead only cider-jack-in and then start the watch from the REPL.
Don't forget to first kill all java processes that might be running for that project. As long as there is more than one shadow-cljs process running for the project things will be weird.
This happens to me when I clicked on the build link BEFORE it has compiled. In which case, the link is displaying a previously compiled version, not the live version, and "watch" on code changes doesn't work either. Just wait for your terminal output to say "compiled" before clicking on the link.

Disable log4net errors on command prompt while using rotractor/Selenium web driver/Chrome browser

Is there a way to completely disable log4net errors appearing on npm console while running test cases . I am using Protractor and Selenium Web driver. I would like to know if this is possible through Protractor's config file Capabilities.

How can i install Google Chrome to use with protractor during automation CI run

My organization doesn't have Google Chrome natively installed within the Virtual Machines configured for automation CI and it's not allowed to install Chrome globally on those machines.
We are using protractor for automation of angular apps which goes really well with Google Chrome.
Is it possible to install Google Chrome at runtime for execution locally so that we can have smooth execution on those VM's. If yes what and how can i install chrome.
We are using TeamCity for CI/CD. Please help.
Update 29/12/2019: A suggestion, you containerize your app. Which means you need to include the step of chrome installation on when the image in being built on your VM.
Generally such a step is included in the Dockerfile.
more info on how to write Dockerfile: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
Within your angular app, to handle any browser's binary installation, I include it in package.json inside the scripts section:
"webdriver-update": "./node_modules/protractor/bin/webdriver-manager update --standalone --versions.standalone=3.8.0 --chrome --versions.chrome=76.0.3809.68",
This has worked for me in maintaining the dependency on the chrome versions.

Chrome Automation Extension has crashed when trying to run protractor test

I am gaining experience with Protractor and am using the example test to see how it works. The test is located in xampp/htdocs/my-dev/test-automation-playground/poc-basic-integration-flow/node_modules/protractor/
In there we have a conf.js and an example_spec.js. To run the test, we enter the protractor folder using git bash, and type protractor conf.js.
When I try to run the example test provided by Protractor, my browser opens and I get the following error: Chrome Automation Extension has crashed.... See below:
And this is what it looks like in the browser:
I've looking into Chrome extensions and there is no such extension there. What could be causing this issue?
I simply start Git Bash without admin rights and I am not getting this error anymore. Also changing browser to Firefox in config resolves this issue most of the time.

MonoDevelop's debugger and xterm/gnome-terminal

I am using Xubuntu 15.04. I tried to run a basic console app using MonoDevelop, the latest one. I did a new project and this appears when I try to debug it:
Could not connect to the debugger
I googled for answers and I found out that there is a problem with the gnome-terminal, that it no longer accepts the --disable-factory argument and something about unchecking the "Run on external console". I unchecked that and when I press to run, it closed it immediately.
Try executing MonoDevelop as sudo
$ sudo monodevelop
It takes Xterm as output terminal emulator.
EDIT
Run Monodevelop as root can be a BIG mistake.
Best way is to write an script that unsets GNOME desktop session and run monodevelop, as Oskar says.
Try this one (copy and paste it on vim/nano and save as monodevelop.sh)
#!/bin/bash
unset GNOME_DESKTOP_SESSION_ID
monodevelop
Put it on your home (for example) and give it execution permissions:
chmod +x ./monodevelop.sh
When you want to run it, execute ./monodevelop.sh. Or you can add it as GNOME shell application following this guide.