반응형
블로그 이미지
개발자로서 현장에서 일하면서 새로 접하는 기술들이나 알게된 정보 등을 정리하기 위한 블로그입니다. 운 좋게 미국에서 큰 회사들의 프로젝트에서 컬설턴트로 일하고 있어서 새로운 기술들을 접할 기회가 많이 있습니다. 미국의 IT 프로젝트에서 사용되는 툴들에 대해 많은 분들과 정보를 공유하고 싶습니다.
솔웅

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

카테고리


반응형


Leaving a memo

customerNameList() {return element.all(by.css("#items")).

all(by.css(".list-item-title"));}

This customerNameList() fetches customer name list data.

step.Then(/^Check sorting$/, (done: Callback)=> {
let sorted = [] , unSorted = [];
let cName = customerViewPage.customerNameList();

cName.map(function(eachName){
return eachName.getText().then(function(unSorted){
return unSorted;
});
}).then(function(unSorted){
let sorted = unSorted.slice();
sorted = sorted.sort(); //sort the array
for(let i = 0; i < sorted.length; i++){
console.log(' Array1 : ' + sorted[i] +

' is equals to Array2 : ' + unSorted[i]);
expect(sorted[i]).is.equal(unSorted[i]);
}
done();
});
});

Check sorting results.

unSorted[] array will have current customer name list.

sorted[] array is sorting the current customer name list.


compare sorted[] and unSorted[]

if pass then the customer list is sorted properly.


step.Then(/^Check sorting$/, (done: Callback)=> {
let sorted = [] , unSorted = [];
let cName = customerViewPage.customerNameList();
let i = 0;
cName.each(function(eachName){
eachName.getText().then(function(name){
// unSorted[i] = name.toLowerCase();
unSorted[i] = name;
i++;
});
}).then(function(){
sorted = unSorted.slice();
sorted.sort();
for(let i = 0; i < sorted.length; i++){
console.log(' Array1 : ' + sorted[i] +

' is equals to Array2 : ' + unSorted[i]);
expect(sorted[i]).is.equal(unSorted[i]);
}
done();
});
});


This step has the same functionality as above.




let statelist:any;
 let sortedStatelist:any;
 addCustomerPage.state().click().then(()=>{
   addCustomerPage.stateDropDownOptions().then(function (actualListOfStates) {
     statelist=actualListOfStates.slice();
     sortedStatelist=statelist.sort();
     // expect(statelist).to.contains(sortedStatelist);
     for(let i=0;i<sortedStatelist.length;i++){
       expect(statelist[i]).is.equal(sortedStatelist[i]);
     }
     done();
   })
 })


Fetch items from dropdown menu and check sorting status.



JavaScript Array slice() Method


var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var citrus = fruits.slice(1, 3);


Orange,Lemon



Definition and Usage

The slice() method returns the selected elements in an array, as a new array object.

The slice() method selects the elements starting at the given start argument, and ends at, but does not include, the given end argument.

Note: The original array will not be changed.



반응형