JETTY- HTML Publisher - Jenkins - Extent Reports - Images are broken 404 not found - selenium

The extent report that I generate running a Java Selenium project on a CentOS machine with jenkins it is showing partially correct.
The issue comes when trying to view the screenshots that I have attached into the extent report on Jenkins on png format
I am using HTML Publisher plugin on the latest version
I have already set this command on the jenkins command line
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
Extent Report on Jenkins
The strange thing is when navigating directly on the CentOS file explorer and going to that path inside the jenkins workspace and opening the html report it is showing correctly as expected
Extent Report opened inside CentOS explorer
Has someone faced this issue before?
Edit:
This is the way I have the report inside a folder, including the jpg or png images at the same level of the html report files at same level of html report
EDIT: I have found a new important information for the issue. I contacted a security teammate and he told me this was related to a configuration issue since port 8080 is listening correctly.
Since Jenkins standalone is using a Jetty Http server it might be an issue with this.
Entering the jenkins logs I got this new information filtering the Jetty logs:
JETTY LOGS
Now I am working on troubleshooting this with the information with the logs

When requesting image not found, the file not allowed
Update your Jenkins Content Security Policy. With type into console the following commands:
System.clearProperty("hudson.model.DirectoryBrowserSupport.CSP");
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-scripts; default-src *; img-src * data: ;");
Go to Manage Jenkins -> Script Console on your jenkins

Related

Selenium test on jenkins linux slave failed as Expected enabled element was not enabled

I need a help on identifying a selenium testing issue on jenkins slave.Initially the chrome browser was not launched and we found the chrome driver version is not matching with chrome browser version. After we fixed that now we are getting error as Expected enabled element was not enabled
From Jenkins Console Log
But we are able to load the payload html page and able to see the element as like below
From HTML File
From browser
Same code is working fine in other jenkins servers. So why it is stating as the element is not visible even though we are able to see in payload html? Is there any additional settings we have to do from jenkins slave?
Could you please guide me.

Cannot see Application server in Tomcat Server

I am building a web app from scratch in Intellij Ultimate version, I can see there the Tomcat and EE is enabled in plugin, as per below:
enter image description here
but when I go to Add configuration, the Application server is blank, and cannot see either when click the dropdown list, does that mean I dont have tomcat installed:
enter image description here
anyone else had the similar issue?
Confirmed with JetBrain that Integration for tomcat is pre-installed in the IntelliJ IDE. However the Tomcat itself - is not. Thus, I need to download Tomcat from https://tomcat.apache.org/download-10.cgi and define the path in IntelliJ IDEA. All good now, I had configured my tomcat and working as expected now.

Push service shows up as inactive on the map console

I installed IBM Mobile First 8.0.0. I deployed Push service and the tables are also created. In the mobile first console the push service is showing as inactive. On inspecting the element in the chrome error window it points to GET URL returning 404. When i paste the URL in the browser and execute, it returns the live update adapter is not available and the database may be corrupted
Any help in this regard is highly appreciated
If you installed the MobileFirst DevKit, then this shouldn't happen since everything is built-in. Try reinstalling in this case.
If this is a production or test environment installation using the IBM Installation Manager and Configuration tool, then you may have specified an incorrect path of the push services .war file. You can confirm this by comparing the various paths that are defined in the application server's server.xml file.

Jenkins Execution Issue

A selenium script , when executing from Eclipse in a local machine , clicks an UPLOAD button in browser to upload some files from local machine to that application running in browser.
This uploading part is failing when the script is executing from Jenkins because Jenkins server is unable to access local machine.
Any idea how to overcome this issue..??
Accessing these files from the server is a bad idea (unless it's a Jenkins's slave) though can be achieved via your code or some CMD tool, with providing the address and credentials. Put some effort in this and you'll find how to do it...
The better solutions will be adding these files to the Jenkins server as well or committing these files to your repository and checkout them before the test.
A shared folder could also do the trick on a filer type server or similar.
Hope it helps. Anyway there's no substitute to your own research e.g. Google and StackOverflow.

