Skip to content

Commit

Permalink
Write new login fail test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan committed Feb 20, 2023
1 parent afaffba commit 6106e58
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Feature: spaces management
And "Admin" navigates to the users management page
And "Admin" forbids the login for the following user "Alice" using the sidebar panel
And "Admin" logs out
Then "Alice" fails to log in
13 changes: 13 additions & 0 deletions tests/e2e/cucumber/steps/ui/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ async function LogInUser(this: World, stepUser: string): Promise<void> {
const user = this.usersEnvironment.getUser({ key: stepUser })
await page.goto(config.frontendUrl)
await sessionObject.login({ user })
await page.waitForSelector('#web')
}

Given('{string} has logged in', LogInUser)
Expand All @@ -40,11 +41,23 @@ Given('{string} has logged out', LogOutUser)

When('{string} logs out', LogOutUser)

When('{string} fails to log in', async function (this: World, stepUser: string): Promise<void> {
const sessionObject = await createNewSession(this, stepUser)
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const user = this.usersEnvironment.getUser({ key: stepUser })
await page.goto(config.frontendUrl)
user.password = 'fail'
await sessionObject.login({ user })
await page.waitForSelector('#oc-login-error-message')
})

When(
'{string} logs in from the internal link',
async function (this: World, stepUser: string): Promise<void> {
const sessionObject = await createNewSession(this, stepUser)
const { page } = this.actorsEnvironment.getActor({ key: stepUser })
const user = this.usersEnvironment.getUser({ key: stepUser })
await sessionObject.login({ user })
await page.waitForSelector('#web')
}
)
1 change: 0 additions & 1 deletion tests/e2e/support/objects/runtime/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export class Session {

async login({ user }: { user: User }): Promise<void> {
await this.#adapter.login({ user })
await this.#page.waitForSelector('#web')
}

async logout(): Promise<void> {
Expand Down

0 comments on commit 6106e58

Please sign in to comment.