-
Notifications
You must be signed in to change notification settings - Fork 946
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
opencti-platform/opencti-front/tests_e2e/model/form/loginForm.pageModel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Page } from '@playwright/test'; | ||
import TextFieldPageModel from '../field/TextField.pageModel'; | ||
|
||
export default class LoginFormPageModel { | ||
nameField = new TextFieldPageModel(this.page, 'Login', 'text'); | ||
passwordField = new TextFieldPageModel(this.page, 'Password', 'text'); | ||
|
||
constructor(private page: Page) {} | ||
|
||
getPage() { | ||
return this.page.getByTestId('login-page'); | ||
} | ||
|
||
getSignInButton() { | ||
return this.page.getByRole('button', { name: 'Sign in' }); | ||
} | ||
|
||
async login(name?: string, pwd?: string) { | ||
await this.nameField.fill(name ?? 'admin@opencti.io'); | ||
await this.passwordField.fill(pwd ?? 'admin'); | ||
return this.getSignInButton().click(); | ||
} | ||
} |