2017-05-09 17 views
1

これはoi.selectのテンプレートhtmlです。分度器とoi.selectオプションをクリックしてください。

<oi-select class="oi-select" 
    oi-options="group.name for group in groups track by group._id" 
    multiple placeholder="" ng-model="selectedGroups"> 
</oi-select> 

私はそれが唯一のオプションをクリックtest.js

element(by.model('selectedGroups')).click().then(function() { 
    element.all(by.repeater("(group, options) in groups")) 
     .then(function (guests) { 
      guests[0].click(); 
     }); 
}); 

に次のコードを試してみました。 guests[0].getText()はすべてのグループ名ラベルを付与します。あなたがそれを前に解決してくれたら助けてください。私はselectの多くの例を試しましたが、特定したoi.selectはありません。ありがとう。

+0

。 – wswebcreation

+0

利用可能なすべてのオプションをクリックしますか? –

+0

@wswebcreationはい、私は1つのオプションしか選択できません。それは無作為のようです。 –

答えて

0

インデックスまたは値/文字列で選択する場合のサンプルコードです。
選択されるインデックス/値は配列内にあります。
そのユーザーは複数の値を選択できます。私はhttps://tamtakoe.github.io/oi.select/を見て、サンプルテストを作成する場合、私は選択を開いて、オプションを選択することができるよので、あなたが持っているものの質問は、何ですか

describe('test', function() { 
    var arrIndex = [2, 0]; 
    var arrString = ['jeans', 'belt']; 
    var elmModel = element(by.model('query')); 

    it('open browser', function() {  
     browser.get('https://tamtakoe.github.io/oi.select/#/select/#multiple'); 
    }); 

    it('test index', function() {  
     browser.get('https://tamtakoe.github.io/oi.select/#/select/#multiple'); 
     var elmRptr = element.all(by.repeater('option in options')) 
     selectByIndex(0, arrIndex, elmRptr); 
    }); 

    it('test string', function() {  
     selectByString(0, arrString); 
    }); 

    function selectByString(i, arrTemp) { 
     if (i < arrTemp.length) { 
      elmModel.click(); 
      var elmString = element(by.cssContainingText('[ng-repeat="option in options"]', arrTemp[i])); 
      elmString.click(); 
      selectByString(i + 1, arrTemp); 
     } 
    } 

    function selectByIndex(i, arrTemp, elmTemp) { 
     if (i < arrTemp.length) { 
      elmModel.click(); 
      elmTemp.get(arrTemp[i]).click(); 
      selectByIndex(i + 1, arrTemp, elmTemp); 
     } 
    } 
}); 
+0

お時間をいただきありがとうございます。すごい。それは私のプロジェクトでうまくいきます。 –

関連する問題