Log out through the site, the way its account menu does (Gitea's "Sign Out" link, Forgejo's "Sign out" button of the menu's form), and wait until the session is a visitor's.
Examples
When I log out
When we log out
And I log out
Then I log out
When log out
Pattern
When(/^(I |we )*log out$/, …)
Part of @webship-js/gitea-steps (github.com/webship/gitea-steps), a step pack for Webship-js 2.0.x.