Skip to main content

3 posts tagged with "AskUI SDK"

View All Tags

2024.04.29 | AskUI SDK 0.18.0

· 2 min read
Johannes Dienst
Developer Advocate

Introduction

We had a bunch of releases today which will help you be more effective and also to integrate AskUI better in your current toolchain.

Our docs lacked a comprehensive source of common challenges about detecting elements and how to address them. Thus we created a Recommended Practices page and a separate Custom Elements page. Let us know if something is missing!

We were also able to release more Convenience methods in this version. They are more expressive and also shorter to write. Read about them below and also how to migrate to the new syntax for clickText() and clickButton().

Speaking of convenience: We also added an ESLint rule that checks for the correct usage of expect().

Last but not least we fixed a bug in our test environment implementation @askui/jest-allure-circus. It is now compatible with jest-cucumber. (Link to accompanying blog).


Breaking Changes

  • Method signature changed for clickText(). API docs
// Before
await aui.clickText('Hello World');

// Now
await aui.clickText({text: 'Hello World', type: 'similar'});
  • Method signature changed for clickButton(). API docs

// Before
await aui.click().button().withText('Submit').exec();

// Now
await aui.clickButton({label: 'Submit'});

New Features

New Convenience methods added to AskUI TypeScript SDK:

We expanded our npm package @askui/eslint-plugin-askui with a new rule that checks for the correct usage of expect()


Fixes

  • @askui/jest-allure-circus accepts the testEnvironmentOptions addCodeInReport now
    • Upgrade the dependency to version 1.0.23
// Usage
const config: Config.InitialOptions = {
...
testEnvironment: '@askui/jest-allure-circus',
testEnvironmentOptions: {
addCodeInReport: false
},
};
...

2024.03.25 | AskUI SDK Automations Directory Option

· One min read
Johannes Dienst
Developer Advocate

Introduction

This week we introduced a new convenience method clickTextfieldNearestTo(label: string) which lets you click on a textfield with a label instead of a placeholder.

We also removed the convenience method dragTo as it was not working as intended.

There is a new option -ad --automations-description for initialising an AskUI project with npx askui@latest init. It lets you specify the name of the automations directory which was hardcoded to askui_example before.

Convenience Methods

We had to remove dragTo() as it was not working as expected


We introduced the following method:

clickTextfieldNearestTo(label: string)

Searches for an element of type textfield with a specific label nearest to it. If found, clicks it.

await aui.clickTextfieldNearestTo('E-Mail Address');

New Option -ad --automations-description for init

When you run npx askui@latest init you always got a directory askui_example. This broke backwards compatibility with existing installations of AskUI.

Thus we introduced a new option when running askui init:

-ad, --automations-directory <value>  a name for the directory askui stores its configuration and workflows in. (default: "askui_example")

You can use it like this to store the AskUI automations in a directory askui-Workflows:

npx askui@latest init -ad askui-Workflows

2024.03.04 | AskUI SDK Convenience Methods

· 2 min read
Johannes Dienst
Developer Advocate

Introduction

This week we improved on our docs. A guide for setting up your terminal and extensions in Visual Studio Code on Windows will improve your experience while developing AskUI Workflows.

We also fixed a display bug at the Supported Keys page.

In version 0.14.0 of the AskUI SDK we introduced some convenience methods to free users from writing repetitive code. This speeds up the development of AskUI Workflows and improves readability. Make sure to read the convenience docs which give you a detailed description on how to use each method.

Visual Studio Code Setup on Windows

Visual Studio Code is our recommended editor for developing AskUI workflows. Our docs for the AskUI Development Environment now have a section that helps you to setup Visual Studio Code for developing AskUI workflows efficiently:

  • Terminal configuration
  • Recommended extensions for Jest Runner, ESLint & Live View

Convenience Methods

We introduced the following methods:


clickButton(label: string)

Searches for an element of type button with a label and clicks it when found.

await aui.clickButton('Sign Up');

clickIcon(description: string)

Clicks an icon based on a description.

await aui.clickIcon('Logo looking like an apple');

clickText(text: string)

Searches for a text element and clicks it when found.

await aui.clickText('A big bear');

clickTexts(texts: string[])

Searches for text elements and clicks them one after another when found.

await aui.clickTexts(['A big bear', 'Brown Fox', 'Walks into a bar']);

clickTextfield(placeholder: string)

Searches for an element of type textfield with a specific placeholder text. If found, clicks it.

await aui.clickTextfield('E-Mail Address');

dragTo(element1: Executable, element2: Executable)

warning

This method is not working as intended and will be removed with the next release!

Drags element1 to element2.

Both must be a moveMouse() or moveMouseTo() instruction as in the example below.

await aui.dragTo(
aui.moveMouseTo().text('AskUI'),
aui.moveMouseTo().text('UI Automation')
);

pressKeyNTimes(key: PC_AND_MODIFIER_KEY, times = 2)

Press a key multiple times. At least two times.

await aui.pressKeyNTimes('right');
await aui.pressKeyNTimes('left', 3);

pressKeys(keys: PC_AND_MODIFIER_KEY[])

Press an array of keys one after another.

await aui.pressKeys(['right', 'left', 'enter']);

waitUntil(AskUICommand: Executable, maxTry = 5, waitTime = 2000)

Wait until an AskUICommand does not fail.

Use it to wait for an element to appear like this:

await aui.waitUntil(aui.expect().text('GitHub').exists());