mirror of
https://codeberg.org/forgejo/forgejo
synced 2025-10-19 00:40:51 +02:00
These tests often appear as failing with one failed retry in e2e logs for either browsers. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9599 Reviewed-by: Michael Kriese <michael.kriese@gmx.de> Reviewed-by: Otto <otto@codeberg.org>
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
// @watch start
|
|
// routers/web/user/**
|
|
// templates/shared/user/**
|
|
// web_src/js/features/common-global.js
|
|
// web_src/js/modules/dropdown.ts
|
|
// @watch end
|
|
|
|
import {expect} from '@playwright/test';
|
|
import {test} from './utils_e2e.ts';
|
|
import {screenshot} from './shared/screenshots.ts';
|
|
|
|
test.use({user: 'user2'});
|
|
|
|
test('Follow and block actions', async ({page}, workerInfo) => {
|
|
test.skip(workerInfo.project.name === 'Mobile Safari', 'Mobile Safari is unreliable in this test');
|
|
|
|
await page.goto('/user1');
|
|
|
|
// Check if following and then unfollowing works.
|
|
const followButton = page.locator('.primary-action button');
|
|
await expect(followButton).toContainText('Follow');
|
|
await followButton.click();
|
|
await expect(followButton).toContainText('Unfollow');
|
|
await followButton.click();
|
|
await expect(followButton).toContainText('Follow');
|
|
|
|
// Simple block interaction.
|
|
const actionsDropdownBtn = page.locator('.actions .dropdown summary');
|
|
const blockButton = page.locator('#action-block');
|
|
await expect(blockButton).toBeHidden();
|
|
|
|
await actionsDropdownBtn.click();
|
|
await expect(blockButton).toBeVisible();
|
|
await expect(blockButton).toContainText('Block');
|
|
|
|
await blockButton.click();
|
|
await expect(page.locator('#block-user')).toBeVisible();
|
|
await screenshot(page);
|
|
await page.locator('#block-user .ok').click();
|
|
await expect(blockButton).toContainText('Unblock');
|
|
await expect(page.locator('#block-user')).toBeHidden();
|
|
|
|
// Check that following the user yields in a error being shown.
|
|
await followButton.click();
|
|
const flashMessage = page.locator('#flash-message');
|
|
await expect(flashMessage).toBeVisible();
|
|
await expect(flashMessage).toContainText('You cannot follow this user because you have blocked this user or this user has blocked you.');
|
|
await screenshot(page);
|
|
|
|
// Unblock interaction.
|
|
await actionsDropdownBtn.click();
|
|
await blockButton.click();
|
|
await expect(blockButton).toContainText('Block');
|
|
});
|