YahooArchive / arrow

FE Test framework designed to promote TDD
http://yahoo.github.io/arrow/arrow_intro.html
BSD 3-Clause "New" or "Revised" License
55 stars 59 forks source link

Under Arrow versions > 0.0.85 with Selenium, local yui test files do not load, and so the test times out #209

Closed nottoseethesun closed 10 years ago

nottoseethesun commented 10 years ago

With Arrow versions greater than 0.0.85, including the very latest version of Arrow, working with the latest Selenium driver (also tried 2.40.0) and no global arrow install and no global phantom install, running with the Firefox web browser (latest: version 28.0), the yui js test files (test-lib.js, and the actual test) do not load, even though the test loads the page under test just fine (the page shows up, loads well under 30 seconds, and so forth).

It is evident that they do not load as no console logs are delivered under logLevel "debug".

The fact that the js test files do not load on the browser causes the test to timeout, as shown below. An error message about the timeout is shown, but doesn't contain any information pertaining to the actual problem.

This happens on two different Macs for me.

I can always work-around by reverting to yahoo-arrow version 0.0.85 .

Checking the docs for any changes in the convention for test-descriptor.json does not show any relevant changes.

I'd like to upgrade from 0.0.85, but this is blocking.

Log snippets:

$  node_modules/.bin/arrow test-descriptor.json --driver=selenium --logLevel=debug 
...
[2014-04-01 13:28:47.475] [INFO] SeleniumDriver - Loading dependency: ./test-lib.js
[2014-04-01 13:28:47.479] [INFO] SeleniumDriver - Loading dependency: /Users/foo/bar/bat/test/arrow/node_modules/yahoo-arrow/lib/common/yui-arrow.js
[2014-04-01 13:28:47.480] [INFO] SeleniumDriver - Loading test: ./test-page-load-int.js from .
[2014-04-01 13:28:47.483] [DEBUG] SeleniumDriver - {"platform":"MAC","javascriptEnabled":true,"acceptSslCerts":true,"browserName":"firefox","rotatable":false,"locationContextEnabled":true,"webdriver.remote.sessionid":"ff8aa474-5573-4891-8550-3c8c27f23849","version":"28.0","databaseEnabled":true,"cssSelectorsEnabled":true,"handlesAlerts":true,"browserConnectionEnabled":true,"webStorageEnabled":true,"nativeEvents":false,"applicationCacheEnabled":true,"takesScreenshot":true}
[2014-04-01 13:28:48.058] [DEBUG] SeleniumDriver - Waiting for the test report, attempt: 1
...
[2014-04-01 13:29:19.056] [DEBUG] SeleniumDriver - Waiting for the test report, attempt: 60
[2014-04-01 13:29:19.089] [DEBUG] SeleniumDriver - No debug log found in browser.
[2014-04-01 13:29:19.090] [ERROR] SeleniumDriver - Test Timed Out. It can happen due to one of these three reasons :
1) Your Test Script or page had a JS error, if you had --logLevel=debug in your command, you can see debug messages from browser console printed just before this error message.
2) The page got redirected before completing the test, this happens if your page has auto-redirects, or your tests perform some UI action resulting into page change event. Please use a custom controller for these kind of issues. 
3) Your test took more than 30 Seconds.```
pranavparikh commented 10 years ago

@christopherbalz , Can you give your sample descriptor ? Is it the https page you're trying to test ? Please let us know the details. Thanks

nottoseethesun commented 10 years ago

Yes it's https. Here's the test-descriptor.json file (sanitized):

[
    {
        "settings": [ "master" ],

        "name" : "validate-json-response",
        "startProxyServer" : false,
        "commonlib" : "../util/serialize.js,../bower_components/tv4/tv4-ypkg.js,./test-lib.js,./json-schemas.js,./json-requests.js",

        "config" :{
            "baseUrl" : "https://foo.bar.bat.com",
            "controllerRootDir": "/Users/foo/bar/test/arrow/controller",
            "testUser_0": "foo-bar",
            "testUser_0_password": "bat-baz",
            "validateJson": true,
            "deliveryMode": "uat-trial",
            "fooConnectUsernameCss": ".foo",
            "fooConnectPasswordCss": ".bar",
            "fooConnectLogInButtonCss": ".bat"
        },

        "dataprovider" : {

            "int" : {
                "params" : {
                    "scenario": [
                        {
                            "page" : "$$config.baseUrl$$"
                        },
                        {
                            "controller" : "$$config.controllerRootDir$$/test-foo-validate-json-response-controller.js",
                            "params": {
                                "verboseConsoleLogging": true,
                                "test" : "./test-validate-foo-json-int.js",
                                "server": "https://foo.bar.bat.com",
                                "banUnknownProperties": false,
                                "schemaSuffix":  ".json_schema",
                                "httpRequestTimeoutMS": 90000
                            }
                        }
                    ]
                },
                "group" : "smoke",
                "testTimeOut" : 120000
            }
        }

    },

    {
        "settings": [ "environment:development" ],

        "config" :{
            "baseUrl" : "http://localhost:8125/foo/build/foo/index.html",
            "deliveryMode": "dev-mode"
        }
    }
]
pranavparikh commented 10 years ago

@christopherbalz

Arrow injects yui on the page using this app seed - http://yui.yahooapis.com/3.8.0/build/yui/yui-min.js . For https , you'll need to pass --defaultAppSeed as https://yui-s.yahooapis.com/3.8.0/build/yui/yui-min.js. Can you please try it out ?

For mocha and chai, we use cdnjs links - like //cdnjs.cloudflare.com/ajax/libs/mocha/1.13.0/mocha.js We need to do something similar for yui too.

nottoseethesun commented 10 years ago

Problem solved! Great, thanks. Hopefully, this can be fixed for others going forward with either or both a doc fix, and auto-detect https and just do the right thing.

pranavparikh commented 10 years ago

This fix went out with Arrow 0.5.2 - https://github.com/yahoo/arrow/pull/228