E2e Tests updated

This commit is contained in:
AG
2025-12-21 00:19:46 +02:00
parent 13e150d7d7
commit 8817dcb95e
5 changed files with 57 additions and 67 deletions

View File

@@ -1,9 +1,8 @@
import { test, expect } from '@playwright/test';
test.describe('Results Display Functionality', () => {
test.fixme('Verify Results Display After All Submissions', async ({ page, browser }) => {
// 1. Follow steps for "4.2 Multi-User - All Participants Submit Desires" to reach the results page.
// Create a session with `Number of Expected Responses` set to 2.
test('Verify Results Display After All Submissions', async ({ page, browser }) => {
// 1. Create a session with `Number of Expected Responses` set to 2.
await page.goto('https://unisono.aglink.duckdns.org/login');
await page.getByRole('textbox', { name: 'Passphrase' }).fill('HonorableHumansPrivilegeIsToBeAllowedHere');
await page.getByRole('button', { name: 'Enter' }).click();
@@ -17,12 +16,11 @@ test.describe('Results Display Functionality', () => {
// Copy the session link.
await page.getByRole('button', { name: 'Copy Link' }).click();
await expect(page.getByText('Link copied to clipboard!')).toBeVisible();
const sessionLink = await page.evaluate(() => navigator.clipboard.readText());
const sessionLink = page.url();
// User 1:
// User 1 (in the initial browser context):
// a. Enter desires into all categories.
await page.getByRole('textbox', { name: 'Enter items you want' }).fill('User1 Want A
User1 Want B');
await page.getByRole('textbox', { name: 'Enter items you want' }).fill('User1 Want A\nUser1 Want B');
await page.getByRole('textbox', { name: 'Enter sensitive ideas privately' }).fill('User1 Secret Item');
await page.getByRole('textbox', { name: 'Enter items you accept' }).fill('User1 Accept Item');
await page.getByRole('textbox', { name: 'Enter items you absolutely do not want' }).fill('User1 Unwanted Item');
@@ -32,27 +30,26 @@ User1 Want B');
await expect(page.getByText('Your desires have been submitted.')).toBeVisible();
await expect(page.getByText('Waiting for 1 more responses...')).toBeVisible();
// User 2 (in a new browser context/page):
// User 2 (in a new browser context, e.g., using `browser.newContext()` in Playwright):
// a. Navigate to the copied session link.
const user2Context = await browser.newContext();
const user2Page = await user2Context.newPage();
await user2Page.goto(sessionLink);
// b. Enter desires into all categories.
// User 2 needs to log in first
// b. Log in with the valid `AUTH_PASSPHRASE`.
await user2Page.getByRole('textbox', { name: 'Passphrase' }).fill('HonorableHumansPrivilegeIsToBeAllowedHere');
await user2Page.getByRole('button', { name: 'Enter' }).click();
await user2Page.waitForURL(/.*\/session\/.*/);
await user2Page.getByRole('textbox', { name: 'Enter items you want' }).fill('User2 Want C
User2 Want D');
// c. Enter desires into all categories.
await user2Page.getByRole('textbox', { name: 'Enter items you want' }).fill('User2 Want C\nUser2 Want D');
await user2Page.getByRole('textbox', { name: 'Enter sensitive ideas privately' }).fill('User2 Secret Item');
await user2Page.getByRole('textbox', { name: 'Enter items you accept' }).fill('User2 Accept Item');
await user2Page.getByRole('textbox', { name: 'Enter items you absolutely do not want' }).fill('User2 Unwanted Item');
// c. Click "Submit Desires".
// d. Click "Submit Desires".
await user2Page.getByRole('button', { name: 'Submit Desires' }).click();
await expect(user2Page.getByText('Your desires have been submitted.')).toBeVisible();
// Expected Results:
// - The "Results Display" page is visible.
@@ -69,11 +66,8 @@ User2 Want D');
await expect(page.getByText('User1 Unwanted Item')).toBeVisible();
await expect(page.getByText('User2 Unwanted Item')).toBeVisible();
// - The count of participants who submitted desires matches the `Number of Expected Responses`.
// This would require more complex assertions based on the actual display of participant count.
// - The session topic and details are still visible.
await expect(page.getByRole('heading', { name: 'Results Display Test' })).toBeVisible();
await expect(page.getByText('Details: Verifying the results display after all submissions.')).toBeVisible();
});
});
});