Image
The Image class simplifies images interactions in Spartify tests, offering selecting, assertion, and scrolling functionalities. These methods improve test maintainability and execution efficiency, ensuring a robust test framework
Class : Image
The Image class is designed to interact with the images based element
import { SpartiUI } from "@spartify.io/spartify-engine";
SpartiUI.image(this.file_element).selectFile(‘c:/myfile.png’):
Methods & Usage
Navigation Methods
isVisible(): boolean
Asserts that the image is visible on the page.
@return {boolean}True if the image is visible, otherwise false.
SpartiUI.image(this.img_element).isVisible();
isHidden(): boolean
Asserts that the image is hidden on the page.
@return {boolean}True if the image is hidden , otherwise false.
SpartiUI.image(this.img_element).isHidden();
click(): void
Simulates a click action on the image.
@return void
SpartiUI.image(this.img_element).click();
forceClick(): void
Forces a click action on the image, bypassing any potential blockers.
@return void
SpartiUI.image(this.img_element).forceClick();
hoverOver(): void
Simulates a hover action over the image.
@return void
SpartiUI.image(this.img_element).hoverOver();
Assertions
assertImageIsLoaded(): void
Asserts that the image has been successfully loaded.
@return void
SpartiUI.image(this.img_element).assertImageIsLoaded();
assertImageIsBroken(): void
Asserts that the image is broken (failed to load).
@return void
SpartiUI.image(this.img_element).assertImageIsBroken();
assertImageDimensions(width: number, height: number): void
Asserts that the image dimensions match the specified width and height.
@param {number} width - the expected width of the image.
@param {number} height - the expected height of the image.
@return void
SpartiUI.image(this.img_element).assertImageDimensions(720, 100);;