How to use the @serenity-js/core.Question.about function in @serenity-js/core

To help you get started, we’ve selected a few @serenity-js/core 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 jan-molak / serenity-js / packages / assertions / spec / Ensure.spec.ts View on Github external
actual: 'not-name',
        artifact: { expected: `'name'`, actual: `'not-name'` },
    }, {
        description: 'list',
        expected: [{ name: 'Bob' }, { name: 'Alice' }],
        actual: [{ name: 'Alice' }],
        artifact: { expected: `[\n  { name: 'Bob' },\n  { name: 'Alice' }\n]`, actual: `[\n  { name: 'Alice' }\n]` },
    }, {
        description: 'promise',
        expected: Promise.resolve(true),
        actual: Promise.resolve(false),
        artifact: { expected: `true`, actual: `false` },
    }, {
        description: 'question',
        expected: Question.about('some value', actor => true),
        actual: Question.about('some value', actor => false),
        artifact: { expected: 'true', actual: 'false' },
    }]).
    /** @test {Ensure.that} */
    it('emits an artifact describing the actual and expected values', ({ actual, expected, artifact }) => {
        const recorder = new EventRecorder();
        theStage.assign(recorder);

        return expect(Enrique.attemptsTo(
            Ensure.that(actual, equals(expected)),  // we don't care about the expectation itself in this test
        )).to.be.rejected.then(() =>
            PickEvent.from(recorder.events)
                .next(ActivityRelatedArtifactGenerated, e => e.artifact.map(value => {
                    expect(value.expected).to.equal(artifact.expected);
                    expect(value.actual).to.equal(artifact.actual);
                })),
        );
github jan-molak / serenity-js / examples / cucumber-domain-level-testing / features / support / screenplay / questions / ResultOfCalculation.ts View on Github external
export const ResultOfCalculation = () => Question.about>(`the result of the calculation`, (actor: Actor) => {
    const ability = InteractDirectly.as(actor);

    return Promise.resolve(ability.submit(new GetCalculationResult(ability.currentCalculationId())));
});
github jan-molak / serenity-js / packages / protractor / spec / screenplay / interactions / execute-script / ExecuteAsynchronousScript.spec.ts View on Github external
it('provides a sensible description of the interaction being performed when invoked with arguments', () => {
        const arg3 = Question.about('arg number 3', actor => void 0);

        expect(ExecuteScript.async(`arguments[arguments.length - 1]();`)
            .withArguments(Promise.resolve('arg1'), 'arg2', arg3).toString(),
        ).to.equal(`#actor executes an asynchronous script with arguments: [ a Promise, 'arg2', arg number 3 ]`);
    });
github jan-molak / serenity-js / packages / protractor / src / screenplay / questions / LastScriptExecution.ts View on Github external
static result(): Question {
        return Question.about(`last script execution result`, actor =>
            BrowseTheWeb.as(actor).getLastScriptExecutionResult());
    }
}
github jan-molak / serenity-js / packages / rest / src / screenplay / questions / LastResponse.ts View on Github external
static headers() {
        return Question.about<{ [header: string ]: string }>(`the headers or the last response`, actor => {
            return CallAnApi.as(actor).mapLastResponse(response => response.headers);
        });
    }
}
github jan-molak / serenity-js / packages / serenity-bdd / src / cli / screenplay / tasks / InvokeSerenityBDD.ts View on Github external
constructor(
        private readonly pathToArtifact: Path,
        private readonly args: Question  = Question.about(`no arguments`, actor => []),
        private readonly props: Question = Question.about(`no properties`, actor => []),
    ) {
        super();
    }
github jan-molak / serenity-js / packages / protractor / spec / screenplay / interactions / UseAngular.spec.ts View on Github external
        const IsSynchronisationEnabled = () => Question.about('angular synchronisation',
                actor => promiseOf(protractor.browser.waitForAngularEnabled()),
        );
github jan-molak / serenity-js / packages / assertions / spec / Pick.spec.ts View on Github external
function q(value: T): Question {
        return Question.about(`the animals`, actor => value);
    }
});