Forums

Posting in these forums is disabled. These forums will be available for archive purposes. Please join the new forums at the links below:

  • yui-support - replaces the `YUI 3.x` and `YUI 3 Gallery` forums.
    We have created the following discussion categories within this group to aid discoverability for these most-used topics:
    • Charts for YUI Charts support.
    • DataTable for YUI DataTable support.
    • Gallery for YUI Gallery support, including support for published Gallery components as well as the Gallery process in general.
    • Tools for support of YUI’s suite of developer tools such as selleck, shifter, grover, yogi, etc.
    • Everything Else for questions that don’t fit one of the categories above, we’ve got you covered here.
  • yui-deprecated - replaces the `YUI 2.x` forum and the forums of other deprecated products (`YUI Doc`, `Builder`, `YUI PHP Loader`, etc.).
  [ 6 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic

Olan Byrne

YUI Contributor

  • Username: olan
  • Joined: Wed Jun 06, 2012 2:12 am
  • Posts: 4
  • Location: Belfast, UK
  • Twitter: olanb7
  • GitHub: olanb7
  • Gists: olanb7
  • IRC: olan
  • Offline
  • Profile

Running yeti from ant?

Post Posted: Mon Jun 18, 2012 3:50 am
+0-
Hi reid/all,

I was just wondering if anyone has a working ant task that runs yeti? I'm using one similar to what is suggested in the "Maintanable Javascript" book, but am still getting errors.

The ant target I'm using is pretty simple:

Code:
<!-- yeti -->
<target name="yeti">
    <apply executable="yeti" failonerror="true" parallel="true">
        <fileset dir="." includes="**/*-test.html" />
        <srcfile/>
    </apply>
</target>


But when executing this task I get the following error:

Code:
yeti:
    [apply] Yeti v0.2.5 (Node.js v0.6.15) Error: Unable to connect to Hub or start an interactive session.
    [apply] Report this bug at http://yuilibrary.com/projects/yeti/report


Running the yeti command directly from the command line works just fine though, just not from ant. I've also tried starting a server locally and running the same ant task, hoping it would pick up the hub, but no such luck.

Any help would be appreciated on this one!

Olan

Reid Burke

YUI Developer

  • Username: reid
  • Joined: Mon May 11, 2009 1:02 pm
  • Posts: 28
  • Location: Sunnyvale, California
  • Twitter: reid
  • GitHub: reid
  • Gists: reid
  • IRC: reid
  • YUI Developer
  • Offline
  • Profile

Re: Running yeti from ant?

Post Posted: Mon Jun 18, 2012 10:55 am
+0-
Olan,

The reason why you'll see "Unable to connect to Hub or start an interactive session" is because you would need to connect browsers before running tests.

Yeti needs to know when you have finished connecting browsers. If you're not connecting to a Hub, one will be created at http://localhost:9000. At that point, no browsers are connected, so Yeti waits for you to go and connect some. After that, you'd press Enter to begin testing. But if you're using Yeti inside of a build system, there isn't an interactive terminal present and it would just wait forever.

There is a solution: simply create a Yeti Hub with `yeti --server` and connect your browsers before your Ant task. When you run `yeti` again with your tests, it will begin testing immediately on all browsers connected to that Hub.

Reid

Olan Byrne

YUI Contributor

  • Username: olan
  • Joined: Wed Jun 06, 2012 2:12 am
  • Posts: 4
  • Location: Belfast, UK
  • Twitter: olanb7
  • GitHub: olanb7
  • Gists: olanb7
  • IRC: olan
  • Offline
  • Profile
Tags:
  • node

Re: Running yeti from ant?

Post Posted: Tue Jun 19, 2012 1:20 am
+0-
Reid,

Thanks for your reply. I attempted this yesterday without fully understanding the in's and out's and didn't get it working, so I gave it another go after reading your post.

I can start a yeti server fine locally and connect browsers to it using:
Code:
yeti --server

At this point I connected my browser to http://localhost:9000. I'm not sure if the server is supposed to alert me when agents are connected (as it does when not using the --server arg) but it doesn't.

Anyway, from the command line running yeti normally does pick up the local hub OK, however it doesn't run them automatically as you mentioned. When I start the test it still waits for me to press enter before proceeding with the tests:
Code:
Connected to http://localhost:9000
Waiting for agents to connect at http://localhost:9000.
When ready, press Enter to begin testing.
✔ Testing started!
✔ Allowance Test Suite on Chrome (19.0.1084.56) / Linux
✔ Agent completed: Chrome (19.0.1084.56) / Linux

Running the ant task then gives the same error as before, as I guess it cannot start an interactive shell to wait for the enter keypress.
Code:
yeti:
    [apply] Yeti v0.2.5 (Node.js v0.6.15) Error: Unable to connect to Hub or start an interactive session.
    [apply] Report this bug at http://yuilibrary.com/projects/yeti/report


So I guess what I'm asking is, is this expected behaviour? Is there a method to automatically execute the tests without entering an interactive session?

FYI:
Code:
Ubuntu 12.04 LTS
Node v0.6.15
Yeti 0.2.5
Apache Ant(TM) 1.8.2

Reid Burke

YUI Developer

  • Username: reid
  • Joined: Mon May 11, 2009 1:02 pm
  • Posts: 28
  • Location: Sunnyvale, California
  • Twitter: reid
  • GitHub: reid
  • Gists: reid
  • IRC: reid
  • YUI Developer
  • Offline
  • Profile
Tags:
  • github
  • bugfix

Re: Running yeti from ant?

Post Posted: Tue Jun 19, 2012 2:08 pm
+0-
No, that's not expected. I made a change to Yeti for starting tests right away if browsers are already connected to a Hub.

You can try it out by installing Yeti from the latest source, which is a one-line affair:
Code:
npm install -g http://latest.yeti.cx

Olan Byrne

YUI Contributor

  • Username: olan
  • Joined: Wed Jun 06, 2012 2:12 am
  • Posts: 4
  • Location: Belfast, UK
  • Twitter: olanb7
  • GitHub: olanb7
  • Gists: olanb7
  • IRC: olan
  • Offline
  • Profile

Re: Running yeti from ant?

Post Posted: Wed Jun 20, 2012 2:07 am
+0-
Hey reid,

Thanks for that, works like you mentioned now.. but still not from ant unfortunately!

It seems the isTTY check is failing, and given the recent changes you submitted, I wonder if it is still necessary? I commented out the following block in yeti/lib/cli.js and, with the change, it works fine from ant:

Code:
204     /*if (!isTTY) {
205         // TODO Only throw this error if no agents are immediately available.
206         // stderr is not a terminal, we are likely being ran by another program.
207         // Fail quickly instead of waiting for browsers.
208         throw "Unable to connect to Hub or start an interactive session.";
209         // TODO: Allow waiting X seconds for browsers.
210         //        "Try running with --wait 30 to wait 30 seconds for browsers to connect.";
211     }*/

As I mentioned I was finally able to get the desired output:
Code:
yeti:
    [apply] Connected to http://localhost:9000
    [apply]   Agent connected: Chrome (19.0.1084.56) / Linux
    [apply] ✔ Testing started!
    [apply] ✔ Edit Panel Suite on Chrome (19.0.1084.56) / Linux
    [apply] ✔ Allowance Test Suite on Chrome (19.0.1084.56) / Linux
    [apply] ✔ Agent completed: Chrome (19.0.1084.56) / Linux
    [apply] 20 tests passed! (1180ms)

I haven't looked at the code enough to know if this has knock on effects or not. I can fork my own version if these changes aren't suitable for the master branch.

Thanks,
Olan

Reid Burke

YUI Developer

  • Username: reid
  • Joined: Mon May 11, 2009 1:02 pm
  • Posts: 28
  • Location: Sunnyvale, California
  • Twitter: reid
  • GitHub: reid
  • Gists: reid
  • IRC: reid
  • YUI Developer
  • Offline
  • Profile

Re: Running yeti from ant?

Post Posted: Tue Sep 11, 2012 11:12 am
+0-
Hey Olan,

Thank you for your post; I apologize that my response was so delayed. I have incorporated your feedback by removing that code.

You can get the latest Yeti as always by:

Code:
npm install -g http://latest.yeti.cx


Reid
  [ 6 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum