Skip to content

Commit

Permalink
docs: improve the example code for autoLogin (#4019)
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Nov 22, 2023
1 parent 0318bbb commit 1e5dd80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,14 @@ If a session expires automatically logs in again.
```js
// inside a test file
// use login to inject auto-login function
Feature('Login');

Before(({ login }) => {
login('user'); // login using user session
});

// Alternatively log in for one scenario
Scenario('log me in', ( {I, login} ) => {
// Alternatively log in for one scenario.
Scenario('log me in', ( { I, login } ) => {
login('admin');
I.see('I am logged in');
});
Expand Down
6 changes: 4 additions & 2 deletions lib/plugin/autoLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ const defaultConfig = {
* ```js
* // inside a test file
* // use login to inject auto-login function
* Feature('Login');
*
* Before(({ login }) => {
* login('user'); // login using user session
* });
*
* // Alternatively log in for one scenario
* Scenario('log me in', ( {I, login} ) => {
* // Alternatively log in for one scenario.
* Scenario('log me in', ( { I, login } ) => {
* login('admin');
* I.see('I am logged in');
* });
Expand Down

0 comments on commit 1e5dd80

Please sign in to comment.