protractor

Protractor 'toContain' error

让人想犯罪 __ 提交于 2020-01-05 06:47:13
问题 This is my expect: expect(mandatoryFields[index].getAttribute('class')).toContain('error'); This is the error in console: Expected['formControl ng-pristine ng-untouched ng-valid ng-empty ng-valid-maxlength error'] to contain 'error'. Eventhough the class contains ERROR class name, protractor is still throwing error. What could be reason? Any help!!! 回答1: Instead of toContain try using toMatch . toContain is used to check whether the required value is present in an array or not. whereas

clicking button using executescript in protractor - POM

自古美人都是妖i 提交于 2020-01-05 05:00:34
问题 I have to click a button and since it is not clicking directly, i am using the below code and it is working. var create = element(by.css('button[title="Add Master Obligation"]')) browser.executeScript("arguments[0].scrollIntoView();arguments[1].click();", create, create); I want to put the same for page object model in protractor. So, i have added like this. page.ts: var mo = function () { this.createbutton = function () { var create = element(by.css('button[title="Add Master Obligation"]'))

using external module in protractor test - cannot use namespace as a type

喜欢而已 提交于 2020-01-05 04:36:10
问题 I am trying to split my project into two separate projects and then reuse files between them. Now that I am using my Helper class as an external module, I am getting errors trying to use it in my test. Am i importing/exporting the module incorrectly? - Cannot use namespace 'Helper' as a type - Cannot use 'new' with an expression whose type lacks a call or construct signature. main project test.ts import Helper = require('sub-project'); describe(`Test Description`, () => { let helper: Helper;

'ExpectedConditions' does not exist on type 'typeof protractor'

主宰稳场 提交于 2020-01-04 15:17:09
问题 I'm writing a protractor test in TypeScript in Visual Studio 2013 and I'm getting the error: Property 'ExpectedConditions' does not exist on type 'typeof protractor'. I read a similar question (here) but it did not help my situation. This is my page objects code: class SheetObjects { EC = protractor.ExpectedConditions; showList = element(by.buttonText('Show as List')); copyItem = element.all(by.binding('item.name')).get(2); copyDiv = element(by.className('md-inline-list-icon-label'));

jasmine protractor typescript to continue execution after one expected failure in it block

▼魔方 西西 提交于 2020-01-04 13:49:37
问题 I am using protractor-jasmine framework with typescript - so i have multiple it blocks within describe , so within each it block there are many methods or expect conditions i am verifying- so currently when one of the expect failed then whole it block is terminated , so i want to continue the execution even after one step fail. Below is Spec.ts it('Should display Introduction screen with title correctly', () => { page.navigateTo('/'); console.log('Verifying Title is displayed...'); expect

jasmine protractor typescript to continue execution after one expected failure in it block

我的梦境 提交于 2020-01-04 13:48:22
问题 I am using protractor-jasmine framework with typescript - so i have multiple it blocks within describe , so within each it block there are many methods or expect conditions i am verifying- so currently when one of the expect failed then whole it block is terminated , so i want to continue the execution even after one step fail. Below is Spec.ts it('Should display Introduction screen with title correctly', () => { page.navigateTo('/'); console.log('Verifying Title is displayed...'); expect

ScriptTimeoutError: Timed out - From: Task: Protractor.waitForAngular()

て烟熏妆下的殇ゞ 提交于 2020-01-04 06:03:46
问题 I am trying to run basic end to end tests written using protractor. I always get this error. ScriptTimeoutError: Timed out I checked this link https://github.com/angular/protractor/blob/master/docs/timeouts.md and increased the default timeout, but still I get the same error. I am not able to figure out from where this error pops out. The browser loads the base Url, later it will not perform any action as mentioned in the test. The test is very simple , open the browser and click on the menu

Headless protractor not sharding tests

亡梦爱人 提交于 2020-01-04 05:21:10
问题 I am trying to run my tests headless and shard both my test suites to run them in parallel. On my local machine they run in parallel but in this headless setup they run one after the other. I am using docker images for the web driver and protractor. I am using webnicer-protractor docker image: https://hub.docker.com/r/webnicer/protractor-headless/ and using elgalu/selenium for the web driver. My conf.js that I run looks like this: exports.config = { //Headless //seleniumAddress: 'http:/

How to restore database before executing test in protractor

元气小坏坏 提交于 2020-01-04 02:48:08
问题 I have written E2E tests in Protractor which uses node to run through webdriver. Now I have some inserts tests which will insert the data and create user. Now if I run the case for the first time it will pass but when I will rerun the test it will fail as it will already present. Expected : I need to restore my MSSQL DB when ever the tests in protractor start. Present : I am doing manually by restoring the test. Is there any way that I can restore the DB through protractor or Node ? 回答1: This

How to reflect chaining (ControlFlow) of Protractor (WebDriver) actions in TypeScript

柔情痞子 提交于 2020-01-03 18:57:50
问题 In a protractor test it is possible to chain actions like "clear" and "sendKeys" on an Element like this: element(by.id('myId')).clear().sendKeys('123456789') I like the compact style of it. But why does it work? According to the API Docs of webdriver.Element.clear() the return type of clear() is webdriver.promise.Promise.<void> When i compile it with TypeScript (1.8.x), the compiler complains that there is no property called sendKeys() on Promise . And I think that's actually the case. I