{"id":19857975,"url":"https://github.com/boldare/testing-framework","last_synced_at":"2025-05-02T02:30:44.473Z","repository":{"id":57402291,"uuid":"92920447","full_name":"boldare/testing-framework","owner":"boldare","description":null,"archived":false,"fork":false,"pushed_at":"2018-10-17T12:58:07.000Z","size":369,"stargazers_count":13,"open_issues_count":10,"forks_count":1,"subscribers_count":52,"default_branch":"master","last_synced_at":"2025-04-06T21:08:29.416Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boldare.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-31T07:59:21.000Z","updated_at":"2023-01-24T14:50:24.000Z","dependencies_parsed_at":"2022-09-17T06:43:20.725Z","dependency_job_id":null,"html_url":"https://github.com/boldare/testing-framework","commit_stats":null,"previous_names":["xsolve-pl/testing-framework"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boldare%2Ftesting-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boldare%2Ftesting-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boldare%2Ftesting-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boldare%2Ftesting-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boldare","download_url":"https://codeload.github.com/boldare/testing-framework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251972432,"owners_count":21673602,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T14:20:34.240Z","updated_at":"2025-05-02T02:30:43.459Z","avatar_url":"https://github.com/boldare.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About\n\n**XSolve Web Testing Framework** is test framework above Selenium Webdriver and Cucumber written in JS (Node).\nNPM: https://www.npmjs.com/package/xsolve_wtf\n\nMain goals:\n\n  - Easy to use, high-level methods\n  - All needed waits built-in\n  - BDD Layer (Gherkin)\n  - Reports useful from both business and developers point of view (Gherkin scenarios, Screenshots, Driver logs, Proxy logs)\n  - Headless execution support\n  - Parallel execution (not in first release)\n  - Multiple driver configs and devices support (not in first release)\n\n# Table of Contents\n\n  - [About](#about)\n  - [Table of Contents](#table-of-contents)\n  - [Requirements](#requirements)\n  - [Project Setup](#project-setup)\n  - [Installation](#installation)\n  - [Running](#running)\n  - [Runner](#runner)\n  - [Required changes](#required-changes)\n  - [Methods](#methods)\n  - [Config](#config)\n  - [TODO](#todo)\n\n# Requirements\n\n  - Linux (currently, support for other systems may be added later)\n  - Node.js (v6.X or newer)\n  - NPM 3.X or later (older versions can't be used because of different `node_modules` directory structure)\n  - Selenium Server (recommended 3.X)\n  - BrowserMob Proxy (v2.1.X or newer)\n\nOptional:\n\n  - Xvfb (for headless execution)\n\n# Project setup\n\nThere are currently few requirements according to the directory and files structure.\n\n## config.json\n\n`config.json` file must be created in the main project directory. Example `config.json` file can be found in Config section of this doc.\n\n## cucumber runner - config (optional)\n\nIf you want to run tests without using `xsolve_wtf.js` runner using `cucumber.js` command `cucumber.js` require parameters must be passed to cucumber:\n\n```javascript\n--require node_modules/xsolve_wtf/dist/ --require features/\n```\n\nIt is also possible to create `cucumber.js` file in main project directory - adding parameters directly won't be needed then.\n\n```javascript\nmodule.exports = {\n  \"default\" : \"--require node_modules/xsolve_wtf/dist/ --require features/\"\n};\n```\n\n# Installation\nDescribed for Ubuntu 16.04 LTS.\n\n## Node.js and NPM\nInstall Node.js and NPM from NodeSource.\n`curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh \u0026\u0026 sudo bash nodesource_setup.sh \u0026\u0026\nsudo apt-get install build-essential nodejs`\n\n## Java\nOracle Java may be needed because of the BrowserMob Proxy (OpenJDK may not work correctly).\nYou can install it and set as default version using:\n`sudo apt-get install python-software-properties \u0026\u0026 sudo add-apt-repository ppa:webupd8team/java \u0026\u0026 sudo apt-get update \u0026\u0026 sudo apt-get install oracle-java8-installer`.\n\nVerify Java version using `java -version` and change if needed using `sudo update-alternatives --config java`\n\n## Selenium Server\nDownload Selenium Server Standalone using wget (here version 3.4.0):\n`wget https://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar`\n\nor manually from Selenium website: `http://docs.seleniumhq.org/download/`\n\n## Selenium Drivers\nDownload Driver you want to use (Chromedriver recommended, other driver weren't tested yet).\n\n### Chromedriver\nDownload latest version from `https://sites.google.com/a/chromium.org/chromedriver/`.\nYou can use wget for this:\n`wget http://chromedriver.storage.googleapis.com/2.30/chromedriver_linux64.zip` (here version 2.30, x86-64)\n\nUnzip (if needed install Unzip using `sudo apt-get install unzip`):\n`unzip chromedriver_linux64.zip`\n\nCopy chromedriver binary to `/user/bin` or `/usr/local/bin`:\n`sudo cp chromedriver /usr/bin`\n\nCheck if Chromedriver is visible: `chromedriver --version`.\n\nNot only Chromedriver is needed - Chrome browser also has to be installed. Verify chrome installation with `google-chrome --version`.\n\n## BrowserMob Proxy\nDownload BrowserMob Proxy using: `wget https://github.com/lightbody/browsermob-proxy/releases/download/browsermob-proxy-2.1.4/browsermob-proxy-2.1.4-bin.zip`\nor manually from project page: `http://bmp.lightbody.net/`.\n\nUnzip: `unzip browsermob-proxy-2.1.4-bin.zip`\n\n## Xvfb (optional)\nIf you want to run tests on headless server you would also need Xvfb.\n`sudo apt-get install xvfb xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps imagemagick`\n\n## XSolve Web Testing Framework\nAssuming you have `xsolve_wtf` dependancy in your `package.json` file just run `npm install` - framework and all needed dependencies will be installed (cucumber etc.).\n\n\n# Running\n\n## Start Selenium Server\nSelenium Server must be running during test execution:\nIf you want to run Selenium Server on default port (4444):\n`java -jar selenium-server-standalone-3.*.jar`\n\nYou can also set custom port running with `-port` parameter:\n`java -jar selenium-server-standalone-3.*.jar -port 4444`\n\n### Xvfb\nIf you want to run headlessly you must create virtual display and set it as default BEFORE running Selenium Server.\nYou can create display using:\n`/usr/bin/Xvfb :99 -ac -screen 0 1920x1080x24 \u0026` (here display number 99 with resolution 1920x1080)\nThen you have to set display you want to use (99 in this case):\n`export DISPLAY=:99`\n\nIf you want to return to \"normal\" display you have to set value to `:0`:\n`export DISPLAY=:0` and rerun Selenium Webdriver if needed.\n\n## Start BrowserMob Proxy\nBrowserMob Proxy also must be running during test execution. You can run proxy by running:\n`bin/browsermob-proxy -port 8888` from inside BrowserMob Proxy directory.\n\n## Run tests\nTests can be run using:\n`node_modules/xsolve_wtf/bin/xsolve_wtf.js`\n\nMore detailed information about Runner is available in [Runner](#runner) section.\n\n# Runner\nRunner is now available (0.4.X and newer versions) - it should be used instead of directly using cucumber runner.\n\n## Cucumber parameters\nYou can pass \"normal\" cucumber parameters - specify .feature files etc. using `--cucumber` or `-c` parameter.\n\n`node_modules/xsolve_wtf/bin/xsolve_wtf.js -c \"feature/example.feature\"`\n\nIf you want to use quotes (`\"`) inside you have to escape them.\nIt's possible to insert `--tags` cucumber parameter here too but it's better to use [Tags](#tags) - it's not needed to escape all quotes then.\n\n## Tags\nTags can be used using `--tags` or `-t` parameter.\n\n`node_modules/xsolve_wtf/bin/xsolve_wtf.js --tags @disabled`\n`node_modules/xsolve_wtf/bin/xsolve_wtf.js --tags \"@test and not @disabled\"`\n\nMake sure to use Cucumber Tag Expressions, not old-style Cucumber tags - there are not available anymore since Cucumber 2.X.\nhttps://docs.cucumber.io/tag-expressions/\n\n## Runner - help\nHelp can be displayed using `--help` or `-h` parameter.\n\n`node_modules/xsolve_wtf/bin/xsolve_wtf.js --help`\n\n## Runner - framework version\nFramework version can be displayed using `--version` or `-v` parameter.\n\n`node_modules/xsolve_wtf/bin/xsolve_wtf.js --version`\n\n\n## Cucumber runner\nIt's still (0.4.X version) possible to run tests using directly cucumber runner but it's not recommended.\n`node_modules/cucumber/bin/cucumber.js`\n\n# Required changes\n\n## 0.4.X version\nConfig file structure is the same as in 0.3.X version but config file is now validated. You have to make sure it's correct according to the rules. All required parameters must be available and also all custom values must be placed in `user` or `custom`.\n\n## 0.3.X version\n\nConfig file was changed in comparison to 0.2.x version - `config.json` must be used now instead of `config.js`. Example config can be found in Config section.\n\nDeprecated loadPageByRoute and validateUrlByRoute methods were removed - pageUrlDate file isn't required anymore. It should be used on user side now - methods can be just copied from xsolve_wtf.js file.\n\n# Methods\n\n## World\n\nWorld contains all basic methods needed for development of functional tests of websites. Driver is available too so it is possible to use all low-level Webdriver methods. All methods that need if contain build-in waits (timeouts configurable in config file), custom timeout can be set too.\n\n### Actions\n\n#### click(xpath, customTimeout)\nClicks element identified by xpath.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### getCurrentUrl()\nReturns current Url\n\n#### hover(xpath, customTimeout)\nHovers mouse cursor over element.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### loadPage(url, customTimeout)\nLoads page by URL.\n\n`url` page URL\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### fillInInput(xpath, value, blur, customTimeout)\nFills in input with value.\n\n`xpath` string with element xpath\n\n`value` string with text value\n\n`blur` (optional) - blur support\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### findElement(xpath, customTimeout)\nJust like Webdriver findElement with wait.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### findElements(xpath, customTimeout)\nJust like Webdriver findElements with wait.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### selectFileInputValue(inputXP, fileName, customTimeout)\nSets file input value.\n\n`inputXP` string with file input element xpath.\n\n`fileName` fileName that would be set\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### setCheckboxValue(xpath, value, customTimeout)\nSets checkbox value.\n\n`xpath` string with element xpath\n\n`value` checkbox value\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n### Validators\n\n#### getCheckboxValue(xpath, customTimeout)\nReturns checkbox value.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### getElementsNumber(xpath, customTimeout)\nReturns number of elements.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### getElementText(xpath, customTimeout)\nReturns element text.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### validateCheckboxValue(xpath, value, customTimeout)\nValidates if checkbox is set to expected value.\n\n`xpath` string with element xpath\n\n`value` expected value\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### validateElementDisplayed(xpath, customTimeout)\nValidates if element is displayed (not only visible in page source - visible in sources AND displayed).\nMay be browser-specific because of the driver differences.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### validateElementNotDisplayed(xpath, customTimeout)\nValidates if element is not displayed (visible in sources and not displayed).\nMay be browser-specific because of the driver differences.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### validateElementText(xpath, text, customTimeout)\nValidates if text of element is equal to expected.\n\n`xpath` string with element xpath\n\n`text` expected text\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### validateElementVisible(xpath, customTimeout)\nChecks if element is visible in page source. May not be displayed.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### validateElementNotVisible(xpath, customTimeout)\nChecks if element is not visible in page source.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### validateElementsNumber(xpath, number, customTimeout)\nValidates if number of elements is correct.\n\n`xpath` string with element xpath\n\n`number` expected number of elements\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### validatePageReadyState()\nValidates if the page load is complete. `extendedPageReadyStateValidation` may be enabled in config file for extended validation (currently only Angular support implemented).\n\n#### validateUrl(url, customTimeout)\nValidates url by url text.\n\n`url` url string\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### validateUrlByRegex(regex, customTimeout)\nValidates url by regex.\n\n`regex` regex\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n### Other\n#### getDriver()\nReturns current driver. May be used for direct driver access when low-level driver methods are needed.\n\n#### getInstanceNumber() (NOT YET IMPLEMENTED)\nReturns number of instance in case of parallel execution.\n\n#### logError(errorMessage, noThrow)\nError logger.\n`errorMessage` message\n`noThrow` (optional) - can be set if error message should only be displayed and not thrown.\n\n#### logMessage(logMessage, detailedOnlyLog)\nMessage logger - writes custom messages for steps.\n`logMessage` message\n`detailedOnlyLog` (optional) - can be set if message should be only shown if config `detailedTestLog` is enabled.\n\n#### sleep(sleepTime)\nStatic sleep.\n\n`sleepTime` sleep time (ms)\n\n#### cleanBrowserState\nCleans browser state - Cookies, localStorage, sessionStorage and console logs.\n\n#### takeScreenshot(fileName, directory)\nTakes screenshot.\n\n`fileName` screenshot file name (without extension - would be saved as .png).\n\n`directory` directory where screenshot would be saved.\n\n#### getCurrentDate()\nReturns current date in `YYYY-MM-DD_HH-MM-SS-mmm` format (for example `2017-06-26_13-53-51-122`)\n\n### Angular-specific (NOT YET IMPLEMENTED)\nAngular specific methods.\n\n#### getAngularInputValue(xpath, customTimeout)\nReturns angular input value.\n\n`xpath` string with element xpath\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n#### validateDynamicAngularInputValue(xpath, expectedValue, customTimeout)\nValidates if angular input value is correct.\n\n`xpath` string with element xpath\n\n`expectedValue` expected input value\n\n`customTimeout` (optional) - would be used instead of default config timeout.\n\n# Config\n\nConfiguration options. `config.json` file must be created in main project directory. Framework settings are required. Also custom project-related settings may be added (`user` or `custom`) - more details in [Project specific settings](#project-specific-settings).\n\nExample config:\n\n```javascript\n{\n\t\"baseUrl\": \"http://localhost:82/\",\n\t\"seleniumServerHost\": \"localhost\",\n\t\"seleniumServerPort\": 4444,\n\t\"proxyHost\": \"localhost\",\n\t\"proxyPort\": 8888,\n\t\"proxyHttpPort\": 8082,\n\t\"platform\": \"CHROME\",\n\t\"runMaximized\": true,\n\t\"xvfbMode\": false,\n\t\"xvfbSettings\": {\n\t\t\"windowWidth\": 1920,\n\t\t\"windowHeight\": 1080\n\t},\n\t\"defaultTimeout\": 30000,\n\t\"defaultStepTimeout\": 45000,\n\t\"seleniumDriverLogLevel\": \"SEVERE\",\n\t\"seleniumBrowserLogLevel\": \"ALL\",\n\t\"proxyCaptureHeaders\": true,\n\t\"proxyCaptureContent\": false,\n\t\"detailedTestLog\": false,\n\t\"enableScreenshotReports\": false,\n\t\"extendedPageReadyStateValidation\": true,\n\t\"pollingRate\": 100\n}\n```\n\n## Project related\n\n### baseUrl\n\nUrl of main page. Value not required - depends on Pages implementation.\n\n## Selenium\n\n### seleniumServerHost\n\nHost of Selenium Server. Remote server may be used.\n\n### seleniumServerPort\n\nPort of Selenium Server.\n\n## Proxy\n\n### proxyHost\n\nHost of BrowserMob Proxy.\n\n### proxyPort\n\nPort of BrowserMob Proxy.\n\n### proxyHttpPort\n\nProxy HTTP port.\n\n## Browser\n\n### platform\n\nBrowser/Driver the tests would be run on.\nChrome browser is recommended. Other browsers weren't tested.\n\nPossible values:\n\n- CHROME\n- FIREFOX\n- IE\n- EDGE\n- OPERA\n- SAFARI\n- PHANTOMJS\n- HTMLUNITWITHJS\n- ANDROID\n- IPHONE\n- IPAD\n\n### runMaximized\n\nSet if browser should be maximized. In case of Chrome running inside Xvfb display `xvfbMode` may be required to correctly maximize.\n\n### xvfbMode\n\nSets static Browser window dimensions based on xvfbSettings values.\n\n### xvfbSettings\n\nDefines Xvfb Browser window dimensions.\n\n`windowWidth` - width of browser window (px)\n`windowHeight` - height of browser window (px)\n\n## Timeouts\n\n### defaultTimeout\n\nDefault timeout of specific action (for example click, validateElementVisible etc.) in ms.\n\n### defaultStepTimeout\n\nDefault timeout of Cucumber step in ms.\n\n## Logs\n\n### seleniumDriverLogLevel\n\nSets log level for Selenium Driver.\n\nPossible values:\n\n- `OFF`\n- `SEVERE`\n- `WARNING`\n- `INFO`\n- `DEBUG`\n- `ALL`\n\n### seleniumBrowserLogLevel\n\nSets log level for Browser.\n\nPossible values:\n\n- `OFF`\n- `SEVERE`\n- `WARNING`\n- `INFO`\n- `DEBUG`\n- `ALL`\n\n### proxyCaptureHeaders\nControlls if request headers are logged by proxy.\n\n### proxyCaptureContent\nControlls if request content (body) is logged by proxy.\n\n### detailedTestLog\n\nIf enabled detailed logs are displayed. May be used for debugging.\n\n### enableScreenshotReports\n\nAllows to enable/disable Screenshot reports functionality. If set to `true` screenshots will be made for every action. May be useful for for example for test reports.\n\n## Other\n\n### extendedPageReadyStateValidation\n\nBy default actions are made after DOM is loaded (document.readystate == 'complete'). This option allows to enable additional validation for Angular apps - checking if requests are finished.\n\n### pollingRate\n\nPolling rate isn't supported by Selenium JS bindings - on our test environment about 60-80 requests per second to Selenium Server were made. It isn't speeding up tests execution and it's causing additional CPU usage. This option allows to limit it to some reasonable value.\n\n## Project specific settings\n```javascript\n\"user\": {\n\t\"test1\": true,\n\t\"test2\": \"aaa\"\n},\n\"custom\": {\n\t\"test3\": false,\n\t\"test4\": \"bbb\"\n}\n```\n\nProject-specific settings can also be added to config.json file. `user` or `custom` keywords may be used and may contain any needed values.\n\n# TODO\nPlanned features:\n\n  - Examples\n  - Require wrapper\n  - Runner\n  - Proxy disable/enable config\n  - Framework specific methods (for example for Angular)\n  - Multiple devices support, Profiles\n  - Parallel execution\n  - Actions support\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboldare%2Ftesting-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboldare%2Ftesting-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboldare%2Ftesting-framework/lists"}