protractor

How to make a list of failed specs using jasmine custom reporter to post to slack?

烈酒焚心 提交于 2019-12-21 05:14:15
问题 I am trying to work on a custom jasmine reporter and get a list of all the failed specs in the specDone function: specDone: function(result) { if(result.status == 'failed') { failedExpectations.push(result.fullName); console.log(failedExpectations); } } where failedExpectations will store an entire list of the failed specs and i need to access this in the afterLaunch function in the protractor config file. But due to the fact that the config file loads everytime a new spec runs it basically

Check there were no errors in the browser console with Protractor

a 夏天 提交于 2019-12-21 04:05:16
问题 I'm using Protractor to test AngularJS I want to check that at the end of the test no uncaught exceptions occurred and were printed to the browser console. Is there a simple way to do that? 回答1: If you're using Protractor with Jasmine, use the following code: afterEach(function() { browser.manage().logs().get('browser').then(function(browserLog) { expect(browserLog.length).toEqual(0); }); }); This will pass the test case if there are no console errors. If there are any console errors, the

protractor - launch chrome with to disable web security for cors

北城余情 提交于 2019-12-21 04:02:36
问题 So our application works in production with a CORS enabled. I have a project that isn't CORS enabled locally. Is there a way to disable web security for protractor? Is there a way for me to add arguments to the selenium instance ? We're looking for a configuration based solution. Our local development machines are pretty locked down on what we can install. So is this possible? What i have tried is setting chrome options: https://github.com/angular/protractor/issues/175 But that appears to

Testing templates in Protractor?

老子叫甜甜 提交于 2019-12-21 03:36:27
问题 What's the best way to write assertions that should apply across every page in a site? I'm testing to see if an element exists in the footer of my site, so the element should exist on all pages. I am thinking of writing a separate file for testing template elements of the site, and then include this in all specs. It doesn't seem like anyone else is doing this though? 回答1: First of all, for writing cleaner tests and having a better understanding of what your target site consists of, apply the

How to use Puppeteer in an Angular application

和自甴很熟 提交于 2019-12-21 03:32:54
问题 My question is simple but i don't understand if it's possible and in this case how it's possible ? I would like to use the puppeteer library in a angular application. https://www.npmjs.com/package/puppeteer it's the npm installation. But i don't understand how i can use it. For example i just want to make this script : const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto('https://example.com');

Protractor ,Jasmine timeout issue

橙三吉。 提交于 2019-12-21 02:42:06
问题 I'm doing e2e-testing with Protractor and Jasmine. Our application is in Angular. I have written given getPageTimeout: 500000 , allScriptsTimeout: 600000 , in the config file. Added defaultTimeoutInterval:500000 as per GitHub . Even then I'm getting the below exception. Appreciate any help. A Jasmine spec timed out. Resetting the WebDriver Control Flow. The last active task was: Protractor.waitForAngular() at [object Object].webdriver.WebDriver.schedule (C:\Users\AppData\Roaming\npm\node

“Stale element reference” error behavior undestanding

走远了吗. 提交于 2019-12-21 02:30:09
问题 Code 1: element(by.id('myButtonId')).click(); return element(by.id('myValidationSummaryId')).getText().then(function (val) { return val; }); Above code worked fine many times and then it started giving below error "Failed: stale element reference: element is not attached to the page document" this id 'myValidationSummaryId' is no where used before, clicking button posts form and success/failure message available from service side in 'myValidationSummaryId'. Code 2: return element(by.id(

Protractor + Java issues. (AngularJS)

橙三吉。 提交于 2019-12-21 02:26:25
问题 I wanted to install protractor in order to work with our AngularJS project. Everything went OK till I ran the command: webdriver-manager start ...and I got some errors: seleniumProcess.pid: 5421 Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncher : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass

Simple protractor test for isElementPresent failing with unsupported locator strategy

空扰寡人 提交于 2019-12-21 01:40:08
问题 My test: it('should allow login', function() { browser.get('index.html'); $('#username').sendKeys('administrator'); $('#password').sendKeys('password'); $('#login').click(); var logout = $('#logout'); expect($p.isElementPresent(logout)).to.eventually.be.true; }); But this errors out with: Error: Unsupported locator strategy: click at Error (<anonymous>) at Function.webdriver.Locator.createFromObj (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/locators.js

Selenium webdriver exits with error code 135

老子叫甜甜 提交于 2019-12-20 17:40:55
问题 I am new to protractor. I am getting the following error while trying to run Selenium tests using protractor I/hosted - Using the selenium server at http://localhost:4444/wd/hub I/launcher - Running 1 instances of WebDriver E/launcher - Error code: 135 E/launcher - Error message: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444 E/launcher - Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:4444 at ClientRequest.<anonymous> (c:\Users\SavDevService.SAVISIONLAB\AppData\Roaming\npm\node_modules