-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[playwright] chore: Separate login test (#48)
- Loading branch information
1 parent
b377ef0
commit 5504171
Showing
4 changed files
with
43 additions
and
7 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
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
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,35 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
import { allure } from 'allure-playwright'; | ||
import LoginPage from '../pages/LoginPage'; | ||
import NotesPage from '../pages/NotesPage'; | ||
|
||
let page: Page; | ||
let loginPage: LoginPage; | ||
let notesPage: NotesPage; | ||
|
||
const timeout = 60 * 1000; | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
await allure.feature('User Login'); | ||
page = await browser.newPage(); | ||
loginPage = new LoginPage(page); | ||
notesPage = new NotesPage(page); | ||
}); | ||
|
||
test.beforeEach(async () => { | ||
await loginPage.goto(); | ||
}); | ||
|
||
test.describe('Notes App Login', { tag: ['@PRODUCTION'] }, async () => { | ||
test('should see user successfully logged in', async () => { | ||
await loginPage.login('dave', 'test'); | ||
await expect(page).toHaveTitle(/Notes/, { timeout }); | ||
await expect(notesPage.spinnerContainer()).toBeHidden({ timeout }); | ||
}); | ||
test('should see error message when login fails', async () => { | ||
await loginPage.login('dave', 'wrongpassword'); | ||
await expect(loginPage.loginErrorText()).toHaveText( | ||
'Invalid username or password' | ||
); | ||
}); | ||
}); |
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
5504171
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage for this commit
Coverage Report