質問

私は、私がそれらをローカルでそしてFirefoxとChromeを使ってそれらをローカルでそしてソースの上で(少なくともほとんどの時間)を実行するときには、以下のテストを実行します。

ptor = protractor.getInstance();

baseUrl = protractor.getInstance().params.sBaseUrl;
aRequiredTextFieldsKeys = [
'sFirstName',
'sLastName',
'sStreet',
'sZip',
'sCity'
];


describe('form', function ()
{
var sFormUrl = baseUrl + '#/form';

beforeEach(function ()
{
    ptor.get(sFormUrl);
});


describe('wholeForm', function ()
{

    it('fully filled form => required fields have correct class && submit leads to other route', function ()
    {

        function checkRequiredClass(el)
        {
            expect(el.getAttribute('class')).toContain('ng-valid-required');
        }

        // requried text-fields
        for (var i = 0; i < aRequiredTextFieldsKeys.length; i++) {
            var el = element(by.model('oFormData.' + aRequiredTextFieldsKeys[i]));
            el.sendKeys('a');
            checkRequiredClass(el);
        }

        // email
        var elEmail = element(by.model('oFormData.sEmail'));
        elEmail.sendKeys('jo@jo.de');
        checkRequiredClass(el);

        // birthday
        var elBirthday = element(by.model('oFormData.oBirthday'));
        elBirthday.sendKeys('1.1.1995');
        checkRequiredClass(el);

        // checkboxes
        var elCheck1 = element(by.model('oFormData.bAgb'));
        elCheck1.click();
        checkRequiredClass(elCheck1);

        var elCheck2 = element(by.model('oFormData.bPrivatePolicy'));
        elCheck2.click();
        checkRequiredClass(elCheck2);
        // hack upload bon
        ptor.executeScript(function ()
        {
            var scope = $('#application-form-id').scope();
            scope.oFormData.bBonUploaded = true;
        });

        // submit form
        element(by.className('btn-submit')).click();

        ptor.getCurrentUrl()
            .then(function (url)
            {
                expect(url).toNotBe(sFormUrl);
            });
    });
 });
.

しかしInternet ExplorerまたはSafariを起動すると、ページが手動でテストされたときにうまく機能します。 IEのために私は取得します:

メッセージ: UnknownError:JavaScriptエラー(警告:サーバーにスタックトレース情報が提供されていません)コマンドの期間またはタイムアウト:97 ミリ秒ビルド情報:バージョン: '2.30.0'、リビジョン: 'DC1EF9C'、時間: '2013-02-19 00:15:27'システム情報:os.name: 'Windows Server 2008 R2'、 OS.ARCH: 'x86'、os.version: '6.1'、java.version: '1.6.0_35'セッション ID:42B30348-8598-4DB-923J-A7019CED6EB0ドライバ情報: org.openqa.selenium.ie.InternetExplorerDriver機能 [{platform= Windows、ElementsCrollBehavior= 0、JavaScriptEnabled= true、 enablePersistenthover= true、ignorezoomsetting= false、 BrownerName= Internet Explorer、EnableElementCacheCleanup= true、 uppentsalertBehaviour= istiss、バージョン= 10、 CSSSelectorSenabled= true、ignoreProtectedModesettings= false RequireWindowFocus= False、AllowAsynchronousJavascript= false、 HandlesAlerts= true、InitialBrowserURL=、NationVents= True、 TakesScreenshot= true}]

エラー:Practorがページと同期するのを待機中のエラー:{"stack": "typeError: 匿名関数で、未定義またはNULL REFERENS \ Nのプロパティ 'get'を取得できません(不明 スクリプトコード:25:5)匿名関数(不明スクリプトコード:21:14)\ n匿名で 関数(不明スクリプトコード:21:2) "、" description ":"未定義のプロパティ 'get'を取得できません またはNULL参照 "、"番号 ": - 2146823281}

およびSafariの場合:

UnknownError:ページアンロードイベントを検出しました。スクリプト実行はページロード間では機能しません。 (警告:サーバーはスタックトレース情報を提供しませんでした) コマンドの期間またはタイムアウト:384ミリ秒 情報:バージョン: '2.33.0'、リビジョン: '4e90c97'、時間: '2013-05-22 15:32:38' システム情報:os.name: 'Windows Server 2008 R2'、OS.ARSH: 'x86'、os.version: '6.1'、java.version: '1.6.0_35' セッションID:NULL ドライバー情報:org.openqa.selenium.safari.Safaridriver. Capabilities [{Platform= Windows、JavaScriptEnabled= TRUE、CSSSelectorSenabled= TRUE、SECURESSL= TRUE、BROWERNAME= SAFARI、TAKESSCREENSHOT= TRUE、バージョン= 5.1.7}]

私はその理由について告げました。私は同じ結果を使ってより単純なテストを試みました、私はローカルおよびリモートのURLを試しました、そして、私はwaitForAngularwait、およびptor ignoreAsynch = trueのようなあらゆる種類の遅延を試しました。それらのどれも望ましい結果につながりません。任意の提案?

マイプロタクタ設定ファイル:

// A reference configuration file.
    exports.config = {

        seleniumServerJar: null,
        seleniumPort: null,
        chromeOnly: false,
        // Additional command line options to pass to selenium. For example,
        // if you need to change the browser timeout, use
        // seleniumArgs: ['-browserTimeout=60'],
        seleniumArgs: [],
        sauceUser: 'saucesuer',
        sauceKey: 'key',
        allScriptsTimeout: 120000,
        specs: [
            'test/e2e/**/*.js',
        ],

        // https://code.google.com/p/selenium/wiki/DesiredCapabilities
        // https://code.google.com/p/selenium/source/browse/javascript/webdriver/capabilities.js
        capabilities: {
            'browserName': 'phantomjs',
            'phantomjs.binary.path':'node_modules/phantomjs/bin/phantomjs'
        },


        // Selector for the element housing the angular app - this defaults to
        // body, but is necessary if ng-app is on a descendant of <body>
        rootElement: 'body',

        onPrepare: function ()
        {
    //        driver.manage().timeouts().setScriptTimeout(60000);
        },

        params: {
            sBaseUrl: 'https://dev.com/'

        },
        baseUrl: 'http://localhost:8000',

        framework: 'jasmine',

        // ----- Options to be passed to minijasminenode -----
        //
        // See the full list at https://github.com/juliemr/minijasminenode
        jasmineNodeOpts: {
            // onComplete will be called just before the driver quits.
            onComplete: null,
            // If true, display spec names.
            isVerbose: true,
            // If true, print colors to the terminal.
            showColors: true,
            // If true, include stack traces in failures.
            includeStackTrace: true,
            // Default time to wait in ms before a test fails.
            defaultTimeoutInterval: 120000
        }
    };
.

問題が問題になるとは思われませんが、Grunt-Practor Runnerを使用して複数のインスタンスを順次実行します。

           chrome: {
            options: {
                args: {
                    browser: 'chrome',
                    "idle-timeout": 120
                }
            }
        },
        firefox: {
            options: {
                args: {
                    browser: 'firefox'
                }
            }
        },
        ie9: {
            options: {
                args: {
                    browser: 'internet explorer',
                    version: '9',
                    "idle-timeout": 120
                }
            }
        },
        ie10: {
            options: {
                args: {
                    browser: 'internet explorer',
                    version: '10'
                }
            }
        },
        safari7: {
            options: {
                args: {
                    browser: 'safari',
                    version: '7'
                }
            }
        },
        safari6: {
            options: {
                args: {
                    browser: 'safari',
                    version: '6'
                }
            }
        },
        safari5: {
            options: {
                args: {
                    browser: 'safari',
                    version: '5'
                }
            }
        }
    }

grunt.registerTask('e2eall', [
    'protractor:ie9',
    'protractor:ie10',
    'protractor:safari5',
    'protractor:safari6',
    'protractor:safari7',
    'protractor:firefox',
    'protractor:chrome'
]);
.

役に立ちましたか?

解決

ヒューゴ、 これは、4分の0.17で部分的に解決され、より確実に0.18で解決された特定のテスト構成に関する問題です。私はあなたの4つ折りを最新に最新の( 0.18.1 )を更新し、それがあなたの問題を解決するかどうかを確認することをお勧めします。

関連変更履歴エントリ:

V0.18

(10aec0f)FIX(PageLoad):待ちタイムアウトを増やす

300 ms待機して、石鹸LabsでIEをテストするときに問題が発生しました。短すぎるようです。"browser.get()"常にタイムアウトしました。それが私たちの問題を解決しました。

V0.17

(A0BD84B)FIX(PageLoad):Protractor.get()中に待機を追加する

非同期スクリプトの実行を開始する前に、ブラウザのアンロードイベントが終了するのを待っていないシステムがあります。

#406を閉じます。#85を閉じます。

助けを願っています!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top