CheckBox

The Check Box class provides a clean interface for interacting with generic container elements such as <checkBox> blocks. It includes methods for selection, assertions, and scrolling into view.

Usage : checkBox

🧩 Code

The CheckBox class is designed to interact with common check-box element

To insert a code block with syntax highlighting:

import { oi } from "@ordino.ai/spartify-engine";

oi.ui.checkbox(this.cbx_element).check(true)

Methods

check(forceClick?: boolean): void

Checks the checkbox.

@returns void

oi.ui.checkbox(this.cbx_element).check(true)

uncheck(forceClick?: boolean): void

Unchecks the checkbox.

@returns void

oi.ui.checkbox(this.cbx_element).uncheck(true)

toggleCheck(forceClick?: boolean): void

Toggles the checkbox state.

@returns void

oi.ui.checkbox(this.cbx_element).toggleCheck(true)

checkAll(forceClick?: boolean): void

Checks all checkboxes.

@returns void

oi.ui.checkbox(this.cbx_element).checkAll(true)

uncheckAll(forceClick?: boolean): void

Unchecks all checkboxes.

@returns void

oi.ui.checkbox(this.cbx_element).uncheckAll(true)

checkByIndex(index: number): void

Checks the checkbox at the specified index. @param index - the index of the checkbox to check.

@returns void

oi.ui.checkbox(this.cbx_element).checkByIndex(2, true)

uncheckByIndex(index: number): void

Unchecks the checkbox at the specified index. @param index - the index of the checkbox to uncheck.

@returns void

oi.ui.checkbox(this.cbx_element).uncheckByIndex(2, true)

checkByText(text: string): void

Checks the checkbox with the specified text. @param text - The text of the checkbox to check.

@returns void

oi.ui.checkbox(this.cbx_element).checkByText('test',true)

uncheckByText(text: string): void

Unchecks the checkbox with the specified text. @param text - the text of the checkbox to uncheck.

@returns void

oi.ui.checkbox(this.cbx_element).uncheckByText('test',true)

clickWithOffset(x: number, y: number, forceClick:boolean): void

Clicks the checkbox with an offset. @param x - The x offset. @param y - The y offset

@returns void

oi.ui.checkbox(this.cbx_element).clickWithOffset(1,2,true)

Assertions

isChecked(): void

Asserts that the checkbox is checked.

@returns void

oi.ui.checkbox(this.cbx_element).isChecked()

isNotChecked(): void

Asserts that the checkbox is not checked

@returns void

oi.ui.checkbox(this.cbx_element).isNotChecked()

assertIsIndeterminate(): void

Asserts that the checkbox is in an indeterminate state.

@returns void

oi.ui.checkbox(this.cbx_element).assertIsIndeterminate()

assertCheckedCount(count: number): void

Asserts that the number of checked checkboxes matches the specified count. @param count - the expected number of checked checkboxes.

@returns void

oi.ui.checkbox(this.cbx_element).assertCheckedCount(1)

assertUncheckedCount(count: number): void

Asserts that the number of unchecked checkboxes matches the specified count. @param count - the expected number of unchecked checkboxes.

@returns void

oi.ui.checkbox(this.cbx_element).assertUncheckedCount(2)

assertIsDisabled(): void

Asserts that the checkbox is disabled.

@returns void

oi.ui.checkbox(this.cbx_element).assertIsDisabled()

assertIsEnabled(): void

Asserts that the checkbox is enabled.

@returns void

oi.ui.checkbox(this.cbx_element).assertIsEnabled()

isContained(text: string): void

Asserts that the checkbox contains the specified text. @param text - the text to check for containment.

@returns void

oi.ui.checkbox(this.cbx_element).isContained('test')

isEqual(text: string): void

Asserts that the checkbox text is equal to the specified text.

@returns void

oi.ui.checkbox(this.cbx_element).isEqual('test')

isNotEqual(text: string): void

Asserts that the checkbox text is not equal to the specified text. @param text - the text to compare.

@returns void

oi.ui.checkbox(this.cbx_element).isNotEqual('test')

Scrolling

scrollToElement(): void Scrolls to the checkbox element.

@returns void

oi.ui.checkbox(this.cbx_element).scrollToElement()

Custom Events

Ordino allows you to build custom actions or user journeys by directly interacting with the underlying tool’s native methods and actions.

This approach gives you full control, bypassing Ordino’s abstraction layer, and ensures you can leverage tool-specific capabilities as needed.

  • locator → The element locator (e.g., XPath, CSS selector, or tool-specific reference).

  • Returns → A tool element object on which you can invoke native actions (e.g., .check(), .uncheck()).

// Generic pattern
element(locator): object

Ordino Custom Mode

Using Ordino’s direct tool method reference:

// Ordino direct-to-tool approach
oi.ui.element('@xpath').check()

Here, Ordino will call the Cypress (or other tool) element object directly, rather than going through Ordino’s wrapper.

Building User Journeys

By chaining multiple oi.ui.element() calls, you can construct full user journeys while still working with native tool methods.

Example: Login Flow

// Enter username
oi.ui.element('//input[@id="username"]').type('testuser')

// Enter password
oi.ui.element('//input[@id="agreed"]').check({ force: true })

// Click login button
oi.ui.element('(//*[contains(text(),"Login")])[1]').check()

Key Notes

  • Use this mode when you need maximum control over the test framework.

  • This does not abstract or transform the call – it executes directly on the tool object (e.g., Cypress, Playwright, etc.).

  • Perfect for custom journeys, advanced locators, or tool-specific actions not exposed by Ordino’s higher-level API.

Last updated