Hey Divya,
Jan Molak
11

Hi Jan,

Can a class like Start can only have a single method only? Is it a hard and fast rule the framework is dictating? Is there any other way that i can write 2 methods with in the same class and call the necessary methods?

import { PerformsTasks, Task } from 'serenity-js/lib/screenplay';

export class Start implements Task {

static withATodoListContaining(items: string[]) { // static method to improve the readability
return new Start(items);
}

performAs(actor: PerformsTasks): PromiseLike<void> { // required by the Task interface
return actor.attemptsTo( // delegates the work to lower-level tasks
// todo: add each item to the Todo List
);
}

constructor(private items: string[]) { // constructor assigning the list of items
} // to a private field
}
Like what you read? Give divya parvati a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.