lundi 27 avril 2015

How to prevent browser.driver.sleep

I have the below spec which is working fine, but I want to prevent using browser.sleep():

it('should go to the item details page', function () {
    browser.get(testOptions.baseUrl+testOptions.cpdmPath+testOptions.itemDetailsForAttachment);
    browser.getCurrentUrl().then(function() {
            //browser.driver.sleep('4000');
            console.log('inside then 4');                
            browser.driver.sleep('4000');
            element(by.css('.md-header-items-container')).isDisplayed().then(function (isVisible) {
                if (isVisible) {
                    // element is visible
                    browser.driver.sleep('4000');
                    element.all(by.repeater('(key, value) in tabList')).count().then(function (numberOfTabs) {
                        //console.log(numberOfTabs);
                    });
                    element.all(by.repeater('(key, value) in tabList')).get(4).click().then(function () {
                        browser.driver.sleep('4000');
                        element(by.css('.hidden-attachment-info-bar')).isDisplayed().then(function (isVisible) {
                            expect(isVisible).to.equal(true);
                        })

                    });
                } else {
                    // element is not visible
                    console.log('is invisible');
                }
            });
    })
});

Aucun commentaire:

Enregistrer un commentaire