Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Custom suite commands #197

Open
Open

Description

@DimitryDushkin

It will be nice to have ability to add custom suite commands like in webdriver.io — http://webdriver.io/guide/usage/customcommands.html

For example, it will be helpful to have such command:

suite
  .setUrl('yandex.ru')
  .waitForJSInit()
  .setCaptureElements(...)
  ...

Activity

  1. fenduru commented on Sep 11, 2015

    @fenduru

    👍 this would be very useful

  2. fenduru commented on Oct 29, 2015

    @fenduru

    @SwinX I'm interested in contributing support for this. Do you have any idea of the kind of API you'd want for this?

    My use case is that my application has multiple themes, and I want to write one .capture() and have it run multiple times based on the theme. Ideally I would be able to decorate .capture() to do this, or I could add a custom command like captureThemes().

  3. SwinX commented on Nov 2, 2015

    @SwinX
    Contributor

    @fenduru thank you for your intent! This may be a really nice feature.
    I may propose following way to do this:

    As you may know gemini has plugins support. Gemini instance is being passed to plugin. You may want to add there some method like addCommand(name, action), where action will be smth like function() {...};.
    So we have entry point where command may be added.
    Now we need to pass command to suites. This may be done by collecting new commands in some hash at tests-api.js:

    var commands = {};

    Then in SuiteBuilder constructor we need to add something like:

    var self = this;
    _.(commands).each(function(action, name) {
        self[name] = action.bind(self);
    });

    Seems this is all we need to modify to get custom commands feature. In this implementation you will be able to access all available SuiteBuilder API and other custom commands using this keyword.
    If you see a better way please let me know, will be happy to discuss it.

    /cc @j0tunn @sipayRT

  4. fenduru commented on Nov 2, 2015

    @fenduru

    @SwinX 👍 I'll try something like that out. Thanks for the guidance

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions