-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Chore: Major refactors in pageobjects #26015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
65be6ea
refactor: remove public keyword
ee67208
refactor: update tests to use doCreateChannel in SideNav
f97dcdd
refactor: rename newChannelBtnToolbar to btnSidebarCreate
7a71838
refactor: rename some locators, use locator directly
5c5623d
refactor: remove verifyTestBaseUrl, create constants file
3d44f6d
refactor: remove checkbox enum
bc0c28a
refactor: extract mongodb url to a constant
e17f864
refactor: remove ChannelCreation from index.ts
c3b59ea
refactor: simplify suite 10, rename some locators
74649a3
refactor: remove clearMessage.ts
fa13617
refactor: add data-qa-id to user-message and create btnLastUserMessage
4568426
chore: remove helpers folder in utils
564659d
refactor: remove calls to basepage.goto, use relative baseUrl
2a77e49
refactor: remove all basePage.waitForSelector calls, remove unused code
627a0d6
refactor: remove channel and interations mock
349d083
refactor: move expect logic from page object to tests
6230aa8
refactor: remove duplicated logic
7f5c216
refactor: remove unnecessary constants
3e67f85
refactor: remove initialData file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,33 +1,29 @@ | ||
| import { PlaywrightTestConfig } from '@playwright/test'; | ||
|
|
||
| import { verifyTestBaseUrl } from './tests/e2e/utils/configs/verifyTestBaseUrl'; | ||
| import * as constants from './tests/e2e/utils/constants'; | ||
|
|
||
| const { isLocal, baseURL } = verifyTestBaseUrl(); | ||
|
|
||
| const localInserts = isLocal | ||
| const setupIsLocalhost = constants.IS_LOCALHOST | ||
| ? { | ||
| globalSetup: require.resolve('./tests/e2e/utils/configs/setup.ts'), | ||
| globalTeardown: require.resolve('./tests/e2e/utils/configs/teardown.ts'), | ||
| globalSetup: require.resolve('./tests/e2e/configs/setup.ts'), | ||
| globalTeardown: require.resolve('./tests/e2e/configs/teardown.ts'), | ||
| } | ||
| : { testIgnore: '00-wizard.spec.ts' }; | ||
|
|
||
| const config: PlaywrightTestConfig = { | ||
| ...localInserts, | ||
| export default { | ||
| ...setupIsLocalhost, | ||
| use: { | ||
| headless: true, | ||
| viewport: { width: 1368, height: 768 }, | ||
| ignoreHTTPSErrors: true, | ||
| video: 'retain-on-failure', | ||
| screenshot: 'only-on-failure', | ||
| trace: 'retain-on-failure', | ||
| baseURL, | ||
| baseURL: constants.BASE_URL, | ||
| }, | ||
| outputDir: 'tests/e2e/test-failures', | ||
| reporter: process.env.CI ? 'github' : 'list', | ||
| testDir: 'tests/e2e', | ||
| retries: 3, | ||
| workers: 1, | ||
| timeout: 42 * 1000, | ||
| }; | ||
|
|
||
| export default config; | ||
| } as PlaywrightTestConfig; |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,41 +1,40 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| import { Global, LoginPage } from './pageobjects'; | ||
| import { VALID_EMAIL, INVALID_EMAIL, INVALID_EMAIL_WITHOUT_MAIL_PROVIDER } from './utils/mocks/userAndPasswordMock'; | ||
|
|
||
| test.describe('[Forgot Password]', () => { | ||
| let loginPage: LoginPage; | ||
| let global: Global; | ||
|
|
||
| test.beforeEach(async ({ page, baseURL }) => { | ||
| test.beforeEach(async ({ page }) => { | ||
| loginPage = new LoginPage(page); | ||
| global = new Global(page); | ||
| const baseUrl = baseURL as string; | ||
| await loginPage.goto(baseUrl); | ||
| await loginPage.gotToForgotPassword(); | ||
|
|
||
| await page.goto('/'); | ||
| await loginPage.btnForgotPassword.click(); | ||
| }); | ||
|
|
||
| test('expect be required', async () => { | ||
| loginPage.submit(); | ||
| loginPage.btnSubmit.click(); | ||
|
|
||
| await expect(loginPage.emailInvalidText).toBeVisible(); | ||
| }); | ||
|
|
||
| test('expect invalid for email without domain', async () => { | ||
| await loginPage.emailField.type(INVALID_EMAIL_WITHOUT_MAIL_PROVIDER); | ||
| await loginPage.submit(); | ||
| await loginPage.emailField.type('mail'); | ||
| await loginPage.btnSubmit.click(); | ||
| await expect(loginPage.emailInvalidText).toBeVisible(); | ||
| }); | ||
|
|
||
| test('expect be invalid for email with invalid domain', async () => { | ||
| await loginPage.emailField.type(INVALID_EMAIL); | ||
| await loginPage.submit(); | ||
| await loginPage.emailField.type('mail@mail'); | ||
| await loginPage.btnSubmit.click(); | ||
| await expect(loginPage.emailInvalidText).toBeVisible(); | ||
| }); | ||
|
|
||
| test('expect user type a valid email', async () => { | ||
| await loginPage.emailField.type(VALID_EMAIL); | ||
| await loginPage.submit(); | ||
| await loginPage.emailField.type('mail@mail.com'); | ||
| await loginPage.btnSubmit.click(); | ||
| await expect(global.getToastBarSuccess).toBeVisible(); | ||
| }); | ||
| }); |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,27 +1,39 @@ | ||
| import { test } from '@playwright/test'; | ||
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| import { registerUser, WRONG_PASSWORD } from './utils/mocks/userAndPasswordMock'; | ||
| import { registerUser } from './utils/mocks/userAndPasswordMock'; | ||
| import { LoginPage } from './pageobjects'; | ||
|
|
||
| test.describe('[Register]', () => { | ||
| let loginPage: LoginPage; | ||
|
|
||
| test.beforeEach(async ({ page, baseURL }) => { | ||
| const URL = baseURL as string; | ||
| test.beforeEach(async ({ page }) => { | ||
| loginPage = new LoginPage(page); | ||
| await loginPage.goto(URL); | ||
| await page.goto('/'); | ||
| }); | ||
|
|
||
| test('expect user click in register button without data', async () => { | ||
| await loginPage.registerFail(); | ||
| await loginPage.btnRegister.click(); | ||
| await loginPage.btnSubmit.click(); | ||
|
|
||
| await expect(loginPage.nameInvalidText).toBeVisible(); | ||
| await expect(loginPage.emailInvalidText).toBeVisible(); | ||
| await expect(loginPage.passwordInvalidText).toBeVisible(); | ||
| }); | ||
|
|
||
| test('expect user click in register button with different password', async () => { | ||
| await loginPage.registerFailWithDifferentPassword(registerUser, WRONG_PASSWORD); | ||
| await loginPage.btnRegister.click(); | ||
| await loginPage.passwordField.type(registerUser.password); | ||
| await loginPage.emailField.type(registerUser.email); | ||
| await loginPage.nameField.type(registerUser.name); | ||
| await loginPage.confirmPasswordField.type('wrong_password'); | ||
|
|
||
| await loginPage.btnSubmit.click(); | ||
| await expect(loginPage.confirmPasswordInvalidText).toBeVisible(); | ||
| await expect(loginPage.confirmPasswordInvalidText).toHaveText('The password confirmation does not match password'); | ||
| }); | ||
|
|
||
| test('expect new user is created', async () => { | ||
| await loginPage.gotToRegister(); | ||
| await loginPage.btnRegister.click(); | ||
| await loginPage.registerNewUser(registerUser); | ||
| }); | ||
| }); |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,27 +1,27 @@ | ||
| import { test } from '@playwright/test'; | ||
| import { faker } from '@faker-js/faker'; | ||
|
|
||
| import { LoginPage, ChannelCreation } from './pageobjects'; | ||
| import { LoginPage, SideNav } from './pageobjects'; | ||
| import { adminLogin } from './utils/mocks/userAndPasswordMock'; | ||
|
|
||
| test.describe('[Channel]', async () => { | ||
| let channelCreation: ChannelCreation; | ||
| let sideNav: SideNav; | ||
| let loginPage: LoginPage; | ||
|
|
||
| test.beforeAll(async ({ browser }) => { | ||
| const page = await browser.newPage(); | ||
| loginPage = new LoginPage(page); | ||
| channelCreation = new ChannelCreation(page); | ||
| sideNav = new SideNav(page); | ||
|
|
||
| await loginPage.goto('/'); | ||
| await page.goto('/'); | ||
| await loginPage.doLogin(adminLogin); | ||
| }); | ||
|
|
||
| test('expect create private channel', async () => { | ||
| await channelCreation.doCreateChannel(faker.animal.type() + Date.now(), true); | ||
| await sideNav.doCreateChannel(faker.animal.type() + Date.now(), true); | ||
souzaramon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }); | ||
|
|
||
| test('expect create public channel', async () => { | ||
| await channelCreation.doCreateChannel(faker.animal.type() + Date.now()); | ||
| await sideNav.doCreateChannel(faker.animal.type() + Date.now()); | ||
souzaramon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }); | ||
| }); | ||
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.