Skip to content

Commit 05fa7eb

Browse files
committed
test(e2e): make policy menu visibility assertions English-only
Signed-off-by: Vitor Mattos <[email protected]>
1 parent 0565357 commit 05fa7eb

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

playwright/e2e/policy-settings-menu-visibility.spec.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
ensureUserExists,
2828
ensureUserInGroup,
2929
setAppConfig,
30+
setUserLanguage,
3031
} from '../support/nc-provisioning'
3132
import {
3233
createAuthenticatedRequestContext,
@@ -87,6 +88,7 @@ test('group admin can access policies and start creating delegated rule when cus
8788
await ensureGroupExists(page.request, GROUP_ID)
8889
await ensureUserInGroup(page.request, GROUP_ADMIN, GROUP_ID)
8990
await ensureSubadminOfGroup(page.request, GROUP_ADMIN, GROUP_ID)
91+
await setUserLanguage(page.request, GROUP_ADMIN, 'en')
9092

9193
// ── 1. Admin: enable delegated customization at system layer ───────────
9294
await setSystemPolicyEntry(adminRequestContext, POLICY_KEY, FOOTER_ENABLED_VALUE, true)
@@ -111,38 +113,38 @@ test('group admin can access policies and start creating delegated rule when cus
111113

112114
// ── 4. The editable policy card must be visible in the workbench ──────
113115
const configureButton = page
114-
.getByRole('button', { name: /Configure|Configurar/i })
116+
.getByRole('button', { name: /^Configure(?: setting)?$/i })
115117
.first()
116118
await expect(configureButton, 'At least one Configure button should be visible for the group admin').toBeVisible({ timeout: 15000 })
117119

118120
// ── 5. Open the setting dialog ─────────────────────────────────────────
119121
await configureButton.click()
120122

121-
const settingDialog = page.getByRole('dialog', { name: /Signature footer|Signing order|Rodape de assinatura|Ordem de assinatura/i })
123+
const settingDialog = page.getByRole('dialog', { name: /Signature footer|Signing order/i })
122124
await expect(settingDialog, 'Policy dialog should open on click').toBeVisible({ timeout: 10000 })
123125

124126
// ── 6. "Create rule" button must be available inside the dialog ───────
125-
const createRuleButton = settingDialog.getByRole('button', { name: /Create rule|Criar regra/i })
127+
const createRuleButton = settingDialog.getByRole('button', { name: /^Create rule$/i })
126128
await expect(createRuleButton, '"Create rule" button should be enabled in the policy dialog').toBeVisible({ timeout: 10000 })
127129
await expect(createRuleButton).toBeEnabled()
128130

129131
// ── 7. Clicking "Create rule" opens the scope-selector ────────────────
130132
await createRuleButton.click()
131133

132134
const createPolicyDialog = page
133-
.getByRole('dialog', { name: /What do you want to create\?|Create rule|O que voce quer criar\?|Criar regra/i })
135+
.getByRole('dialog', { name: /What do you want to create\?|Create rule/i })
134136
.last()
135137
await expect(createPolicyDialog, 'Create-policy modal should appear after clicking Create rule').toBeVisible({ timeout: 10000 })
136138

137139
await createPolicyDialog.getByRole('option', { name: /^Group/ }).click()
138140

139-
const targetGroupsField = page.getByLabel(/Target groups|Grupos alvo/i)
141+
const targetGroupsField = page.getByLabel(/Target groups/i)
140142
await expect(targetGroupsField).toBeVisible({ timeout: 10000 })
141-
await page.getByPlaceholder(/Search groups|Pesquisar grupos/i).fill(GROUP_ID)
143+
await page.getByPlaceholder(/Search groups/i).fill(GROUP_ID)
142144
await page.getByRole('option', { name: GROUP_ID }).first().click()
143145

144146
await Promise.any([
145147
createPolicyDialog.getByRole('option', { name: /^Group/ }).waitFor({ state: 'visible', timeout: 10000 }),
146-
page.getByLabel(/Target groups|Grupos alvo/i).waitFor({ state: 'visible', timeout: 10000 }),
148+
page.getByLabel(/Target groups/i).waitFor({ state: 'visible', timeout: 10000 }),
147149
])
148150
})

0 commit comments

Comments
 (0)