Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/klassijs/example-test-suite


https://github.com/klassijs/example-test-suite

Last synced: about 9 hours ago
JSON representation

Awesome Lists containing this project

README

        


klassi-js


Klassi-Js



License


WebdriverIO


WebdriverIO


klassi-Js is a debuggable BDD (Behavior-Driven Development) JavaScript test automation framework, Built on webdriver.io (Next-gen browser and mobile automation test framework for Node.js) and cucumber-js 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.


 

## Usage
After checking out the template go to the project root and run:
```bash
yarn install
yarn run dev @search
```

## Options

```bash
--help output usage information
--version output the version number
--browser name of browser to use (chrome, firefox). defaults to chrome
--tags <@tagName> name of cucumber tags to run - Multiple TAGS usage
--steps path to step definitions. defaults to ./step_definitions
--featureFiles path to feature definitions. defaults to ./features
--pageObjects path to page objects. defaults to ./page-objects
--sharedObjects path to shared objects - repeatable. defaults to ./shared-objects
--reports output path to save reports. defaults to ./reports
--env name of environment to run the framework/test in. default to dev
--reportName name of what the report would be called i.e. 'Automated Test'
```
## Options Usage
```bash
--tags @get || will execute the scenarios tagged with the values provided.
--featureFiles features/utam.feature,features/getMethod.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).
```

## Helpers
Klassi-js contains a few helper methods to help along the way, these methods are:
```js
// Load a URL, returning only when the tag is present
await helpers.loadPage('https://duckduckgo.com');

// writing content to a text file
await helpers.writeToTxtFile(filepath, output);

// reading content froma text file
await helpers.readFromFile(filepath);

// applying the current date to files
await helpers.currentDate();

// get current date and time (dd-mm-yyyy-00:00:00)
await helpers.getCurrentDateTime();

// 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
await helpers.clickHiddenElement(selector, textToMatch);

// This method is useful for dropdown boxes as some of them have default 'Please select' option on index 0
await helpers.getRandomIntegerExcludeFirst(range);
```

## Browser usage
By default, the test run using Google Chrome/devtools protocol, to run tests using another browser locally you'll need a local selenium server running, supply the browser name along with the `--browser` switch

| Browser | Example |
| :--- | :--- |
| Chrome | `--browser chrome` |
| Firefox | `--browser firefox` |

## How to debug

Most 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:

```js
When(/^I search DuckDuckGo for "([^"]*)"$/, function (searchQuery, done) {
elem = browser.$('#search_form_input_homepage').then(function(input) {
expect(input).to.exist;
debugger; // <<- your IDE should step in at this point, with the browser open
return input;
})
done(); // <<- let cucumber know you're done
});
```

## License

Licenced under [MIT License](LICENSE) © 2016 [Larry Goddard](https://www.linkedin.com/in/larryg)