Skip to content

Commit 8bc870e

Browse files
authored
Merge pull request #12 from LibreCodeCoop/feat/pedro-poti-persona-screenshots
feat: align screenshots with Pedro Poti persona
2 parents 2e0904b + a262880 commit 8bc870e

11 files changed

+155
-82
lines changed
-4.77 KB
Loading

img/screenshots/admin-catalog.png

-8.52 KB
Loading
21.6 KB
Loading
33.6 KB
Loading
-2.7 KB
Loading
-3.38 KB
Loading
-1.29 KB
Loading
7.04 KB
Loading

playwright/generate-screenshots.mjs

Lines changed: 24 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { mkdir, readFile, rm } from 'node:fs/promises'
66
import { join } from 'node:path'
77
import { spawnSync } from 'node:child_process'
88
import { chromium, request } from '@playwright/test'
9+
import { pedroPotiPersona } from '../src/utils/pedroPotiPersona.js'
910

1011
const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? 'https://localhost'
1112
const adminUser = process.env.NEXTCLOUD_ADMIN_USER ?? 'admin'
@@ -17,87 +18,8 @@ const demoAvatarPath = 'playwright/fixtures/pedro-poti-avatar.png'
1718

1819
const legacyDemoUserIds = ['amina_okafor_demo', 'araci_potira_demo']
1920

20-
const demoUser = {
21-
id: 'pedro_poti_demo',
22-
password: 'PedroDemoPass123!',
23-
displayName: 'Pedro Poti',
24-
email: 'pedro.poti@example.net',
25-
}
26-
27-
const showcaseFields = [
28-
{
29-
fieldKey: 'showcase_support_region',
30-
label: 'Support region',
31-
type: 'text',
32-
adminOnly: false,
33-
userEditable: true,
34-
userVisible: true,
35-
initialVisibility: 'users',
36-
sortOrder: 10,
37-
adminValue: { value: 'Northern Europe', currentVisibility: 'users' },
38-
demoValue: { value: 'East Africa', currentVisibility: 'users' },
39-
},
40-
{
41-
fieldKey: 'showcase_product_specialty',
42-
label: 'Product specialty',
43-
type: 'text',
44-
adminOnly: false,
45-
userEditable: true,
46-
userVisible: true,
47-
initialVisibility: 'public',
48-
sortOrder: 20,
49-
adminValue: { value: 'Contract automation', currentVisibility: 'public' },
50-
demoValue: { value: 'Identity operations', currentVisibility: 'public' },
51-
},
52-
{
53-
fieldKey: 'showcase_customer_segment',
54-
label: 'Customer segment',
55-
type: 'text',
56-
adminOnly: false,
57-
userEditable: true,
58-
userVisible: true,
59-
initialVisibility: 'users',
60-
sortOrder: 30,
61-
adminValue: { value: 'Public sector', currentVisibility: 'users' },
62-
demoValue: { value: 'Financial services', currentVisibility: 'users' },
63-
},
64-
{
65-
fieldKey: 'showcase_escalation_alias',
66-
label: 'Escalation alias',
67-
type: 'text',
68-
adminOnly: false,
69-
userEditable: true,
70-
userVisible: true,
71-
initialVisibility: 'private',
72-
sortOrder: 40,
73-
adminValue: { value: 'north-eu-escalations', currentVisibility: 'private' },
74-
demoValue: { value: 'east-africa-escalations', currentVisibility: 'private' },
75-
},
76-
{
77-
fieldKey: 'showcase_incident_role',
78-
label: 'Incident response role',
79-
type: 'text',
80-
adminOnly: false,
81-
userEditable: true,
82-
userVisible: true,
83-
initialVisibility: 'users',
84-
sortOrder: 50,
85-
adminValue: { value: 'Communications lead', currentVisibility: 'users' },
86-
demoValue: { value: 'Regional coordinator', currentVisibility: 'users' },
87-
},
88-
{
89-
fieldKey: 'showcase_on_call_tier',
90-
label: 'On-call tier',
91-
type: 'number',
92-
adminOnly: true,
93-
userEditable: false,
94-
userVisible: true,
95-
initialVisibility: 'private',
96-
sortOrder: 60,
97-
adminValue: { value: 2, currentVisibility: 'private' },
98-
demoValue: { value: 1, currentVisibility: 'private' },
99-
},
100-
]
21+
const demoUser = pedroPotiPersona.user
22+
const showcaseFields = pedroPotiPersona.showcaseFields
10123

10224
const showcaseKeys = new Set(showcaseFields.map((field) => field.fieldKey))
10325
const showcaseLabels = new Set(showcaseFields.map((field) => field.label))
@@ -297,6 +219,25 @@ const hideNonShowcaseDialogFields = async(page) => {
297219
}, { labels: [...showcaseLabels], demoUserId: demoUser.id })
298220
}
299221

