@@ -5,6 +5,9 @@ import { expect } from '@playwright/test'
55// ================
66// Navigation
77
8+ Given ( 'I am on the home/front page' , async function ( world :PlaywrightWorld ) {
9+ await world . page . goto ( world . baseUrl . toString ( ) , { timeout :world . worldConfig . stepTimeout } )
10+ } )
811Given ( 'I am on {string}' , async function ( world :PlaywrightWorld , path ) {
912 let url = new URL ( path , world . baseUrl )
1013 await world . page . goto ( url . href , { timeout :world . worldConfig . stepTimeout } )
@@ -30,26 +33,25 @@ When('I go back/forward/forwards', async function (world:PlaywrightWorld) {
3033} )
3134
3235// ================
33- // Interaction
36+ // Identities
3437
35- Given ( 'a/an/the {string}( user)( role)( browser)( identity) ' , async function ( world :PlaywrightWorld , identity ) {
36- await world . newIdentity ( identity )
38+ Given ( '(as ) a/an/the ( user ){string} ' , async function ( world :PlaywrightWorld , identity ) {
39+ await world . setIdentity ( identity )
3740} )
38- Given ( 'I am (logged in as ){string}' , async function ( world :PlaywrightWorld , identity ) {
39- if ( ! world . identities . has ( identity ) ) await world . newIdentity ( identity )
40- world . identity = identity
41+ Given ( '(as )a/an/the {string} user/role/browser/identity' , async function ( world :PlaywrightWorld , identity ) {
42+ await world . setIdentity ( identity )
4143} )
42- Given ( 'I am (logged in as )a/an/the {string}( user)( role)( browser)( identity)' , async function ( world :PlaywrightWorld , identity ) {
43- if ( ! world . identities . has ( identity ) ) await world . newIdentity ( identity )
44- world . identity = identity
44+ Given ( 'I am {string}' , async function ( world :PlaywrightWorld , identity ) {
45+ await world . setIdentity ( identity )
4546} )
46- Then ( 'as {string}' , async function ( world :PlaywrightWorld , identity ) {
47- if ( ! world . identities . has ( identity ) ) await world . newIdentity ( identity )
48- world . identity = identity
47+ Given ( 'I am a/an/the (user ){string}' , async function ( world :PlaywrightWorld , identity ) {
48+ await world . setIdentity ( identity )
4949} )
50- Then ( 'as a/an/the {string}( user)( role)( browser)( identity)' , async function ( world :PlaywrightWorld , identity ) {
51- if ( ! world . identities . has ( identity ) ) await world . newIdentity ( identity )
52- world . identity = identity
50+ Given ( 'I am a/an/the {string} user/role/browser/identity' , async function ( world :PlaywrightWorld , identity ) {
51+ await world . setIdentity ( identity )
52+ } )
53+ Then ( 'as {string}' , async function ( world :PlaywrightWorld , identity ) {
54+ await world . setIdentity ( identity )
5355} )
5456
5557// ================
0 commit comments