Not too long ago I ran into a scenario where a test that I was composing needed to make an API call. The challenge was that one of the values needed for an API call was being stored in the browser’s session. The tool I was using didn’t support directly accessing the browser session. This post describes how I leveraged a combination of TestArchitect capabilities to achieve accessing the browsers session storage. Currently, LogiGear’s TestArchitect (TA) doesn’t contain any native keyword commands that would allow users to access values stored in the browsers local and session storage. Fortunately, the building blocks are there so this is what I did:
- Once it is in the DOM, we can easily retrieve it using the native Get Control Property keyword.
Here’s a sample from JSFiddle:
After getting the value out of local storage, the script stores the value in an attribute on the body tag. I made a custom action so that I could access any value from local storage as well as make it easy to reuse. Here’s what the final custom action looked like:
This post illustrates how we were able to extend capabilities by utilizing a custom action that could be used in numerous tests. Custom actions are a good way to encapsulate complex operations into a simple, easy to use keyword. Happy testing!