diff --git a/apps/blog/playwright/tests/support/pages/profilePage.ts b/apps/blog/playwright/tests/support/pages/profilePage.ts index a1a7c13e7db36d522c747e7b97facc24d985cc2c..e19841da1e2779d7e433011a72c9a6112ec15551 100644 --- a/apps/blog/playwright/tests/support/pages/profilePage.ts +++ b/apps/blog/playwright/tests/support/pages/profilePage.ts @@ -200,7 +200,10 @@ export class ProfilePage { readonly profileNameString: string; readonly followBtn: string; readonly profileStatsString: string; - + readonly muteButton: Locator; + readonly mutedUsersBtn: Locator; + readonly unmuteButton: Locator; + constructor(page: Page) { this.page = page; this.followBtn = '[data-testid="profile-follow-button"]' @@ -298,6 +301,10 @@ export class ProfilePage { this.repliesCommentListItemRespondFirst = this.repliesCommentListItemRespond.first(); this.repliesCommentListItemRespondTooltip = page.locator('[data-testid="comment-respond-tooltip"]'); this.repliesCommentListItemArticleTitle = page.locator('[data-testid="article-title"]'); + this.muteButton = page.locator('[data-testid="profile-mute-button"]'); + this.mutedUsersBtn = page.getByRole('link', { name: 'Muted Users' }); + this.unmuteButton = page.getByRole('button', { name: 'unmute' }) + this.notificationsMenu = page.locator('[data-testid="notifications-local-menu"]'); this.notificationsMenuAllButton = page diff --git a/apps/blog/playwright/tests/testnet_e2e/mutedUser.spec.ts b/apps/blog/playwright/tests/testnet_e2e/mutedUser.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..1895f1484c13c6fe63ab370b68b2dd0a898f3c49 --- /dev/null +++ b/apps/blog/playwright/tests/testnet_e2e/mutedUser.spec.ts @@ -0,0 +1,58 @@ +import { test, expect } from '../../fixtures'; +import { HomePage } from '../support/pages/homePage'; +import { ProfileUserMenu } from '../support/pages/profileUserMenu'; +import { ProfilePage } from '../support/pages/profilePage'; +import { PostPage } from '../support/pages/postPage'; + +test.describe('Muted user - tests', () => { + let profileUserMenu: ProfileUserMenu; + let homePage: HomePage; + let profilePage: ProfilePage; + let postPage: PostPage; + + test.beforeEach(async ({ denserAutoTest0Page }) => { + profileUserMenu = new ProfileUserMenu(denserAutoTest0Page.page); + homePage = new HomePage(denserAutoTest0Page.page); + profilePage = new ProfilePage(denserAutoTest0Page.page); + postPage = new PostPage(denserAutoTest0Page.page); + }); + + test('Add user to Muted list', async ({ denserAutoTest0Page }) => { + const postAuthorName = await denserAutoTest0Page.page.locator(homePage.postAuthor).nth(1).innerText(); + + await denserAutoTest0Page.page.locator(homePage.postAuthor).nth(1).click(); + await expect(denserAutoTest0Page.page.locator(profilePage.profileNameString)).toBeVisible(); + await profilePage.muteButton.click(); + await denserAutoTest0Page.page.locator(homePage.profileAvatar).click() + await expect(denserAutoTest0Page.page.locator(profileUserMenu.profileLinkString)).toBeVisible(); + await denserAutoTest0Page.page.locator(profileUserMenu.profileLinkString).click() + await expect(profilePage.profileName).toContainText('denserautotest0') + await profilePage.mutedUsersBtn.click() + await expect(denserAutoTest0Page.page.getByRole('heading', { name: 'Accounts Muted By' })).toBeVisible(); + await expect(denserAutoTest0Page.page.getByRole('link', { name: `${postAuthorName}` })).toBeVisible(); + await profilePage.unmuteButton.click() + await expect(denserAutoTest0Page.page.getByRole('status')).toBeVisible() + await expect(denserAutoTest0Page.page.getByText('There are no users on this')).toBeVisible() + await expect(denserAutoTest0Page.page.getByText('Unmuted', { exact: true })).toBeVisible(); + }); + + + test('Add user to Muted list by - Add Account(s) To List', async ({ denserAutoTest0Page }) => { + const muteUser = `serejandmyself` + + await denserAutoTest0Page.page.locator(homePage.profileAvatar).click() + await expect(denserAutoTest0Page.page.locator(profileUserMenu.profileLinkString)).toBeVisible(); + await denserAutoTest0Page.page.locator(profileUserMenu.profileLinkString).click() + await expect(profilePage.profileName).toContainText('denserautotest0') + await profilePage.mutedUsersBtn.click() + await expect(denserAutoTest0Page.page.getByRole('heading', { name: 'Accounts Muted By' })).toBeVisible(); + await denserAutoTest0Page.page.locator('div').filter({ hasText: /^Add Account\(s\) To List\(single account or comma separated list\)$/ }).getByRole('textbox').fill(muteUser); + await denserAutoTest0Page.page.waitForTimeout(5000) + await denserAutoTest0Page.page.getByRole('button', { name: 'Add to list' }).click(); + await expect(denserAutoTest0Page.page.getByText('serejandmyself unmute')).toBeVisible(); + await expect(denserAutoTest0Page.page.getByText(`You have muted ${muteUser}`)).toBeVisible(); + await profilePage.unmuteButton.click() + await expect(denserAutoTest0Page.page.getByText('Unmuted', { exact: true })).toBeVisible(); + await expect(denserAutoTest0Page.page.getByText('There are no users on this')).toBeVisible(); + }); +});