Skip to content

Repository files navigation

Selenium4all

Description

Framework that encapsulates the complexity of browser, driver and selenium configurations. Also adds some useful features like:

  • Automatic screenshot on error
  • Shell report
  • Html report
  • Send report by mail
  • Secrets

Requirements

This will give a your a report like this

image

Or a web report

image

Demo

Clone this repository https://github.com/usil/seleniumjs4all-demo and follow its readme.md

Settings

This file centralize the configurations for all your tests and the framework. Also you can use secrets with envrionment variables

Global configurations

{
"filterByTestName": [],
"virtualUserMultiplier": 1,
"reportWeb": false,
"reportMode": "staticDeep",
"columnNames": ["enterprise", "feature", "scenario"]
}
nameDescriptionDefault ValueRequired
filterByTestNameThe files or directory that you want to test, setting it to an empty array will test all files[]false
filterByRegexTestNameSame of filterByTestName but with regex[]false
reportWebGenerate report on Web(HTML)falsetrue
reportModeChange the type of report keeping its default structure or adjusting the report columnsstaticDeeptrue
columnNamesThe name of the columns that will be related to the directory structure[]true
virtualUserMultiplierIf you want to execute more users. It multiplies the virtualUserSuites.1false

browserOptions

In this section you can pass custom options to the browser that will be used by selenium. Most of those variables should not be touched unless you know what you are doing. The --headless option can be removed to not run in it a non headless mode or "see as human" how automation moves your browser

"browserSettings": {
"options" : {
"addArguments": [
"--log-level=1",
"--no-sandbox",
"--disable-gpu",
"--disable-dev-shm-usage",
"--headless",
"--window-size=2200,1600"
]
}
}
nameDescriptionSample ValueRequired
browserSettings.options.addArgumentsWellknown parameters to customize your browser. Full details here[]false
browserSettings.useLocalBrowserWill use the default browser in the os and will infer the drivertruefalse
browserSettings.browserBinaryCustomLocationFull location of the browser (chrome or firefox) executable.C:\Program Files\Google\Chrome\Application\chrome.exefalse
browserSettings.browserDriverCustomLocationFull location of the driver (chrome or firefox) executable./opt/driver/geckodriverfalse

If you have problems with the chrome binary or chrome driver location, check:

virtualUserSuite

In this section you can add variables to be used at the unit test level.

nameDescriptionDefault ValueRequired
virtualUserSuitesThe number of whole test suites you want to simulate and its specific configurations and variables, each test virtual user suite represents 1 user.virtualUserSuite arraytrue
virtualUserSuites[0].identifierAn identifier for this test suiteWill default to the position in the arraytrue
virtualUserSuites[0].skipThe app will skip this test suitefalsefalse
virtualUserSuites[0].variablesGlobal variables for all of the test of this suite
virtualUserSuites[0].filterByTestNameThe files or directory that you want to testnullfalse
{
"virtualUserSuites": [
{
"skip": false,
"identifier": "first-test",
"filterByTestName": [],
"variables": {
"acmeBaseUrl": "https://acme.com"
}
}
]
}

Mail settings

Useful if you want to enable an email generation with the html report attached.

{
"smtp": {
"enableSmtpNotification": "true",
"disableMailNotificationOnSuccess": "true",
"smtpHost": "10.10.20.30",
"smtpPort": "587",
"smtpUser": "admin",
"smtpPassword": "changeme",
"smtpSecure": "true",
"smtpTlsCiphers": "SSLv3",
"smtpSenderDisplayname": "a custom alias of sender",
"smtpRecipients": "jane@acme.com"
}
}
VariableDescriptionDefault Value
enableSmtpNotificationIf you want to send mail with report, this variable should be equals to true
disableMailNotificationOnSuccessIf the test result is successful and this parameter is equal to true, the report will not be mailed.
smtpHostSender identifier
smtpPortCommunication endpoint that defines the routing of email transactions
smtpUserUser of your mail server
smtpPasswordPassword of your mail server
smtpSecureEncrypt.
If your host is for gmail, your value should be true.
If your host is for office 365, your value should be false
true
smtpTlsCiphersAre algorithms that help secure network connections that use Transport Layer SecuritySSLv3
smtpSenderDisplaynameIt is the alias of the transmitter
smtpRecipientsRecipient report for mail, It can be multiple and separated by '', ''

Shell variables

You can overwrite the files option adding FILTERED_FILES to your environment variables, separating the files or directories by an space.

In an .env file:

FILTERED_FILES = test1.test.js test2.test.js

In linux:

export FILTERED_FILES="test1.test.js test2.test.js"

In windows:

setFILTERED_FILES="test1.test.js test2.test.js"

External settings

You can have a settings.json outside of the workspace. Check this

More settings

Check the wiki https://github.com/usil/seleniumjs4all/wiki


Contributors


JRichardsz

Diego Ramos

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages