Skip to content

Validate that screenshot has .png extension #81

@aleksslitvinovs

Description

@aleksslitvinovs

saveScreenshot() allows passing any extension into path parameter and no errors are thrown. IMO, before making a screenshot, it must be verified that filename has .png extension

Here's an example script

import static testUI.UIOpen.open;
import static testUI.Utils.By.byCssSelector;
import static testUI.elements.TestUI.E;

import org.testng.annotations.Test;

public class Testing {
    @Test
    public void test() {
        open("https://example.com");

        E(byCssSelector("")).saveScreenshot("test.png"); // valid screenshot

        E(byCssSelector("")).saveScreenshot("test.y4m"); // invalid screenshot extension
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions