Skip to content

Custom properties #453

@yratanov

Description

@yratanov

Hi,

I am using Ember 3.3 + "ember-cli-page-object": "^1.15.2".

I'm trying to add new property to be used in page object like this:

// page 

export default create({
  role: powerSelect('.role'),
  submit: clickOnText('.btn'),
});

// powerSelect property defined like this

export function powerSelect(selector) {
  return {
    isDescriptor: true,

    get(_) {
      return function(text) {
        wait().then(() => {
          selectChoose(selector, text);
        });

        return this;
      };
    }
  };
}

//test 
module('Some module', function(hooks) {
  setupApplicationTest(hooks);

  test('adding priority', async assert => {
    await visit('/');
    await page.role('Admin');
    await page.submit();
  });
});

But it doesn't work properly. selectChoose does not finish, while submit is already clicked.

I looked in the code and it seems that my helper return value should be wrapped in runAsync from rfs268.js, but it is a private api....

So in genearal I have these questions:

  1. Why creation of new properties is not covered in the docs? Is it an unexpeted usage of the library?
  2. Why runAsync for all contexts is private?
  3. If I suppose to be able to write custom properties with interactions, how should I do it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions