2017-06-27 4 views
0

Webdriverコントロールフローが将来削除されると聞き、テストケースを更新したいと思っていました。分度器:コントロールフローを無効にする

私はそれを交換するためのより良い方法は何かわからない:

  • 非同期は待つ:うまく働いたが、jshintでサポートされていません。
  • 約束:私はジャスミンとの約束を保証する方法を知らない。たとえば、

:第二スペックのみ、最初の仕様の後に実行するようにする方法

it('should should clear qa cookies using the qa command', function() { 
    browser.waitForAngularEnabled(false) 
    .then(browser.get('cookies url')); 
}); 

it('should open product page', function() { 
    browser.waitForAngularEnabled(true) 
    .then(browser.get('page-url')) 
    .then(browser.wait(function() { 
     return element.all(by.css('locator')).first().isDisplayed(); 
    })) 
    .then(expect(true).toBe(true)); 
}); 

ありがとうございます!

答えて

1

async/awaitを使用することをお勧めします。問題は、あなたがページオブジェクトで作業したり、将来の使用のためにいくつかのデータを保存したりする必要があるときに発生します。

あなたjshintがerroringされている場合は、あなたが 'リターン' を必要とする活字体+ TSlint

+0

は答えをいただき、ありがとうございます。私はEsLintに切り替えました。 – yosrO

1

考えるとクリーン[表示] - 矢印の機能に

it('should should clear qa cookies using the qa command', function() { 
    return browser.waitForAngularEnabled(false) 
     .then(() => browser.get('cookies url')); 
}); 

it('should open product page', function() { 
    return browser.waitForAngularEnabled(true) 
     .then(() =>browser.get('page-url')) 
     .then(() =>browser.wait(() => element.all(by.css('locator')).first().isDisplayed())) 
     .then(() => expect(true).toBe(true)); 
});