Using testcafe API client side only - testing

We have a server testing framework for our application already and are interested in using the client side event playing functionality of testcafe such as typeText() and click() at the client side only.
So basically I'm looking for a primer how to include the various client side testcafe .js files (such as testcafe/lib/client/driver/index.js, testcafe/lib/client/automation/index.js etc) in our pages in order and how to call the automation events client side only.
(I'm aware that this leaves the intended scope of testcafe, but may be someone else did already do what we are after)

The client-side TestCafe API depends on the server-side part and cannot work correctly for all cases without it. There are no plans to introduce such functionality. Please use TestCafe actions in a regular way.

Related

What types of dependencies available to do Api automation using selenium?

I am using rest-assured dependency in my project for testing API's with selenium.
Can anyone guide me why basically we use rest-assured dependency in API testing ? (Tried finding the answer from my seniors who developed our project framework and online, i couldnt get any answer why are we using this, it would help me if anyone guides me with the reason ?)
And what are the other ways to do API automation using selenium ?
why should we use them ? (in comparison with rest-assured ?)
Thank you.
Selenium is not typically used for REST API testing. Selenium is a tool that can control web browser. Despite a web browser is a sort of HTTP client, it is very specific client that is intended for browsing web and maintain high level of user security. The above puts certain degree of restriction of what you can and cannot do with the browser. For example:
You can only fire GET request from the address bar
You can do POST request using HTML form but you have to have an HTML page with the form and fixed set of parameters
You can overcome the above if have the page with any javascript client so that you can configure different requests configurations
Points 2 and 3 basically mean you have another level of communication in your framework and that level has to be properly maintained. That's because Web Browser is not naturally intended for interacting with API. But only with very narrow part of what HTTP can offer (again we can overcome that restriction by javascript code executed within the browser but that would be another level of complexity).
RestAssured is pure HTTP client with some handy and neat functionality allowing to easily manipulate with requests and responses. So it allows to fire any type of requests supported by HTTP protocol, parse responses responses and verify them (often all in a single statement).
The latter is naturally designed for interacting with REST API, does not introduce extra levels to your tests, does not have limitation like the browsers have.
Recap
The below schema demonstrates the difference of having your API tests implemented in both approaches:
Selenium case:
Selenium binding lib -> Web Driver -> Browser -> API GET (rarely others - need to maintain special file for that)
Rest-Assured case:
Rest-Assured lib -> API ANY SORT OF REQUESTS
P.S. - In the same way as RestAssured handles API case much effectively than Selenium, Selenium handles Web Testing in much more effective way than RestAssured since the latter cannot neither control browsers nor even execute JAvaScript code. That is why we have two such a powerful and great tools each of which perfectly serves the needs it naturally designed for.
Just because Rest-Assured (RA) is a code-based tool to test API. It supports:
make HTTP(s) request
extract value from response
assert response
Selenium is tool to control web browser, it CANNOT do API testing.
I don't know why you compare Selenium to Rest-Assured. They are 2 different tools that serves 2 different purposes.

Selenium Jmeter differences on websocket calls

I am researching the differences between Selenium and JMeter and I stumbled across the following statement about Selenium:
Even though WebSocket might be encapsulated into a web session and
affect the browser, the user/Selenium will not realise it. So, we will
use JMeter for testing WebSockets.
which confuses me because even though Selenium can't detect that specific scenario, Selenium still uses a programming language like JAVA, hence you can still use Java to accomplish the same thing JMeter does in this case. Or am I missing something here?
I don't know what you're reading however I would recommend stopping referring this source as they don't really realize what they're talking about.
According to The WebSocket API documentation:
The WebSocket API is an advanced technology that makes it possible to open a two-way interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.
Selenium is browser automation framework therefore you get this WebSocket API support "for free". If you need to perform some custom use cases you can use JavascriptExecutor to call WebSocket object functions.
When it comes to JMeter:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
Therefore JMeter will not trigger any WebSocket-related events unless you use a plugin and manually open connection, send message, read response, etc.

Automation in Go Lang - How to use browser automation like Selenium?

I am new to Golang. And I am looking for automating signup, login processes in a web app. Please suggest a good tool like Selenium and how can I implement it in the go language.
I want to do the following process automatically using Golang:
Start a browser. Currently, I'm using https://github.com/skratchdot/open-golang
Auto entry on the signup page and auto-submit a form.
Login check for the registered user. Everything needs to be done automatically for more users.
You can also use Playwright for Go, which is a wrapper for the Playwright project. Playwright provides a single API to automate Chromium, Firefox, and WebKit to automate browsers which was created by Microsoft. With it you interact with the sites, record videos, make screenshots, and emulate other browser specific behaviour.
If you are going to use GO for web automation testing - Selenium is a good option. Still it's nothing more than a library that allows you to interact with browsers. So you are going to need to develop your own framework or reuse someone already implemented.
My advice is to consider Agouti, since it supports Ginkgo BDD and xUnit Gomega. Everything else is pretty much the same from architectural perspective. You can design it like any other language binding. There are common patterns that appear over and over again in browser automation frameworks, like
PageObjects: A simple abstraction of the UI of your web app.
LoadableComponent: Modeling PageObjects as components.
BotStyleTests: command-based approach
Another good resource for building your Test framework is the xunitpatterns guide. It gives a great content overview of the patterns, smells and refactoring strategies you can use. Also look at this test frameworks tutorial. It'll help you choose the most proper solution for your case.
My guess is that you are going to need some CI server support for
everything needs to be done auto for more users.
Here is a good article how-to achieve this with TravisCI.
update:
you can use Selenium for Golang

How to use Selenium with Digest Authentication?

I am looking for a good way to use Selenium with Digest Authentication (for a flex UI though I don't think that makes a difference if I can't do authentication). I'd like to avoid platform-dependencies such as using AutoIT to drive browser pop-ups (since cross-platform testing is a motivator for going to Selenium), though if there's a good cross-platform library for doing such things that would work fine.
I'm thinking maybe there is a way to use a separate http client to create a session and then pass the session credentials off to the browser, but I'm not sure how to inject the session ID into the browser requests. That's just an idea I had, not sure how feasible it is.
You could try using an HTTP proxy, such as AuthProxy by #CarlYoungblood.
It's an HTTP proxy server written in Ruby which was developed specifically for testing a server that required basic authentication with Selenium, but it should also work on a server with digest authentication.
Simply explained, you cannot automate a Flex UI from Selenium, as it doesn't handle Flash for testing (you can embed the flash plugin in your browser, but Selenium won't be able to test against flash component...)
Even if you can authenticate, you won't be able to test anything, so, you should try something else, like Sikuli

How to test logging in with openid using Selenium

Is there a way to test logging into a site with open id using Selenium?
In Selenium all the tests live in the server, so once filled the open id URL in the appropriate field in the web page I am taken to the 3rd party web page for entering the credentials and my test can't run anymore.
Is there a way around this?
Yes - use Selenium RC. It gets around the cross-domain problem of basic Selenium Core and allows you to script against multiple sites.
I guess, technically speaking, you could include a really dumb OpenID server on your testing domain, but Patrick's suggestion of a testing framework that supports cross-domain operations sounds like a much better idea.
Although, I guess that depends on what you're trying to test. It could be that using a third party OpenID server is bad for your tests, because a change to the UI of that server could cause your tests to break. Or maybe you want to make sure that your code is interoperating correctly with that server, in which case using the 3rd party is exactly what you want to test.