Div
The Checkbox class simplifies div interactions in Spartify tests, offering selecting, assertion, and scrolling functionalities. These methods improve test maintainability and execution efficiency, ensuring a robust test framework
The Div class is designed to interact with the div element
Click Actions
import { SpartiUI } from "@spartify.io/spartify-engine";";SpartiUI.div(this.div_element).click();
Methods & Usage
click(): void
Simulates a click on the div element.
@return void
SpartiUI.div(this.div_element).click();
forceClick(): void
Forces a click on the div element, bypassing any potential blockers.
@return void
SpartiUI.div(this.div_element).forceClick();
doubleClick(forceClick:boolean): void
Simulates a double-click on the div element.
@param forceClick - { force: true } optional
@return voidSpartiUI.div(this.div_element).doubleClick({ force: true });
rightClick(): void
Simulates a right-click on the div element.
@param forceClick - { force: true } optional
@return voidSpartiUI.div(this.div_element).doubleClick({ force: true });
clickDivWithCoordinates(x: number, y: number,forceClick:boolean): void
Simulates a click on the div element at the specified coordinates.
@param x - the x-coordinate for the click.
@param y - the y-coordinate for the click.
@param forceClick - { force: true } optional
@return void
SpartiUI.div(this.div_element).clickDivWithCoordinates(23,54,{ force: true });
centerClick(forceClick:boolean): void
Simulates a click on the center of the div element.
@param forceClick - { force: true } optional
@return voidSpartiUI.div(this.div_element).centerClick({ force: true });
multiElementClick(forceClick:boolean): void
Simulates a click on multiple div elements.
@param forceClick - { force: true } optional @return void
SpartiUI.div(this.div_element).multiElementClick({ force: true });
firstElementClick(forceClick:boolean): void
Simulates a click on the first div element in a collection.
@param forceClick - { force: true } optional @return void
SpartiUI.div(this.div_element).firstElementClick({ force: true });
lastElementClick(forceClick:boolean): void
Simulates a click on the last div element in a collection.
@param forceClick - { force: true } optional @return void
SpartiUI.div(this.div_element).lastElementClick({ force: true });
getDivText(): void
Retrieves the text content of the div element.
@return void
SpartiUI.div(this.div_element).getDivText();
Assertions
assertDivIsVisible(): boolean
Asserts that the div element is visible.
@return bool - true if the div is visible, otherwise false.
SpartiUI.div(this.div_element).assertDivIsVisible();
assertDivIsNotVisible(): boolean
Asserts that the div element is not visible.
@return bool - true if the div is visible, otherwise false.
SpartiUI.div(this.div_element).assertDivIsNotVisible();
assertDivIsEmpty(): boolean
Asserts that the div element is empty.
@return bool - true if the div is visible, otherwise false.
SpartiUI.div(this.div_element).assertDivIsEmpty();
Scrolling
scrollUntill(): void
Scrolls until the div element is in view.
@return void
SpartiUI.div(this.div_element).scrollUntill();