Skip to main content

Kreya 1.17 - What's New

Silvan
Silvan

Kreya 1.17 comes with the new Kreya Script, which can control operation invocation with JavaScript. Support has been added for importing HAR files, the JWT auth provider, exporting operations as cURL and gRPCurl commands and many more features have been implemented.

New Kreya Script Pro / Enterprise

This release introduces a new way of scripting in Kreya. It's now possible to create a script outside the context of an operation. To do this, you can create a script file and call an operation with plain JavaScript.

An animation showcasing creating an Kreya Script and running it.

Calling operations multiple times, waiting for a response and so on, you are completely free to do anything in this script. Here is an example of what a script might look like.

// Invoke an operation that starts a long running job on the server
await kreya.invokeOperation('start-long-running-job');

let finished = false;
while (!finished) {
const result = await kreya.invokeOperation('fetch-job-status');
finished = result.success;

if (!finished) {
kreya.sleep(500);
}
}

// Now invoke an operation that fetches the job result and performs tests on it
await kreya.invokeOperation('fetch-job-result');

See the documentation for more examples and information. This feature can only be used with a Pro or Enterprise plan, if you want to give this a try, there is a 10 day trial period.

Importing HAR files

A disadvantage of gRPC over REST is browser support. You cannot just look at a request in the browser's development tools. You have to decode everything first. This is sort of fixed with the new HAR file import. You can simply export your requests to a HAR file in the browser's development tools and import it into Kreya. If the proto files for those requests are present in Kreya, you can simply read each request and response in Kreya.

An animation showcasing importing requests with a HAR file.

JWT (signed with a static key) auth provider

A new auth provider is available with the new release: JWT (signed with a static key). To create such an auth config, just open the authentications tab and create one with this type and fill in all the details.

An animation showcasing creating an JWT auth config.

Exporting operations as cURL and gRPCurl commands

Operations can be exported as cURL and gRPCurl commands. Simply open the context menu of an operation and copy it to the clipboard.

An animation showcasing exporting operations as cURL command.

User variables editor

User variables can now be viewed and edited in Project > User variables. You can set a user variable in scripts with kreya.variables.set("hello", "world");.

An animation showcasing viewing user variables.

Searching for operations, directories and collections

We have also implemented a quick search in the operation list to find operations, directories and collections. Just click on the new search button or press Ctrl+F or +F and enter your search string.

An animation showcasing searching operations, directories and collections.

Support reading and writing files in scripting API Pro / Enterprise

It is now possible to read and write files from your operation script. This can be used for snapshot testing, for example.

import { expect } from 'chai';
import { readFile } from 'fs/promises';

const verified = await readFile('say_hello.verified.txt', 'utf8');

kreyaGrpc.onResponse(msg => {
kreya.test('Verify response', () => expect(msg.content.message).to.eql(verified));
});

See the documentation for more examples and information.

Connecting via unix-socket (e.g. to the Docker daemon)

You can now connect via unix-socket with a normal REST request. Just enter a valid unix-socket address in the endpoint field (e.g. for the Docker daemon unix:///var/run/docker.sock) and send your request.

An animation showcasing connecting via unix-socket.

See the documentation for more examples and information.

Bug fixes

Many bugs have been fixed. More details can be found on our release notes page.

If you find a bug, please do not hesitate to report it. You can contact us at [email protected] for any further information or feedback.

Stay tuned! 🏄