javascript - Why toBe () does not work in the test - protractor e2e -
i'm running test, following message. can me how solve this? , how can write text eg password incorrect? alert , console.log not work me.
my code: app.e2e-spec.ts
import { fobosfrontendbackofficepage } './app.po'; import { browser, by, element, promise, elementfinder, key, protractor } 'protractor'; import {actionsequence, by, capabilities, command wdcommand, filedetector, icommandname, options, session, targetlocator, touchsequence, until, webdriver, webelement, webelementpromise} 'selenium-webdriver'; import {extend extendwd, extendedwebdriver} 'webdriver-js-extender'; import {promise wdpromise} 'selenium-webdriver'; import {error wderror} 'selenium-webdriver'; import {response} '@angular/http'; describe('frontend backoffice app', () => { let page: fobosfrontendbackofficepage; beforeeach(() => { page = new fobosfrontendbackofficepage(); }); it('should navigate browser', () => { page.navigateto(); }); it('login panel', () => { var login = element(by.name('username')).sendkeys('test'); var passwordfield = element(by.css('input[ng-reflect-name="password"]')).sendkeys('assadsa'); var buttonsubmit = element(by.buttontext('dalej')).click(); }); it('result test', () => { var result = element(by.classname('msg')); if(result != null){ expect(result.isdisplayed().tobe(true)); } else{ expect(result.isdisplayed().tobe(false)); } }); });
my log running test:
[15:49:14] i/update - chromedriver: unzipping chromedriver_2.32.zip [15:49:14] i/update - chromedriver: chromedriver_2.32.exe date [15:49:14] i/launcher - running 1 instances of webdriver [15:49:14] i/direct - using chromedriver directly... [15:49:18] e/launcher - error: tserror: ⨯ unable compile typescript e2e\app.e2e-spec.ts (41,31): property 'tobe' not exist on type 'promise<boolean>'. (2339) e2e\app.e2e-spec.ts (47,31): property 'tobe' not exist on type 'promise<boolean>'. (2339)
you're doing wrongly. should like:
expect(result.isdisplayed()).tobe(true)
Comments
Post a Comment