天道酬勤,学无止境

angular-e2e

使用 --element-explorer 运行 ng e2e 不起作用(Run ng e2e with --element-explorer not working)

问题 我想弄清楚如何调试我的端到端测试。 我在一个角度项目中使用protractor-cucumber-framework并使用protractor-cucumber-framework自定义框架。 Given('[...]', async () => { await page.goToMeetupsListPage(); const profile: Profile = getMichel(); await page.setProfile(JSON.stringify(profile)); await page.refreshPage(); }); 我在这种函数中设置了一个断点。 然后我运行命令ng e2e --element-explorer应该寻找断点。 然后我在启动时收到此错误: /Users/.../node_modules/protractor/built/debugger.js:212 doneDeferred.fulfill(true); ^ TypeError: doneDeferred.fulfill is not a function at Socket.tester.once (/Users/b.../node_modules/protractor/built/debugger.js:212:34) at Object.onceWrapper (events

2021-10-24 06:33:54    分类:技术分享    angular   protractor   e2e-testing   angular-e2e

量角器 - 无效的 SSL 证书(Protractor - invalid SSL certificate)

问题 我们有一个应用程序并在本地测试它显示无效的 SSL 证书警告。 通常我只会添加一个例外并继续。 但是无论如何,量角器是否可以忽略这一点? 我在 selenium 中看到了一些可以忽略 SSL 的功能,但在量角器中似乎找不到任何功能。 回答1 这对我有用,(在 conf 文件中): capabilities: { browserName : 'firefox', marionette : true, acceptInsecureCerts : true } 希望有帮助。 回答2 capabilities: { browserName: 'chrome', chromeOptions: { // for ci test args: ['--headless', 'no-sandbox', "--disable-browser-side-navigation", "--allow-insecure-localhost" /// for https sites: ignore ssl on https://localhost... /// further args please see https://peter.sh/experiments/chromium-command-line-switches/ ] } } 也许您想截取一些屏幕截图来测试错误发生的位置 import fs

2021-10-20 18:42:38    分类:技术分享    protractor   angular-e2e

Run ng e2e with --element-explorer not working

I'm trying to figure out how I can debug my end to end tests. I'm usage protractor in an angular project and using the protractor-cucumber-framework custom framework. Given('[...]', async () => { await page.goToMeetupsListPage(); const profile: Profile = getMichel(); await page.setProfile(JSON.stringify(profile)); await page.refreshPage(); }); I'm setting a break point in this kind of function. Then I run the command ng e2e --element-explorer which is supposed to look for break points. Then I get this error on launch: /Users/.../node_modules/protractor/built/debugger.js:212 doneDeferred

2021-10-07 19:05:35    分类:问答    angular   protractor   e2e-testing   angular-e2e

Mocking rest calls in functional e2e protractor tests in angular 4 project

We have a huge project and we have written a lot of test cases to cover a lot of real scenario user behavior in our e2e functional test cases. As the test goes on, it makes a lot of rest calls to complete the test cases. When we cover different browser in sauce lab it multiplies 5-9 times. What I want is to mock all the rest calls so that there will not be any real calls to the actual server but internally it will be handled. its for functional e2e test not unit test as we mocked all unit tests using jasmine spyOn. I have explored json-server and $httpBackend of protractor. son-server did not

2021-07-31 13:24:10    分类:问答    angular   protractor   angular-mock   angular-e2e   angular-test

Why is data-* attributes preferred for element selection over a plain ID attribute?

Cypress and many other posts around testing web applications suggest relying on a data attribute like data-cy or data-test-id for locating elements rather than relying on the id attribute. My understanding is that for two reasons: The modern way of re-using the components can lead to having multiple components of the same type and can lead to multiple of those IDs on the same page - But this should also apply to the 'data-cy' or 'data-test-id' attributes. When IDs are tied to CSS, there's a tendency to change them more often while data-* attributes may be less prone to change. Can someone

2021-07-12 12:18:11    分类:问答    selenium-webdriver   cypress   angular-e2e

How to disable or bypass MSAL authentication when running Angular e2e tests?

I want to set up some end to end tests for my Angular application, which requires the use of the MSAL library to authenticate with some downstream services. When I try to run my e2e tests locally, the MSAL library is forcing me to authenticate with a username/password. This is a problem because our CI/CD e2e testing should not have any human-intervention; thus I am looking for a way to either bypass the MSAL authentication or set up a service-account to login. Unfortunately there is not a lot of documentation surrounding MSAL for Angular (especially when it comes to e2e testing), but this

2021-06-23 02:30:40    分类:问答    angular   angular-cli   e2e-testing   msal   angular-e2e

Protractor - invalid SSL certificate

We have an application and testing this locally shows an invalid SSL certificate warning. Normally I would just add an exception and get on with it. However is there anyway for protractor to ignore this? I've seen some capabilities in selenium where SSL can be ignored but can't seem to find any in protractor.

2021-06-04 10:10:58    分类:问答    protractor   angular-e2e

angular e2e testing : how to test Service inject(use) another services

i'm trying to test my service with e2e test angular 7, my problem is i don't know how to do that: it's my service, (the methode return Observable): import { Injectable } from '@angular/core'; import { UrlDecoratorService } from "../../common/url-decorator.service"; import { APIFetcherService } from "../common/api-fetcher.service"; import { Observable } from 'rxjs'; import { IALChrono, ALChrono } from '../../common/IALChrono.interface'; @Injectable() export class AnnonceChronoDetailService { private months: string[]; constructor(private urlDecoratorService: UrlDecoratorService, private

2021-05-14 11:35:22    分类:问答    angular   protractor   e2e-testing   angular-test   angular-e2e

e2e testing angular 7: Failed: Cannot read property 'fetchData' of undefined

I'm trying to do some e2e testing for my service in angular 7, the method return Observable, this is my methode: import { Injectable } from '@angular/core'; import { UrlDecoratorService } from "../../common/url-decorator.service"; import { APIFetcherService } from "../common/api-fetcher.service"; import { Observable } from 'rxjs'; import { IALChrono, ALChrono } from '../../common/IALChrono.interface'; @Injectable() export class AnnonceChronoDetailService { private months: string[]; constructor(private urlDecoratorService: UrlDecoratorService, private apiFetcher: APIFetcherService) { }

2021-04-21 06:49:48    分类:问答    angular   protractor   e2e-testing   angular2-observables   angular-e2e

Failed: script timeout: result was not received in 11 seconds From: Task: Protractor.waitForAngular() - Locator: By(css selector, #my-btn)

I'm trying to write some e2e test for my Angular application using Protractor. I have a simple html button having id=my-btn which I want to click, using: $('#my-btn').click(); Unfortunately I'm getting the following errors: Failed: script timeout: result was not received in 11 seconds From: Task: Protractor.waitForAngular() - Locator: By(css selector, #my-btn) (Session info: chrome=73.0.3683.75) (Driver info: chromedriver=2.46.628411 (3324f4c8be9ff2f70a05a30ebc72ffb013e1a71e),platform=Mac OS X 10.14.3 x86_64) If before the click I set: browser.waitForAngularEnabled(false); then I don't get any

2021-04-19 21:09:08    分类:问答    angular   typescript   protractor   e2e-testing   angular-e2e