Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebdriverIO support #129

Open
Travis-Davidson opened this issue May 11, 2019 · 4 comments
Open

WebdriverIO support #129

Travis-Davidson opened this issue May 11, 2019 · 4 comments

Comments

@Travis-Davidson
Copy link

Add support for WebdriverIO

@vincent-psarga
Copy link
Contributor

vincent-psarga commented May 22, 2019

From what I see by reading the doc of WebDriver.io, it looks more like a library loaded in tests written in Jasmine (same as using Selenium inside Java/JUnit for example).

Would it be possible to generate the tests in Jasmine and use the WebDriver library in the action words implementation or am I missing something ?

@vincent-psarga
Copy link
Contributor

vincent-psarga commented May 22, 2019

After a bit more research: https://webdriver.io/docs/frameworks.html

So WebDriver.io integrates in Jasmine, Mocha and Cucumber-JS (three frameworks currently supported by hiptest-publisher).
We will need more information on what would need to be done.

@A45VAP8rN
Copy link

A45VAP8rN commented Nov 11, 2019

@vincent-psarga I have successfully installed the hiptest publisher and I can fetch the scenarios.
I am providing below some information that I believe would allow you guys at Hiptest to figure out of what modifications you would need to do on the hiptest-publisher so it can work straight out of the box with WebDriverIO.

To setup WebDriverIO clone this repository and then install the hiptest-publisher
https://github.com/WarleyGabriel/demo-webdriverio-cucumber

Ok, now into the details.

The initial problem I was faced with is that I was getting the following error.
image

• Here is the Hiptest folder structure I am using
image

• These are my settings in the hiptest-publisher.conf

token = secret
not_recursive = false
split_scenarios = true
with_folders = false
keep_filenames = false
keep_foldernames = false
empty_folders = false
leafless_export = false
no_uids = false
no_parent_folder_tags = false
with_dataset_names = false
filter_on_tags =
test_run_name = bvt
language = cucumber
output_directory = './features'
framework = javascript
site = https://app.hiptest.com
step_definitions_output_directory = './features/step_definitions'
actionwords_output_directory = './features/step_definitions'
overriden_templates = './templates'

Please note, I was able to resolve the above issue with the following modifications

I converted the generated Hiptest file: step_definitions.js as seen below

[Before]

module.exports = function () {
    this.Before(function (scenario) {
        this.actionwords = Object.create(require('./actionwords.js').Actionwords);
    });

    this.After(function (scenario) {
        this.actionwords = null;
    });

    this.Given(/^a user is not logged in Gandalf$/, function (callback) {
        this.actionwords.aUserIsNotLoggedInGandalf();
        callback();
    });

    this.When(/^the user login using with username "(.*)" and password "(.*)" and presses Login$/, function (username, password, __datatable, callback) {
        this.actionwords.theUserLoginUsingWithUsernameUsernameAndPasswordPasswordAndPressesLogin(__datatable, username, password);
        callback();
    });

    this.Then(/^the user "(.*)" and "(.*)"$/, function (google_sso_permissions, result, callback) {
        this.actionwords.theUserGoogleSsoPermissionsAndResult(result, google_sso_permissions);
        callback();
    });
}

[After]

import { Before, After, Given, When, Then } from 'cucumber';
let actionwords = Object.create(require('./actionwords.js').Actionwords);

    Given(/^a user is not logged in Gandalf$/, function() {
        actionwords.aUserIsNotLoggedInGandalf();
    });

    When(/^the user login using with username "(.*)" and password "(.*)" and presses Login$/, function (username, password) {
        actionwords.theUserLoginUsingWithUsernameUsernameAndPasswordPasswordAndPressesLogin(username, password);
    });

    Then(/^the user "(.*)" and "(.*)"$/, function (google_sso_permissions, result) {
        actionwords.theUserGoogleSsoPermissionsAndResult(result, google_sso_permissions);
    });

And now it seems to be working

image

@vincent-psarga
Copy link
Contributor

vincent-psarga commented Nov 14, 2019

Hi @A45VAP8rN,

Glad to see that it's working for you. The reason why the steps were not working previously is that hiptest-publisher does not support yet newer versions of cucumber-js (this is due to the impossibility to support multiple version of the same framework, which should hopefully fixed once #145 is clearer).

We have provided the explanations about how to generate better steps definitions here: https://community.hiptest.com/t/handling-cucumber-js-3-with-hiptest-publisher/1199 (which may be a bit buried and hard to find :/ )
I hope this will help you :)

edit: in fact there's slight differences between what you made in step_definitions and what is shown in the previous link. Some minor updates should be made to those template files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants