Programmatically create a session for kinetic in the browser

How can I programmatically create an auth session for kinetic on a browser and then get in and use kinetic without having to manually enter the credentials?

“Why on earth would you want to do that you lunatic?” - You presumably

Well…

I’m trying to handle the sign in logic for the web version of kinetic via the REST Api, to save from having to type in the details.

Specific use of this is automated testing in Browserstack, where at the moment, the first thing in every test is to navigate to the login page, wait for the inputs, type in the user credentials, click login and wait for the page to finish loading, redirect to the actual page to be tested, which is adding about 10s to the beginning of each of my tests.

Naturally, I am creating an entirely new browser for each test, so the cookies are completely cleared meaning the session is destroyed after every test, so I cannot just do the login once, and then do a bunch of tests.

As such, I am trying to emulate the calls made when kinetic signs in
image

I am then setting the cookies manually, specifically the two cookies that I can find at least

However, it still doesn’t then sign in, it gives the following warning and redirects to the login page


(Warning message: Connection failed, please review the username and password and try again)

However, the cookies are set correctly and although I seemingly don’t do anything with it, I am getting a valid GUID back for the session ID.

Cookies:
NAME: homepage__erp.token.auth
VALUE: URL ENCODED JSON containing the token returned by /TokenResource, the userName, an EMPTY password, and some expiry details.
DOMAIN: Correct domain WITHOUT “HTTPS://”
PATH: /KineticTest/Apps/Erp/Home
SAMESITE: Strict

Has anyone ever tried to get this to work before? Is there something I’m missing here?

3 Likes

I’m not familiar with BrowserStack but it appears to work with other testing frameworks. If BrowserStack was orchestrating PlayWright.Dev for example, you’d follow the auth instructions here:

Authentication | Playwright

Again, I haven’t tried this yet, but Playwright just added support for Entra ID logins too.

Microsoft Playwright Testing authentication

And kudos for automated testing!!!

Clapping Applause GIF

1 Like

In the 2024.2 presentation this morning, Epicor teased an internal browser scripting tool for automated testing!

3 Likes

I hope it’s not a sellable product like ATE (Automated Testing for Epicor). People can get testy when they have to pay to debug software that they already paid for. :person_shrugging: Unlike .NET, in web dev, there are already many good options available.

3 Likes

Isn’t that the point?

3 Likes

It is free (as in beer) at least that’s what we were told :safe_harbor:

3 Likes