Does IntelliJ have an internal web server to serve static content of a web application?

Right now, the directory of my module is defined as an IIS virtual directory and IIS serves the files.
I was wondering whether IntelliJ has an internal web server, which can serve the files, without the need for any third party. Eclipse does.
UPDATE: built-in web server is available in the recent IntelliJ IDEA versions (starting from 13). You can find more details in the blog (yes, this feature first appeared in WebStorm).
IntelliJ IDEA has no this feature, you need to install and use any third-party web server that can serve the content from the project folders.
A built-in HTTP preview server will be part of Intellij IDEA 13 and is already available in the EAP: http://youtrack.jetbrains.com/issue/WEB-7148
"All existing actions — preview in browser (pop-up over html file or menu action or
shortcut), open in browser and create/debug html file action now open file on built-in web
server
http://localhost:63342/<project name>/<file path relative to source or content root>"
In other words, right-click on an HTML page and select "Debug" or "Open in browser", and IDEA 13+ will serve up that page via port 63342.
Here's another super simple option, install Python: http://www.python.org/getit/
Then open a shell prompt, navigate to your root web folder (e.g. public) and run python -m SimpleHTTPServer - This starts an HTTP Service on port 8000.
Further reading should you need it: http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python
I've got mine running on Windows 7 but the above article still applies.
Another option is is create a PHP project that, starting with v 5.4.0 of PHP includes a built in web server. This page explains it all ...
http://www.jetbrains.com/idea/webhelp/php-built-in-web-server.html
IntelliJ IDEA has a built-in web server that can be used to preview and debug your application. Just watch this YouTube video or follow the steps below.
Option 1
You need to add new 'JavaScript Debug' configuration:
Click Add Configuration... or Edit Configurations... in the Navigation bar
Click button in the toolbar or press Alt + Insert to create a new configuration
Select JavaScript Debug under the Templates node in the tree view of run configurations
Fill in Name, URL, Browser and click [OK] to save the configuration
Use http://localhost:63342/YOUR-PROJECT-NAME/index.html for URL
Now you can run the configuration:
Click run or debug button in the Navigation bar (or use Shift + F10 / Shift + F9 hotkeys).
Option 2
Running web page in browser without creating a configuration. Refer to the related IntelliJ IDEA Help article.
In the editor, open the HTML file. This HTML file does not necessarily have to be the one that implements the starting page of the application.
Do one of the following:
Choose View | Open in Browser on the main menu or press Alt+F2. Then select the desired browser from the pop-up menu.
Hover your mouse pointer over the code to show the browser icons bar: . Click the icon that indicates the desired browser.
Result
Google Chrome browser with a demo web page served by the Intelij IDEA's built-in webserver:
One simple way is to create a NodeJS / Express project in IntelliJ that is your web server. You can then use it to serve your static web pages and any other web content. The NodeJS web server is very small and runs fast - noticeably faster than IIS and Apache. Best of all you can just hit the Run button in IntelliJ or WebStorm to start it up.
By default, a NodeJS / Express project includes a public/ directory that you can use to contain your static pages that you can then view from http://localhost:3000/
This explains the steps required to enable NodeJS in IntelliJ and includes links to other Node resources:
http://www.jetbrains.com/idea/webhelp/node-js.html
If you feel the need, you can reconfigure your NodeJS server using server side Javscript code. You can add SSL support or almost any other server side features you care to dream up. Just add NodeJS modules using the npm (Node Package Manager) command line tool included with the install. NPM Registry https://npmjs.org/ indexes all the available modules.
You can configure IntelliJ to use a lot of different application containers, but each of them must be downloaded and installed separately. I currently have mine configured to serve via jetty, like eclipse, and also tomcat, tc-server, jboss, and node.js. It's pretty easy to set up.