javascript - AngularJS e2e Testing with Protractor and remote api -
i test angular app heavily dependent on api. api being tested separately phpunit , creating fixtures ideally hoping not have create set of mocked fixtures in angular. using protractor chrome driver right now.
first have login through page not angular app.
i go page shows loader ng-if='loadingcards'
, hides table ng-if='!loadingcards'
, when api call retrieve cards finished, value of loadingcards
flipped.
below beginning of test spec gets through non angular login , takes card listing page. see contents of cards
$scope variable see api has indeed returned empty array.
describe('user cards page', function() { var driver; var ptor; beforeeach(function() { ptor = protractor.getinstance(); ptor.ignoresynchronization = true; browser.ignoresynchronization = true; driver = ptor.driver; }); it('should login', function() { driver.get('http://local.local.com/login'); driver.findelement(protractor.by.name('_username')).sendkeys('admin'); driver.findelement(protractor.by.name('_password')).sendkeys('admin'); driver.findelement(protractor.by.css('input[type="submit"]')).click(); }); it('should list cards', function() { browser.get('http://local.local.com/cms/cards'); var ucards = element.all(by.repeater('card in cards')).then(function(cards) { console.log(cards); }); //expect(ucards.count()).toequal(3); }); });
i think mixing 2 things. can either write:
element.all(by.repeater('card in cards')).then(function(cards) { console.log(cards); });
or:
var ucards = element.all(by.repeater('card in cards')); ucards.then(function(cards) { console.log(cards); });
but making kind of ... both.
do errors? check current url?
expect(browser.getcurrenturl()).toequal('http://local.local.com/cms/cards');
greetings!
Comments
Post a Comment