end-to-end

Using Protractor with PhantomJS

笑着哭i 提交于 2019-12-17 20:31:38
问题 I need to E2E test my AngularJS Application an Protractor seems like the right way to do it. Setup was fairly straightforward and it works like a charm in Chrome. I need however use headless browser and been researching on how to use Protractor with PhantomJS and I found this: Note: We recommend against using PhantomJS for tests with Protractor. There are many reported issues with PhantomJS crashing and behaving differently from real browsers. Above is from https://github.com/angular

In protractor, browser.isElementPresent vs element.isPresent vs element.isElementPresent

心已入冬 提交于 2019-12-17 04:31:09
问题 In protractor, there are, basically, 3 ways to check if an element is present: var elm = element(by.id("myid")); browser.isElementPresent(elm); elm.isPresent(); elm.isElementPresent(); Are these options equivalent and interchangeable, and which one should be generally preferred? 回答1: All function in a similar way with subtle differences. Here are few differences that i found - elm.isPresent() - Is an extension of ElementFinder and so waits for Angular to settle on page before executing any

What is browser.ignoreSynchronization in protractor?

≯℡__Kan透↙ 提交于 2019-12-17 02:34:29
问题 I have seen it so many times where people suggest to use: browser.ignoreSynchronization=true; // or false But I do not understand why do we need it? 回答1: The simple answer is that it makes protractor not wait for Angular promises, such as those from $http or $timeout to resolve, which you might want to do if you're testing behaviour during $http or $timeout (e.g., a "loading" message), or testing non-Angular sites or pages, such as a separate login page. For example, to test a button that

Protractor tests broke with no apparent reason: “Timed out waiting for asynchronous Angular tasks to finish”

≡放荡痞女 提交于 2019-12-13 00:36:01
问题 My Protractor tests are broken since last Monday ( 2018-03-26 ) and I don't know why. Last time they worked (and successfully passed) was Friday before that -- 2018-03-23 . How do I debug this issue? I tried so many things and ran out of ideas... Error output $ npm run e2e > myproj-spa@0.0.0 pree2e C:\W\cp\myproj\myproj.SPA > webdriver-manager update --standalone false --gecko false [12:54:20] I/update - chromedriver: file exists C:\W\cp\myproj\myproj.SPA\node_modules\protractor\node_modules

Cloning element finders

拟墨画扇 提交于 2019-12-12 11:34:02
问题 While researching available ElementFinder and ElementArrayFinder methods, I've noticed that there is a clone() method which is briefly documented: Create a shallow copy of ElementFinder. From what I understand, clone() is not coming from WebdriverJS and is a protractor-specific function. What I don't understand is why would you want to clone an element finder or an element finder "array" in your tests ? What use cases does clone() cover? I've looked into the protractor source code to find

How to use docker-compose to restore fresh databases quickly for integration tests?

拟墨画扇 提交于 2019-12-11 17:16:22
问题 I would like to run integration and end-to-end tests with a database in a known state for each run, to make the tests independent and repeatable. An easy way of doing this is to use docker-compose to create a database container which loads the scheme and data from a dump file each time. However, this is far too slow to restore the database for every test. A better way seems to be to restore the database once in a docker container or volume, and then copy (mount?) the container/volume database

Automatically start ASP.MVC project when running test project

坚强是说给别人听的谎言 提交于 2019-12-10 05:37:00
问题 I'm trying to set up a test project for my ASP website. For some tests I want to use selenium to perform end-to-end tests. Therefor my website has to be running so the tests can access the site. How can I start my website project when I run tests? 回答1: Please reference the following links. I believe it is possible, but will be a little tricky. These are detailed and provide information on doing this programmatically. Starting and stopping IIS Express programmatically https://www.reimers.dk

protractor: onPrepare for different test suites

﹥>﹥吖頭↗ 提交于 2019-12-10 04:29:19
问题 I have onPrepare in my conf.js file where I log in to the application. My understanding is every time I run 1 or more test suites, it first executes whatever is in onPrepare. This is great, as I use onPrepare to log into the application before running the tests. Issue is, I don't want to login when I run my login-spec.js suite. I could first logout before running through login-spec.js, but there must be a more elegant way to do this. 回答1: As far as I understand, you need a place for suite

Protractor return an object but expected - value of element.getText()

一曲冷凌霜 提交于 2019-12-10 03:00:56
问题 Unable to understand why it return an object not a value of text, some test code: describe('columns swap', function () { describe('location column ', function () { it('should swap right', function () { browser.sleep(10000); var fColumn = element(by.xpath('(//*[@class="k-link"])[2]')).getText(); console.log(fColumn); Console output: > columns swap > location column { ptor_: { controlFlow: [Function], > schedule: [Function], > getSession: [Function], > getCapabilities: [Function], > quit:

Protractor expected condition for element containing any text

给你一囗甜甜゛ 提交于 2019-12-09 19:10:31
问题 Is there a way how to check whether an element has any text in it? I already found textToBePresentInElement but this function checks for specified value and does not return a proper error if it fails. I'm population the element via API and it's loaded bit later, so I want the browser to wait till any information appears in the element and then check for correct value. Alternatively it would be also very helpful to manage to get a specific error message when EC fails: browser.wait(EC