Kaixa, a simple and customizable way to write Katalon tests
Kaixa is pronounced "Kaisha" and is taken from the Catalan word for "box" as in "toolbox"
Quickstart
You need node
and npm
installed. Visit nodejs.org to install those.
1. Navigate to your Katalon project in terminal
cd ~/Katalon\ Studio/MyProject
2. Add Kaixa using the npm init kaixa
command
npm init kaixa
Updating Kaixa
To update Kaixa, just repeat steps 1 and 2 whenever you want to update your version of Kaixa.
cd ~/Katalon\ Studio/MyProject
npm init kaixa
Writing Tests
1. Create a test and switch to "script" view
2. Use Kaixa functions to write your test
That's it! Here's an example:
// Log in
Kaixa.typeInto('#username', 'TestUser');
Kaixa.typeInto('#password', '149t8q23y');
Kaixa.click('#login-button');
// Do something interesting
Kaixa.click('.btn-interesting');
// Close the tool
Kaixa.click('#close-button');
// Clean everything up
Kaixa.done();
Functions by Category:
Interactions – interact with stuff on the page
- chooseFile - set the file for a file chooser
- chooseSelectByLabel - choose select item by label
- chooseSelectByValue - choose select item by value
- click - click something
- clickByContents - click something (find it by its contents)
- openAnchorInSameTab - click an anchor but force it to open in the same tab
- pause - wait until the user clicks to continue
- runScript - run javascript on the page
- scrollTo - scroll to an element
- typeInto - type text into an element
- visit - visit a page
Browser Actions – interact with the browser
- done - close the browser and clean up
- closeWindow - just close the current window
Harvard Functions – special functions for interacting with Harvard services
- handleHarvardKey - handle a HarvardKey login page
Canvas & LTI Functions – special functions for Canvas apps
- launchAs - launch an LTI as a user
- visitCanvasEndpoint - visit a Canvas API GET endpoint
Intelligent Waiting – wait better
- waitFor - wait for a set amount of time
- waitForElementAbsent - wait until an element is absent
- waitForElementPresent - wait until an element is present (on the page even if offscreen)
- waitForElementVisible - wait until an element is visible (on the page and visible)
- waitForElementWithContentsPresent - wait for ane element with specific contents to be present (on the page even if offscreen)
- waitForElementWithContentsVisible - wait for an element with specific contents to be visible (on the page and visible)
Assertions – make sure your app behaves properly
- assertAbsent - make sure an element is absent
- assertAbsentWithContents - make sure an element is absent (find it by its contents)
- assertDoesNotHaveClass - make sure an element does not have a certain css class
- assertExists - make sure an element exists
- assertExistsWithContents - make sure an element exists (find it by its contents)
- assertHasClass - make sure an element has a certain css class
- assertNumElements - make sure an element shows up a certain number of times
Handy Functions – useful utilities
- uniquify - add a unique, random tag to a string
- uniquifySimple - add a simple unique, random tag to a string
- prompt - ask the user to provide text
- promptPassword - ask the user to provide a password
- getProfileValue - get a value from the profile
Elements – deal with elements
- find - find an element by its css selector
- findByContents - find an element by its contents and selector
- findChildOfAncestor - find an element by traversing the element tree up to an ancestor and back down to a child
- elementAbsent - check if an element is absent
- elementExists - check if an element exists
- elementWithContentsAbsent - check if an element is absent (find it by its contents)
- elementWithContentsExists - check if an element exists (find it by its contents)
- descendantOf - get the descendant of an element
- parentOf - get the parent of an element
- getNumElements - get the number of elements on a page that match a selector
Data – get data from the page or elements
- extractDataFromClass - extract data from a css class
- extractDataFromClassByContents - extract data from a css class (find the element by its contents)
- getAttribute - get the value of an element attribute
- getJSON - get the JSON on the page
- getQuery - get the query parameters
- getSource - get the page source
- getText - get the text inside an element
- getTitle - get the title of the page
- getURL - get the URL of the current tab
- getCurrentMonth - get the current month
- getCurrentDay - get the current day
- getCurrentYear - get the current year
- getDateString - get the current date in mm/dd/yyyy format
- getMonthAfterDays - get the month that it will be after a certain number of days
- getDayAfterDays - get the day that it will be after a certain number of days
- getYearAfterDays - get the year that it will be after a certain number of days
- getDateStringAfterDays - get the date in mm/dd/yyyy format as it will be after a certain number of days
- padNumber - pad a number so that it will be at least a certain number of digits
- isSafari - check if the current browser is Safari
Logging – write to the log
- log - add something to the log
Defaults – set behavior defaults
- setDefaultHost - set the default hostname
- setDontUseHTTPS - set whether to use HTTPS by default