creating and resolving promises in protractor

后端 未结 3 2004
抹茶落季
抹茶落季 2020-12-05 07:36

I am writing a test case for adding store information in the page for Angular app using Protractor, where initially I am counting the number of stores I already have and aft

3条回答
  •  孤城傲影
    2020-12-05 08:01

    I got the same issue and solved it by creating a promise for the expected item count:

    it('should accept valid data for adding new store', function() {
        // Given
        let expectedCountAfterNewRow = items.count().then((cnt)=>{return cnt+1}); 
        // Note: items.count() is a promise so the expected count should a promise too
    
        // When
        /* Code for adding test fields in store page */
    
        // Then
       expect(items.count()).toEqual(expectedCountAfterNewRow);
    });
    

提交回复
热议问题