Bright.ScreenPlay
1.0.5
See the version list below for details.
dotnet add package Bright.ScreenPlay --version 1.0.5
NuGet\Install-Package Bright.ScreenPlay -Version 1.0.5
<PackageReference Include="Bright.ScreenPlay" Version="1.0.5" />
paket add Bright.ScreenPlay --version 1.0.5
#r "nuget: Bright.ScreenPlay, 1.0.5"
// Install Bright.ScreenPlay as a Cake Addin #addin nuget:?package=Bright.ScreenPlay&version=1.0.5 // Install Bright.ScreenPlay as a Cake Tool #tool nuget:?package=Bright.ScreenPlay&version=1.0.5
Brightest ScreenPlay Package
A lightweight ScreenPlay Package
ScreenPlay Design Pattern
The Screenplay Design Pattern, introduced by Serenity BDD framework, is a high-level, user-centered approach to test automation. It provides a way to describe tests in a way that closely resembles how end-users interact with the system. This pattern focuses on modeling the user�s journey through the application and representing it as a series of tasks. The main benefit of using this pattern is that it makes tests easy to understand, even for non-technical stakeholders, as the tests are described in terms of user actions.
Getting Started and how to use
In the ScreenPlay pattern, the Actors are the ones doing things. In the package, there are 2 Actors defined that can be used in your test solution:
- CallAnApi
- OpenAWebPage
Create an actor
One of the first things that you need to do when you want to use this package is to define an Actor class that can do things This is an example class that uses the CallAnAPI actor class:
using Bright.ScreenPlay.Abilities;
using ScreenPlayExample.Responses;
namespace x.y.z
{
public class SomeApi : CallAnAPi
{
public SomeApi(){
Settings.BaseUrl = "SomeUrl"
}
}
}
The package also has some extension methods that allow you to write something like this:
var coBRHATypeZorgverleners = await restponse.Content.ReadAsJsonAsync<List<CoBRHATypeZorgverlener>>();
This is an example class that uses the OpenAWebPage Actor class
using Bright.ScreenPlay.Abilities;
using OpenQA.Selenium;
namespace x.y.z
{
public class SomePage: OpenAWebPage
{
public SomePage(){
Settings.BaseUrl = "SomeUrl"
}
public SomePage OpenMainPage(IWebDriver webDriver)
{
WebDriver = webDriver;
WebDriver.Navigate().GoToUrl(Settings.BaseUrl);
WebDriver.Manage().Window.Maximize();
WaitUntilElmentVisableByXpath("//a[@id='menuRegisterLink']");
return this;
}
}
}
In the OpenAWebpage class, there are some methods that can be used to interact with the webpage.
Create a question
To ensure the actor can do things, you need to create Question classes. This is an example of an implemented Question Class:
using Bright.ScreenPlay.Actors;
using Bright.ScreenPlay.Questions;
using ScreenPlayExample.Abilities;
namespace x.y.z
{
public TheQuestion : Question<List<string>>
{
public static async Task<List<string>> PerformGetCodeTableAs(IPerformer actor, string table)
{
return await actor.GetAbility<CodeTableAPI>().GetCodeTable(table);
}
public override List<string> PerformAs(IPerformer actor)
{
return new List<string>();
}
}
}
As you can see the Question class requires you to think about the response and also requires you to implement the PerformAs method.
Usage in the tests
This is an example of how you can use the ScreenPlay package in your tests:
using Bright.ScreenPlay.Actors;
using ScreenPlayExample.Abilities;
using ScreenPlayExample.Questions;
namespace ScreenPlayExample.StepDefinitions
{
[Binding]
public class CodeTableStepDefinitions
{
private Actor joe;
private string _table;
private List<string> _results;
[Given(@"I want to search the (.*)")]
public void GivenIWantToSearchTheTable(string table)
{
_table = table;
joe = new Actor("Joe");
joe.IsAbleTo<CodeTableAPI>();
}
[When(@"I send the request to search the code table")]
public async Task WhenISendTheRequestToSearchTheCodeTable()
{
_results = await TheCodeTable.PerformGetCodeTableAs(joe, _table);
}
[Then(@"The results of that table should contain data")]
public void ThenTheResultsOfThatTableShouldContainData()
{
_results.Should().NotBeEmpty();
_results.Count.Should().BeGreaterThan(1);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Bogus (>= 35.5.1)
- DotNetSeleniumExtras.WaitHelpers (>= 3.11.0)
- Newtonsoft.Json (>= 13.0.3)
- NLog (>= 5.3.2)
- Selenium.Support (>= 4.21.0)
- Selenium.WebDriver (>= 4.21.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.10 | 104 | 7/8/2024 |
2.0.9 | 92 | 6/27/2024 |
2.0.8 | 110 | 6/21/2024 |
2.0.7 | 103 | 6/18/2024 |
2.0.6 | 87 | 6/14/2024 |
2.0.5 | 87 | 6/13/2024 |
2.0.4 | 85 | 6/13/2024 |
2.0.3 | 85 | 6/12/2024 |
2.0.2 | 91 | 6/11/2024 |
2.0.1 | 94 | 6/10/2024 |
2.0.0 | 90 | 6/10/2024 |
1.0.6 | 98 | 6/6/2024 |
1.0.5 | 95 | 6/6/2024 |
1.0.4 | 94 | 6/5/2024 |
1.0.3 | 97 | 6/5/2024 |
1.0.2 | 95 | 6/4/2024 |
1.0.1 | 88 | 6/4/2024 |
1.0.0 | 90 | 6/4/2024 |