Skip to main content

it

Callable

  • it(title: string, body: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, actors> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => void | Promise<void>): void
  • it(title: string, details: TestDetails, body: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, actors> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => void | Promise<void>): void

  • Declares a single test scenario.

    Example

    import { Ensure, equals } from '@serenity-js/assertions'
    import { describe, it } from '@serenity-js/playwright-test'

    describe(`Todo List App`, () => {

    it(`should allow me to add a todo item`, async ({ actor }) => {
    await actor.attemptsTo(
    startWithAnEmptyList(),

    recordItem('Buy some milk'),

    Ensure.that(itemNames(), equals([
    'Buy some milk',
    ])),
    )
    })

    it('supports multiple actors using separate browsers', async ({ actorCalled }) => {
    await actorCalled('Alice').attemptsTo(
    startWithAListContaining(
    'Feed the cat'
    ),
    )

    await actorCalled('Bob').attemptsTo(
    startWithAListContaining(
    'Walk the dog'
    ),
    )

    await actorCalled('Alice').attemptsTo(
    Ensure.that(itemNames(), equals([
    'Feed the cat'
    ])),
    )

    await actorCalled('Bob').attemptsTo(
    Ensure.that(itemNames(), equals([
    'Walk the dog'
    ])),
    )
    })
    })

    Learn more


    Parameters

    • title: string
    • body: (args: PlaywrightTestArgs & PlaywrightTestOptions & Omit<SerenityOptions, actors> & SerenityFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions & object, testInfo: TestInfo) => void | Promise<void>

    Returns void