Skip to content

Label

The Label class simplifies label interactions in Spartify tests, offering selecting, assertion, and scrolling functionalities. These methods improve test maintainability and execution efficiency, ensuring a robust test framework

The Label class is designed to interact with the label element

import { SpartiUI } from "@spartify.io/spartify-engine";";
SpartiUI.label(this.lbl_element).click():

Methods & Usage

isEmpty(): void
Asserts that the text is empty.

@return void

SpartiUI.label(this.lbl_element).isEmpty();

isNotEmpty(): void
Asserts that the text is not empty.

@return void

SpartiUI.label(this.lbl_element).isNotEmpty();

isVisible(): boolean
Checks if the element is visible.

@return {boolean} true if the element is visible, otherwise false.

SpartiUI.label(this.lbl_element).isVisible();

isHidden(): boolean
Checks if the element is hidden.

@return {boolean} true if the element is hidden, otherwise false.

SpartiUI.label(this.lbl_element).isHidden();

isNotEqual(value: string): void
Asserts that the text is not equal to the given value.

@param value - the value to compare against.
@return void

SpartiUI.label(this.lbl_element).isNotEqual(‘hello’);

isEqual(value: string): void
Asserts that the text is equal to the given value.

@param value - the value to compare against.
@return void

SpartiUI.label(this.lbl_element).isEqual(‘hello’);

isContained(value: string): void
Asserts that the text contains the given value.

@param value - the value to check for containment.
@return void

SpartiUI.label(this.lbl_element).isContained(‘hello’);

isOneOfIt(value: string[]): void
Asserts that the text is one of the given values.

@param value - the array of possible values.
@return void

SpartiUI.label(this.lbl_element).isOneOfIt([‘hi’, ‘hello’]);

isToBeClosed(value: number, range: number): void
Asserts that the text is within a certain range of the given value.

@param value - the base value to compare against.
@param range - the acceptable range.
@return void

SpartiUI.label(this.lbl_element).isToBeClosed(10,50);

Assertions

assertPartialText(text: string): void
Asserts that the text partially matches the given string.

@param text - the partial text to match.
@return void

SpartiUI.label(this.lbl_element).assertPartialText(‘hello’);

assertTextLength(length: number): void
Asserts that the text length matches the given length.

@param length - the expected length of the text.
@return void

SpartiUI.label(this.lbl_element).assertTextLength(10);

assertTextMatches(regex: any): void
Asserts that the text matches the given regular expression.

@param regex - the regular expression to match.
@return void

SpartiUI.label(this.lbl_element).assertTextMatches([$//?*]);

assertCssProperty(property: string, value: string): void
Asserts that the CSS property matches the given value.

@param property - the CSS property to check.
@param value - the expected value of the CSS property.
@return void

SpartiUI.label(this.lbl_element).assertCssProperty(‘value’, ‘hi’);

assertText(value: string): void
Asserts that the text matches the given value.

@param value - the value to match.
@return void

SpartiUI.label(this.lbl_element).assertText(‘hi’);