222+
const fillAccountField = async(page, label, value) => {
223+
const textboxes = page.getByRole('textbox', { name: label, exact: true })
224+
const input = await textboxes.count() > 0
225+
? textboxes.first()
226+
: page.locator(`input[aria-label="${label}"], textarea[aria-label="${label}"]`).first()
227+
await input.waitFor({ state: 'visible', timeout: 60_000 })
228+
await input.fill(value)
229+
await input.blur()
230+
await page.waitForTimeout(250)
231+
}
232+
233+
const seedPedroPotiAccountProfile = async(page) => {
234+
for (const field of pedroPotiPersona.accountFields) {
235+
await fillAccountField(page, field.label, field.value)
236+
}
237+
238+
await page.waitForTimeout(800)
239+
}
240+
300241
const prepareWorkflowScreenshot = async(page) => {
301242
await page.goto('./settings/admin/workflow')
302243
await page.getByRole('heading', { name: 'Available flows' }).waitFor({ state: 'visible', timeout: 60_000 })
@@ -305,7 +246,7 @@ const prepareWorkflowScreenshot = async(page) => {
305246
if (await showMoreButton.count() > 0) {
306247
await showMoreButton.click()
307248
}
308-
await page.getByRole('heading', { name: 'Create Talk conversation', exact: true }).waitFor({ state: 'visible', timeout: 60_000 })
249+
await page.getByRole('heading', { name: 'Create Talk conversation', exact: true }).first().waitFor({ state: 'visible', timeout: 60_000 })
309250

310251
await page.evaluate(() => {
311252
document.querySelector('header')?.setAttribute('style', 'display:none')
@@ -407,6 +348,7 @@ const run = async() => {
407348
const personalPage = await demoContext.newPage()
408349
await personalPage.goto('./settings/user/personal-info')
409350
await personalPage.getByTestId('profile-fields-personal-field-showcase_support_region').waitFor({ state: 'visible', timeout: 60_000 })
351+
await seedPedroPotiAccountProfile(personalPage)
410352
await hideNonShowcasePersonalFields(personalPage)
411353
await personalPage.locator('main').screenshot({ path: join(screenshotDir, 'personal-settings.png'), type: 'png' })
412354

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// SPDX-FileCopyrightText: 2026 LibreCode coop and LibreCode contributors
2+
// SPDX-License-Identifier: AGPL-3.0-or-later
3+
4+
import { describe, expect, it } from 'vitest'
5+
6+
import { pedroPotiPersona } from '../../utils/pedroPotiPersona.js'
7+
8+
describe('pedroPotiPersona', () => {
9+
it('keeps the demo identity and biography aligned with Pedro Poti in English', () => {
10+
expect(pedroPotiPersona.user.displayName).toBe('Pedro Poti')
11+
expect(pedroPotiPersona.user.email).toBe('pedro.poti@example.net')
12+
13+
const accountFieldByLabel = new Map(pedroPotiPersona.accountFields.map((field) => [field.label, field.value]))
14+
expect(accountFieldByLabel.get('Location')).toBe('Massurepe, Paraiba')
15+
expect(accountFieldByLabel.get('Role')).toBe('Regedor of Paraiba')
16+
expect(accountFieldByLabel.get('Headline')).toContain('Dutch Brazil')
17+
expect(accountFieldByLabel.get('About')).toContain('five years in the Netherlands')
18+
expect(accountFieldByLabel.get('About')).toContain('Reformed faith')
19+
expect(accountFieldByLabel.get('About')).toContain('Paraiba chamber')
20+
})
21+
22+
it('replaces generic showcase metadata with persona-specific profile fields', () => {
23+
expect(pedroPotiPersona.showcaseFields.map((field) => field.label)).toEqual([
24+
'Territory',
25+
'Core strength',
26+
'Community',
27+
'Letter alias',
28+
'Leadership role',
29+
'Council rank',
30+
])
31+
32+
const showcaseValueByKey = new Map(pedroPotiPersona.showcaseFields.map((field) => [field.fieldKey, field.demoValue.value]))
33+
expect(showcaseValueByKey.get('showcase_support_region')).toBe('Captaincy of Paraiba')
34+
expect(showcaseValueByKey.get('showcase_product_specialty')).toBe('Tupi correspondence')
35+
expect(showcaseValueByKey.get('showcase_customer_segment')).toBe('Potiguara communities')
36+
expect(showcaseValueByKey.get('showcase_incident_role')).toBe('Regedor of Paraiba')
37+
})
38+
})

0 commit comments

Comments
 (0)