私はURLを要求するリクエストパッケージを使用し、繰延約束使用しています:分度器テストでアプリケーションのURLのステータスコードを確認するにはどうすればよいですか?
getMonitoredPageName = function() {
var deferredExecutor = protractor.promise.defer();
var defer = protractor.promise.defer();
request('http://google.com',
function (error, response, body) {
if (error || response.statusCode ==400) {
defer.reject(response.statusCode);
} else {
defer.fulfill(response.statusCode);
}
});
return defer.promise;
}
を、私は、テストからの機能の上に呼び出しています:
it('should log the page name of every page view in the wizard', function() {
// We opened the first page of the wizard and we expect it to have been logged
expect(heartBeatNotification.getMonitoredPageName()).toBeTruthy(true);
//expect(heartBeatNotification.getMonitoredPageName()).toBe(400);
//browser.controlFlow().execute(heartBeatNotification.getMonitoredPageName);
})
問題は、テストケースは関係なく常に成功していないが何であるかURL与えている。アプリケーションが実行されているかどうかを確認するテストケースを記述する必要があります。
それは公共のサイトのために働いています。私のサイトはイントラネット内にあり、応答は定義されていません –
また、URLをhttp://googleasdasdasd.comとして送信すると、その機能は長時間応答を待っています。 –
ifブロックにいくつか変更を加えました。それを試して、それが動作しているかどうか確認してください。今より良いはずです。 – tehbeardedone