e2e-testing

Using Data Objects while E2E testing with Protractor

你离开我真会死。 提交于 2019-12-06 05:24:05
So a coworker and I were discussing making a data object for our e2e tests. From my understanding about data objects they are used for decoupling your test suites. For example, my first test suite is to create an account and to test if the fields are valid and the second test suite logins into the account and does its own tests. I am told it is good to use data objects (not a page object) just incase the first test suite fails when making an account. That way we can use the data object in the second test suite to create a new user just for testing login. My problem is that if my first test

React Native + Appium iOS elementByAccesibilityId.text()

主宰稳场 提交于 2019-12-06 05:22:22
I'm writing tests for React Native using Appium + Jest for both Android and iOS. Here's my React Native element: <Text accessibilityLabel={'emailError'}>Invalid email</Text> Here's the Promise chain I created to extract the value of a React Native Text element: driver.elementByAccessibilityId('emailError') .then(error => error.text()) .then(errorText => expect(errorText).toBe('Invalid email')) On Android, this test passes. On iOS, this test fails, and errorText === 'emailError' . Why is this, and is there a solution that works cross-platform for extracting text? I had the same issue. Using

Is there a way in TestCafe to validate Chrome network calls?

左心房为你撑大大i 提交于 2019-12-06 03:21:01
I have a test case where I need to navigate to a webPage and validate the network calls in chrome browser for that page. Ideally, I would take them in a variable and filter them for certain analytics related calls and validate their values. This can be done through chrome capabilities in Selenium. See doc here: http://chromedriver.chromium.org/logging/performance-log but I am trying to do this through testCafe? I came across this documentation: https://devexpress.github.io/testcafe/documentation/test-api/intercepting-http-requests/ on testCafe site but I am not sure if this is same as getting

btstrpd Error when testing AngularJS app with Protractor

梦想的初衷 提交于 2019-12-05 20:56:24
I’m currently trying to do some E2E testing of an AngularJS app using Protractor and I’m stuck with the btstrpd error. I'm new to AngularJS (I'm just the test automation guy in the project), so I’d really appreciate any pointers on how to make it run. Basically I just copied and pasted the sample configuration and specification from the Protractor tutorial and adapted it for my project: // conf.js exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['spec.js'], rootElement: 'html' } // spec.js describe('Protractor Demo App', function() { it('should have a title',

How to use Fake timers with nightwatch.js and sinon.js?

旧巷老猫 提交于 2019-12-05 18:40:35
I'm doing JavaScript e2e test with nightwatch.js, and I want to mock the clock with sinon.js's fake timer http://sinonjs.org/docs/#clock But test stops before finish it, I got the log like below, and doesn't progress anymore. [some test] Test Suite =============================== ✔ Element <body> was visible after 5000 milliseconds. My test code is like below. How can I solve the problem? Thank you. module.exports = { before: function(browser) { clock = sinon.useFakeTimers(new Date(2015, 7, 20).getTime()); }, after: function(browser) { clock.restore(); browser.end(); }, 'some test': function

Cypress test: is .contains() equivalent to should('contain')?

女生的网名这么多〃 提交于 2019-12-05 16:47:45
Is this: cy.get('[name=planSelect]').contains(dummyPlan) equivalent to this: cy.get('[name=planSelect]').should('contain', dummyPlan) And if so, which is preferred? The first is more of an implicit assertion, but it's shorter and cleaner to my mind. Follow-up question: After looking around to see how best to select elements for e2e testing I found that the Cypress docs recommend using data-cy attributes. Is there a reason this would be better than just adding name attributes to the markup? Should name only be used for forms fields? The result on your cypress test will be the same if the

Is there a programmatic way to change user agent in Cypress.io?

走远了吗. 提交于 2019-12-05 10:10:45
I have some ad calls that are only made on mobile devices. In Chrome, I can use Device Mode and simulate a mobile device, and the resulting ad call from the server is correctly tailored to mobile. I'm not sure how Chrome does this, except possibly by sending a different user agent. In the Cypress.io documentation, it says the user agent can be changed in the configuration file (Cypress.json). But, I need to run a test for a desktop viewport and then a mobile viewport with a mobile user agent. Is there a way to change the user agent programmatically? The other answers do not set the User-Agent

Protractor e2e test table header and <tr>,<td> tags

限于喜欢 提交于 2019-12-05 08:42:08
I am using below table. In that I want to test each tag(th, td tags), Text in that tags and count of that text. HTML snippet <table class="table table-striped"> <tbody> <tr> <th><b><a ng-href="" ng-click="predicate='id';reverse=!reverse">Patient Id</a></b></th> <th><b><a ng-href="" ng-click="predicate='accountNumber';reverse=!reverse" class="">Account Number</a></b></th> <th><b><a ng-href="" ng-click="predicate='title';reverse=!reverse">Title</a></b></th> <th><b><a ng-href="" ng-click="predicate='firstName';reverse=!reverse">First Name</a></b></th> <th><b><a ng-href="" ng-click="predicate=

How to log Google Analytics calls in Testcafe?

℡╲_俬逩灬. 提交于 2019-12-04 19:57:02
I am trying to automatically test tracking code and I am using the RequestLogger from Testcafé . I succeeded to intercept calls to example.com and localhost but not to https://www.google-analytics.com/ . What could be the reason? Expected This test should be green Test code import { RequestLogger } from 'testcafe'; const logger_ga = RequestLogger('https://www.google-analytics.com/'); fixture `localhost` .page('http://localhost:8000') test .requestHooks(logger_ga) ('logs calls to Google Analytics', async t => { await t.click("#ga-button"); console.log(logger_ga.requests); // is empty due to

Angular2 e2e test case with protractor throwing error

荒凉一梦 提交于 2019-12-04 18:23:01
I have created my app with angular2-webpack-starter and i have used socket.io with it. I have created one common service to create socket connection and listen its method. this service is used and initialized after user is logged in. When app is running and i execute test case for login, i am checking url with below code : browser.getCurrentUrl().then((url) => { expect(url).toEqual('/dashboard'); }); The issue is when socket is connected its throwing error 'Timed out waiting for Protractor to synchronize with the page after 15 seconds' and if socket is not connected same test case is running