How to use the @nut-tree/nut-js/dist/lib/file-type.enum.FileType.PNG function in @nut-tree/nut-js

To help you get started, we’ve selected a few @nut-tree/nut-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sakuli / sakuli / packages / sakuli-legacy / src / context / common / actions / screen.function.spec.ts View on Github external
it("should call `screen.capture` with timestamp and custom path", async () => {
        // GIVEN
        const screenShotPath = join("test", "path", "to");
        const screenShotFileName = "screenshot";
        const screenShotFileExt = ".png";
        screen.capture = jest.fn(() => Promise.resolve("filename"));

        // WHEN
        await ScreenApi.takeScreenshotWithTimestamp(`${join(screenShotPath, screenShotFileName)}${screenShotFileExt}`);

        // THEN
        expect(screen.capture).toBeCalledTimes(1);
        expect(screen.capture).toBeCalledWith(screenShotFileName, FileType.PNG, screenShotPath, expect.stringMatching(/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}_/), "");
    });
});
github sakuli / sakuli / packages / sakuli-legacy / src / context / common / actions / screen.function.spec.ts View on Github external
it("should call `screen.capture` with fallback `cwd()`", async () => {
        // GIVEN
        const screenShotFileName = "screenshot";
        const screenShotFileExt = ".png";
        screen.capture = jest.fn(() => Promise.resolve("filename"));

        // WHEN
        await ScreenApi.takeScreenshot(`${screenShotFileName}${screenShotFileExt}`);

        // THEN
        expect(screen.capture).toBeCalledTimes(1);
        expect(screen.capture).toBeCalledWith(screenShotFileName, FileType.PNG, cwd());
    });