The original webui automation tests were run in chrome headless mode in a Linux environment, but downloading the relevant case is currently not well supported (see bug: https://bug)S.chromium.org/p/chromium/issues/detail?Id=696481), so choose to run the download-related case in non-headless mode, using the xvfb tool.
When you install xvfb and start it, you need to add the following when manually adjusting the code.
1. When setting up xvfb, set screen size: nohup /usr/bin/Xvfb: 7 -ac -screen 0 1280x900x8 &
2. Set temporary environment variables: export DISPLAY=: 7
3. Add chrome option: chromeOption.addArgument (“–no-sandbox”);
4. Add window size: options.addArguments (“window-size=1280900”)
5. Maximize windownot applicable
After this setup, the command line running case can run normally.
Then put it under Jenkins and start it up, and you can’t run at all, even if you set the temporary environment variable. Check it out because you need to install the xvfb Jenkins plug-in. After installing the plug-in, there are corresponding check options in the build environment column. The advanced settings have detailed configuration, if yesScreen size must be set up.
The default name of the Xvfb installation is actually set in the Jenkins global tool configuration:
If job is run through pipeline script, the syntax is as follows:
node{ wrap([$class: 'Xvfb', additionalOptions: '', assignedLabels: '', autoDisplayName: true, displayNameOffset: 0, installationName: 'Xvfb', screen: '1280x1024x8']){ /**steps**/ } }