Skip to content

Link

The Link 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 Link class is designed to interact with the link element

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

Methods & Usage

click(): void
Clicks the link.

@return void

SpartiUI.link(this.lnk_element).click();

forceClick(): void
Forces a click on the link.

@return void

SpartiUI.link(this.lnk_element).forceClick();

doubleClick(forceClick:boolean): void Double-clicks the link.

@param forceClick {boolean} the value to match.(Optional)
@return void

SpartiUI.link(this.lnk_element).doubleClick({force: true});

rightClick(forceClick:boolean): void Right-clicks the link.

@param forceClick {boolean} the value to match.(Optional)
@return void

SpartiUI.link(this.lnk_element).rightClick({force: true});

clickLinkAtCoordinates(x: number, y: number,forceClick:boolean): void Clicks the link at the specified coordinates.

@param x - The x-coordinate.
@param y - The y-coordinate.
@return void

SpartiUI.link(this.lnk_element).clickLinkAtCoordinates({force: true});

centerClick(forceClick:boolean): void Clicks the link at its center.

@return void

SpartiUI.link(this.lnk_element).clickLinkAtCoordinates({force: true});

clickFirst(forceClick:boolean): void Clicks the first link.

@return void

SpartiUI.link(this.lnk_element).clickLinkAtCoordinates({force: true});

clickLast(forceClick:boolean): void Clicks the last link.

@return void

SpartiUI.link(this.lnk_element).clickLast({force: true});

getLinkHref(): void Gets the href attribute of the link.

@return void

SpartiUI.link(this.lnk_element).getLinkHref();

isVisible(): boolean Asserts that the link is visible.

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

SpartiUI.link(this.lnk_element).isVisible();

isHidden(): boolean Asserts that the link is hidden.

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

SpartiUI.link(this.lnk_element).isHidden();

Assertions

assertLinkHrefContains(text: string): void Asserts that the href attribute of the link contains the specified text.

@param text - the text to check for in the href attribute.
@return void

SpartiUI.link(this.lnk_element).assertLinkHrefContains(‘//spartify.io’);

assertLinkHrefEquals(href: string): void Asserts that the href attribute of the link equals the specified href.

@param href - the href to compare with the link’s href attribute.
@return void

SpartiUI.link(this.lnk_element).assertLinkHrefEquals(‘https://spartify.io/’);

assertLinkText(text: string): void Asserts that the text of the link equals the specified text.

@param text - the text to compare with the link’s text.
@return void

SpartiUI.link(this.lnk_element).assertLinkText(‘spartify.io’);

Scrolling

scrollTo(): void Scrolls to the link.

@return void

SpartiUI.link(this.lnk_element).scrollTo();