effect-playwright
    Preparing search index...

    Interface PlaywrightClockService

    Interface for a Playwright clock.

    interface PlaywrightClockService {
        fastForward: (ticks: string | number) => Effect<void, PlaywrightError>;
        install: (
            options?: { time?: string | number | Date },
        ) => Effect<void, PlaywrightError>;
        pauseAt: (time: string | number | Date) => Effect<void, PlaywrightError>;
        resume: Effect<void, PlaywrightError>;
        runFor: (ticks: string | number) => Effect<void, PlaywrightError>;
        setFixedTime: (
            time: string | number | Date,
        ) => Effect<void, PlaywrightError>;
        setSystemTime: (
            time: string | number | Date,
        ) => Effect<void, PlaywrightError>;
        use: <T>(f: (clock: Clock) => Promise<T>) => Effect<T, PlaywrightError>;
    }
    Index

    Properties

    fastForward: (ticks: string | number) => Effect<void, PlaywrightError>

    Advance the clock by jumping forward in time. Only fires due timers at most once. This is equivalent to user closing the laptop lid for a while and reopening it later, after given time.

    Clock.fastForward

    0.1.0

    install: (
        options?: { time?: string | number | Date },
    ) => Effect<void, PlaywrightError>

    Install fake implementations for time-related functions.

    Clock.install

    0.1.0

    pauseAt: (time: string | number | Date) => Effect<void, PlaywrightError>

    Advance the clock by jumping forward in time and pause the time.

    Clock.pauseAt

    0.1.0

    resume: Effect<void, PlaywrightError>

    Resumes timers. Once this method is called, time resumes flowing, timers are fired as usual.

    Clock.resume

    0.1.0

    runFor: (ticks: string | number) => Effect<void, PlaywrightError>

    Advance the clock, firing all the time-related callbacks.

    Clock.runFor

    0.1.0

    setFixedTime: (time: string | number | Date) => Effect<void, PlaywrightError>

    Makes Date.now and new Date() return fixed fake time at all times, keeps all the timers running.

    Clock.setFixedTime

    0.1.0

    setSystemTime: (time: string | number | Date) => Effect<void, PlaywrightError>

    Sets system time, but does not trigger any timers.

    Clock.setSystemTime

    0.1.0

    use: <T>(f: (clock: Clock) => Promise<T>) => Effect<T, PlaywrightError>

    A generic utility to execute any promise-based method on the underlying Playwright Clock. Can be used to access any Clock functionality not directly exposed by this service.

    Type Declaration

      • <T>(f: (clock: Clock) => Promise<T>): Effect<T, PlaywrightError>
      • Type Parameters

        • T

        Parameters

        • f: (clock: Clock) => Promise<T>

          A function that takes the Playwright Clock and returns a Promise.

        Returns Effect<T, PlaywrightError>

        An effect that wraps the promise and returns its result.

    Clock

    0.1.0