E2E テスト用に Protractor を使い始めたばかりですが、テスト ケースの構造に少し問題があります。
テストを個別の仕様に分割して別の仕様から呼び出すことができるかどうか、またはこれを処理するための適切なヘルパー関数を作成するにはどうすればよいかわかりません。
リピーターで要素を見つけています。次に、リピーターの各要素の操作ごとにテストを行いたいと思います。このような並べ替え:
describe('tasty', function () {
'use strict';
var ptor;
beforeEach(function () {
ptor = protractor.getInstance();
ptor.get('http://localhost:8000/');
});
it('Should sample three tasty fruits of every kind on my shopping list.', function () {
ptor.findElement(protractor.By.className('fruitstore')).click();
var fruitshelves = ptor.findElements(protractor.By.repeater('fruit in fruits').column('header'));
fruitshelves.then(function(arr) {
for (var i=0;i<arr.length; i++) {
// Pick up three fruits of this kind from the shelf and put in shopping cart
// Should be listed on my shopping list
// Open the wallet
// Should have money
// Pay for the fruits and put it in your shopping bag
// Should be able to complete the transaction
// For each one of the fruits in your shopping bag
// Take a bite
// Should be tasty
}
});
});
});