Code Monkey home page Code Monkey logo

Comments (12)

juanazam avatar juanazam commented on May 22, 2024

Hi @wayne-o, what ember-cli version are you using?

Cheers!

from ember-cli-page-object.

wayne-o avatar wayne-o commented on May 22, 2024

version: 1.13.8
node: 4.1.0
npm: 2.13.4
os: darwin x64

loving it so far btw :) really nice project - just deleted tons of code after converting a couple tests to page/object - always nice to be able to delete code :)

from ember-cli-page-object.

juanazam avatar juanazam commented on May 22, 2024

@wayne-o I will try installing the addon using a vanilla app to check if anything goes wrong, the last release included a lot of changes.

We are glad you like it! We love it too and we are planning to continue adding more cool features, you can write an issue if you want to propose new features or changes.

Thanks!

from ember-cli-page-object.

san650 avatar san650 commented on May 22, 2024

@wayne-o I tried to reproduce this issue but I couldn't.

$ ember --version
version: 1.13.8
node: 0.12.7
npm: 2.13.4
os: darwin x64

These are the steps I took to create the app:

$ ember new the-test
$ cd the-test/
$ ember install ember-cli-page-object
$ ember generate acceptance-test home
$ ember generate page-object my-page

and this is the code of the test and page object

tests/acceptance/home-test.js

import Ember from 'ember';
import { module, test } from 'qunit';
import startApp from 'the-test/tests/helpers/start-app';
import page from '../pages/my-page';

module('Acceptance | home', {
  beforeEach: function() {
    this.application = startApp();
  },

  afterEach: function() {
    Ember.run(this.application, 'destroy');
  }
});

test('visiting /home', function(assert) {
  page.visit();

  andThen(function() {
    assert.equal(page.title(), 'Welcome to Ember');
  });
});

tests/pages/my-page.js

import PageObject from '../page-object';

let {
  visitable,
  text
} = PageObject;

export default PageObject.build({
  visit: visitable('/'),
  title: text('#title')
});

and this is the output of ember test command

$ ember test
version: 1.13.8
Built project successfully. Stored in "./the-test/tmp/class-tests_dist-HN8XOhE7.tmp".
ok 1 PhantomJS 1.9 - Acceptance | home: visiting /home
ok 2 PhantomJS 1.9 - JSHint - acceptance: acceptance/home-test.js should pass jshint
ok 3 PhantomJS 1.9 - JSHint - .: app.js should pass jshint
ok 4 PhantomJS 1.9 - JSHint - helpers: helpers/resolver.js should pass jshint
ok 5 PhantomJS 1.9 - JSHint - helpers: helpers/start-app.js should pass jshint
ok 6 PhantomJS 1.9 - JSHint - pages: pages/my-page.js should pass jshint
ok 7 PhantomJS 1.9 - JSHint - .: router.js should pass jshint
ok 8 PhantomJS 1.9 - JSHint - .: test-helper.js should pass jshint

1..8
# tests 8
# pass  8
# fail  0

# ok

Could you provide us more information on how to reproduce it? It would be great if you can upload a zip file with a project that has the issue.

from ember-cli-page-object.

san650 avatar san650 commented on May 22, 2024

Hi @wayne-o, did you had the chance to look at this issue?

from ember-cli-page-object.

san650 avatar san650 commented on May 22, 2024

@wayne-o, I couldn't reproduce the issue and we didn't receive more info about it. So I'll close the issue for now, if you can reproduce it, please re-open it.

Thanks.

from ember-cli-page-object.

foxnewsnetwork avatar foxnewsnetwork commented on May 22, 2024

Hey folks, I also ran into this problem (possibly the same as @wayne-o ) during installation, so time to flog this dead horse. 👊 🐴

TL;DR

If you use this in an addon project instead of an app, the test loader fails because the scaffolded code uses the addon's name as the namespace when it should use dummy as the namespace

Howto: Reproduce

ember addon akari
cd akari
ember install ember-cli-page-object
ember generate acceptance-test aria
ember generate page-object aria/index

Open up tests/acceptance/aria.js and add the following line at the top with the other import directives:

import AriaIndexPage from '../pages/aria/index';

Now, back to testing:

ember test

You should receive some version of the following error:

version: 2.3.0-beta.2
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/user-guide/#watchman for more info.
Built project successfully. Stored in "/home/aika/alice/alicia/akari/tmp/class-tests_dist-EgFz4G9q.tmp".
not ok 1 PhantomJS 2.1 - TestLoader Failures: dummy/tests/acceptance/aria-test: could not be loaded
    ---
        actual: >
            null
        stack: >

The Blame-It-On-The-User Solution

An user may fix this bug by editing the scaffolded page-object file tests/pages/aria/index.js
From this:

import PageObject from 'akari/tests/page-object';

to

import PageObject from 'dummy/tests/page-object';

My Suggestions

Please consider detecting if we're in an app or an addon in lib/blueprints-helpers.js, and using options.project.name() if and only if we're in an addon.

from ember-cli-page-object.

san650 avatar san650 commented on May 22, 2024

Hi @foxnewsnetwork, thanks for the detailed bug report. Its definitely a bug.

As you said, the problem here it's how the generators point to the PageObject helper:

https://github.com/san650/ember-cli-page-object/blob/60c0d2026b6c6e73b4dadd96738065cbc74ae38d/lib/blueprints-helpers.js

And here's how you do this properly, we should copy it

https://github.com/ember-cli/ember-cli/blob/88b648ff150240ceb25b9c863846502915b5c037/blueprints/acceptance-test/index.js#L10-L18

I think this is a different issue from the originally reported so it would be great to open a new issue, @foxnewsnetwork can you open a new issue?

from ember-cli-page-object.

Serabe avatar Serabe commented on May 22, 2024

Just happened to me with an app:

version: 2.4.2
node: 5.5.0
os: darwin x64

I installed it using ember install:

> ember install ember-cli-page-object                                                                   
version: 2.4.2
Installed packages for tooling via npm.
installing ember-cli-page-object
  install bower package ceibo
Installing browser packages via Bower...
  not-cached git://github.com/san650/ceibo.git#1.1.0
  resolved git://github.com/san650/ceibo.git#1.1.0
Installed browser packages via Bower.
Installed addon package.

And tried to use ember generate ember-cli-page-object (eg is an alias to ember generate):

> eg ember-cli-page-object                                                                       
version: 2.4.2
installing ember-cli-page-object
  install bower package ceibo
Installing browser packages via Bower...
  cached git://github.com/san650/ceibo.git#1.1.0
Installed browser packages via Bower.

Let me know if you need any other detail.

from ember-cli-page-object.

Serabe avatar Serabe commented on May 22, 2024

Oh, I created a page object for a component:

eg page-object-component investment-profile-history-item
version: 2.4.2
installing page-object-component
  create tests/pages/components/investment-profile-history-item.js

from ember-cli-page-object.

Serabe avatar Serabe commented on May 22, 2024

Solved it: stop the server, remove bower_components, dist, node_modules and tmp. Reinstall everything and restart the server.

from ember-cli-page-object.

san650 avatar san650 commented on May 22, 2024

@Serabe Glad it worked. Maybe we should mention in our release notes and installation notes that you should restart your dev server and test server after the installation in order to reload the dependencies... I'm not sure this is necessary but I can take a look at that.

Also, note that ember generate ember-cli-page-object blueprint is used to install the bower dependencies and runs automatically if you do ember install ember-cli-page-object. To generate a new page object definition you should use ember generate page-object foo.

from ember-cli-page-object.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.