san650 / ember-cli-page-object

This ember-cli addon eases the construction of page objects on your acceptance and integration tests
http://ember-cli-page-object.js.org/
MIT License
273 stars 89 forks source link

make it node.js compatible #512

Open ro0gr opened 4 years ago

ro0gr commented 4 years ago

With adapters we should be able to configure page object interactions per different environments. However, there are still some blockers to make page objects work cross-env. The goal of the ticket is to build a path forward for page objects to work in node, and probably other envs like different FWs etc.

@ember/*

There are some of ember packages we do currently depend on, and they don't have standalone packages published.

"jquery" VS "-jquery"

-jquery is a synthetic module (#1, #2), which is only needed to ensure we use the same instance of jQuery, in case if an app depends on jQuery events. However, when ec-page-object tries to import it in node env, it fails, cause there is no EmberCli build process envolved, and -jquery is not liseted in the package.json.

I think we should isolate -jquery imports in the ember adapters, and use jquery for the rest of the places. So it stays resolvable for node, until Ember specific adapters are used.

Ceibo

seems it does no support node require. Needs some attention.

Test

patrickberkeley commented 4 years ago

I'm running into needing this. We use ember-cli-page-object in a number of apps and addons. Now we would like to reuse those page objects outside of ember for end-to-end testing with a tool like cypress.io, selenium, bigtest.

Due to the structure of this repo (index.js, package.json, exports, etc.) it's proving difficult to make ember-cli-page object's functions available outside of an ember app.

In addition to the issues listed above in this issue description (decoupling from ember specific dependencies), I'm wondering if it would make sense to split the core functionality for creating and querying page objects into a separate non-ember node package. Then consume that new package in ember-cli-page-object. This is a similar pattern to what ember-cli-mirage did with miragejs I believe, and would allow – and ensure – the core functionality is usable outside of ember.

ro0gr commented 3 years ago

I'm wondering if it would make sense to split the core functionality for creating and querying page objects into a separate non-ember node package.

Yes, definitely! My current intention is to make ec-page-object node.js compatible at the first place. This way, from the node.js user's perspective, the import paths would be ugly, like:

// since we would not do the ember-cli pipeline tricks with the import paths
import { clickable } from 'ember-cli-page-object/addon-test-support';

After that, when all the internals are ready, we can extract the core into a framework independent package with the minimal changes, and provide better import paths for the end user of the core.