{"id":24251014,"url":"https://github.com/klassijs/klassi-js","last_synced_at":"2025-04-06T20:13:57.604Z","repository":{"id":32548099,"uuid":"76496875","full_name":"klassijs/klassi-js","owner":"klassijs","description":"A platform independent debuggable BDD Javascript testing framework. It's simple and easy to use. It's built with nodeJs, webdriver.io ((Next-gen WebDriver for Node.js) and cucumber-js.","archived":false,"fork":false,"pushed_at":"2025-03-18T13:09:46.000Z","size":849,"stargazers_count":51,"open_issues_count":0,"forks_count":27,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-30T19:08:40.108Z","etag":null,"topics":["automated-testing","cucumberjs","javascript-framework","klassi","klassi-js","nodejs","test-automation","test-framework","webdriverio"],"latest_commit_sha":null,"homepage":"","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/klassijs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-14T21:02:20.000Z","updated_at":"2024-05-07T00:55:23.000Z","dependencies_parsed_at":"2023-11-16T10:28:58.252Z","dependency_job_id":"2fce0130-90f3-49a7-bfe8-11a1779cdc40","html_url":"https://github.com/klassijs/klassi-js","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klassijs%2Fklassi-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klassijs%2Fklassi-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klassijs%2Fklassi-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klassijs%2Fklassi-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klassijs","download_url":"https://codeload.github.com/klassijs/klassi-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247543595,"owners_count":20955865,"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":["automated-testing","cucumberjs","javascript-framework","klassi","klassi-js","nodejs","test-automation","test-framework","webdriverio"],"created_at":"2025-01-15T02:01:09.257Z","updated_at":"2025-04-06T20:13:57.582Z","avatar_url":"https://github.com/klassijs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ch1 align=\"center\" font-size: 2.5em \u003e klassi-js \u003cbr\u003e\n    \u003ca href=\"https://github.com/klassijs/klassi-js/\"\u003e\n        \u003cimg alt=\"Klassi-Js\" src=\"./runtime/img/klassiLogo.png\"\u003e\n    \u003c/a\u003e \u003c/h1\u003e \u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/klassijs/klassi-js/blob/master/LICENSE\"\u003e\n    \u003cimg alt=\"License\" src=\"https://img.shields.io/github/license/klassijs/klassi-js\"\u003e\n    \u003c/a\u003e \n    \u003ca href=\"https://gitter.im/klassijs/klassi-js\"\u003e\n    \u003cimg alt=\"Gitter\" src=\"https://badges.gitter.im/klassijs/klassi-js.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://webdriver.io/\"\u003e\n    \u003cimg alt=\"WebdriverIO\" src=\"https://img.shields.io/badge/tested%20with-webdriver.io-%23ea5906\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://webdriver.io/docs/api.html\"\u003e\n    \u003cimg alt=\"WebdriverIO\" src=\"https://img.shields.io/badge/webdriverio-docs-40b5a4\"\u003e\n    \u003c/a\u003e \u003cbr\u003e\nklassi-Js is a debuggable BDD (Behavior-Driven Development) JavaScript test automation framework, Built on \u003ca href=\"http://webdriver.io/\"\u003e webdriver.io \u003ca/\u003e (Next-gen browser and mobile automation test framework for Node.js)\u003c/a\u003e and \u003ca href=\"https://github.com/cucumber/cucumber-js\"\u003e cucumber-js \u003c/a\u003e and distinguished by its integration of AI for advanced debugging functionalities. This incorporation of artificial intelligence elevates the framework's capabilities, providing a streamlined and efficient approach to test automation.\n\u003c/p\u003e\n \n\n## Installation\n\n```bash\nyarn add klassi-js\n \nnpm install klassi-js\n```\n\n## Usage\n\n```bash\nnode ./node_modules/klassi-js/index.js\n```\n\n## Options\n\n```bash\n--help                              output usage information\n--version                           output the version number\n--browser \u003cname\u003e                    name of browser to use (chrome, firefox). defaults to chrome\n--tags \u003c@tagName\u003e                   name of cucumber tags to run - Multiple TAGS usage (@tag1,@tag2)\n--exclude \u003c@tagName\u003e                name of cucumber tags to exclude - Multiple TAGS usage(@tag3,@tag5)\n--steps \u003cpath\u003e                      path to step definitions. defaults to ./step-definitions\n--featureFiles \u003cpath\u003e               path to feature definitions. defaults to ./features\n--pageObjects \u003cpath\u003e                path to page objects. defaults to ./page-objects\n--sharedObjects \u003cpaths\u003e             path to shared objects - repeatable. defaults to ./shared-objects\n--reports \u003cpath\u003e                    output path to save reports. defaults to ./reports\n--env \u003cpath\u003e                        name of environment to run the framework/test in. default to dev\n--reportName \u003coptional\u003e             name of what the report would be called i.e. 'Automated Test'\n\n```\n## Options Usage\n```bash\n  --tags @tagName || will execute the scenarios tagged with the values provided.\n  --featureFiles features/example.feature,features/example1.feature || provide specific feature files containing the scenarios to be executed. If multiple are necessary, separate them with a comma (no blank space in between).\n```\n\n## Directory Structure\nYou can use the framework without any command line arguments if your application uses the following folder structure, to help with the built in functionality usage.\n\n```bash\n.\n└── features\n    └── search.feature\n└── page-objects\n    └── search.js\n└── shared-objects\n    └── searchData.js\n└── step_definitions\n    └── search-steps.js\n└── reports  # folder and content gets created automatically at runtime\n    └── chrome\n        ├── reportName-01-01-1900-235959.html\n        └── reportName-01-01-1900-235959.json\n.envConfigrc.js # this file will contain all your environment variables (i.e. dev, test, prod etc.,)\n.dataConfigrc.js # this file will contain all your project variables #projectName, emailAddresses\n.env # this file contains all config username and passcode and should be listed in the gitignore file\ncucumber.js # the cucumber configuration file\n```\n\n## Step definitions\nThe following variables are available within the ```Given()```, ```When()``` and ```Then()``` functions:\n\n| Variable | Description |\n| :--- | :---  |\n| `browser`     | an instance of [webdriverio](https://webdriver.io/docs/setuptypes.html) (_the browser_) |\n| `pageObjects`       | collection of **page** objects loaded from disk and keyed by filename |\n| `sharedObjects`     | collection of **shared** objects loaded from disk and keyed by filename |\n| `helpers`    | a collection of [helper methods](runtime/helpers.js) _things webdriver.io does not provide but really should!_ |\n| `expect`     | instance of [chai expect](https://www.chaijs.com/api/bdd/) to ```expect('something').to.equal('something')``` |\n| `assert`     | instance of [chai assert](https://www.chaijs.com/api/assert/) to ```assert.isOk('everything', 'everything is ok')``` |\n| `trace`      | handy trace method to log console output with increased visibility |\n\n\n## Helpers\nKlassi-js contains a few helper methods to help along the way, these methods are:\n```js\n// Load a URL, returning only when the \u003cbody\u003e tag is present\nawait helpers.loadPage('https://duckduckgo.com', 10);\n\n// writing content to a text file\nawait helpers.writeToTxtFile(filepath, output);\n\n// reading content froma text file\nawait helpers.readFromFile(filepath);\n\n// applying the current date to files\nawait helpers.currentDate();\n\n// get current date and time (dd-mm-yyyy-00:00:00)\nawait helpers.getCurrentDateTime();\n\n// clicks an element (or multiple if present) that is not visible, useful in situations where a menu needs a hover before a child link appears\nawait helpers.clickHiddenElement(selector, textToMatch);\n\n// Get the href link from an element\nawait helpers.getLink(selector);\n\n//wait until and element is visible and click it\nawait helpers.waitAndClick(selector);\n\n// wait until element to be in focus and set the value\nawait helpers.waitAndSetValue(selector, value);\n\n// function to get element from frame or frameset\nawait helpers.getElementFromFrame(frameName, selector);\n\n//Sorts results by date\nawait helpers.sortByDate();\n\n//this filters an item from a list of items\nawait helpers.filterItem();\n\n//this filters an item from a list of items and clicks on it\nawait helpers.filterItemAndClick();\n```\n\n## Test Execution Reports\n\nHTML and JSON reports will be automatically generated and stored in the default `./reports` folder. This location can be\n changed by providing a new path using the `--reports` command line switch:\n\n## Event handlers\n\nYou can register event handlers for the following events within the cucumber lifecycle.\n\nconst {After, Before, AfterAll, BeforeAll, BeforeStep, AfterStep} = require('@cucumber/cucumber');\n\n| Event          | Example                                                     |\n|----------------|-------------------------------------------------------------|\n| Before     | ```Before(function() { // This hook will be executed before all scenarios}) ```  |\n| After      | ```After(function() {// This hook will be executed after all scenarios});```    |\n| BeforeAll  | ```BeforeAll(function() {// perform some shared setup});``` |\n| AfterAll   | ```AfterAll(function() {// perform some shared teardown});```  |\n| BeforeStep | ```BeforeStep(function() {// This hook will be executed before all steps in a scenario with tagname;``` |\n| AfterStep  | ```AfterStep(function() {// This hook will be executed after all steps, and take a screenshot on step failure;```  |\n\n## How to debug\n\nMost webdriverio methods return a [JavaScript Promise](https://spring.io/understanding/javascript-promises \"view JavaScript promise introduction\") that is resolved when the method completes. The easiest way to step in with a debugger is to add a ```.then``` method to the function and place a ```debugger``` statement within it, for example:\n\n```js\n  When(/^I search DuckDuckGo for \"([^\"]*)\"$/, function (searchQuery, done) {\n    elem = browser.$('#search_form_input_homepage').then(function(input) {\n      expect(input).to.exist;\n      debugger; // \u003c\u003c- your IDE should step in at this point, with the browser open\n      return input;\n    })\n       done(); // \u003c\u003c- let cucumber know you're done\n  });\n```\n\n## Demo\nTo see a demo of the framework without installing it, use this link [HERE](https://github.com/klassijs/klassi-example-test-suite)\n\n## Bugs\n\nPlease raise bugs via the [klassi-js issue tracker](https://github.com/klassijs/klassi-js/issues), please provide enough information for bug reproduction.\n\n## Contributing\n\nAnyone can contribute to this project, PRs are welcome. In lieu of a formal styleguide, please take care to maintain the existing coding style.\n\n## Credits\n\n[John Doherty](https://www.linkedin.com/in/john-i-doherty)\n\n\n## License\n\nLicenced under [MIT License](LICENSE) \u0026copy; 2016 [Larry Goddard](https://www.linkedin.com/in/larryg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklassijs%2Fklassi-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklassijs%2Fklassi-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklassijs%2Fklassi-js/lists"}