Skip to content

Commit 11a8615

Browse files
test(e2e): cover CRL enabled/disabled in one fast scenario
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent bf4c1bc commit 11a8615

1 file changed

Lines changed: 26 additions & 8 deletions

File tree

playwright/e2e/sign-password-non-retriable-error.spec.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,25 @@ async function bootstrapAdminCertificate(page: Parameters<typeof test>[1] extend
5151
]),
5252
)
5353

54+
await setAppConfig(
55+
page.request,
56+
'libresign',
57+
'crl_external_validation_enabled',
58+
'1',
59+
)
60+
5461
await deleteUserPfx(page.request, adminUser, adminPassword)
5562

5663
return { adminUser }
5764
}
5865

59-
test('closes password modal on non-retriable signing error', async ({ page }) => {
66+
test('switches from blocked (enabled) to normal (disabled) without extra scenarios', async ({ page }) => {
6067
const { adminUser } = await bootstrapAdminCertificate(page)
6168
await prepareSignFlow(page, adminUser)
6269

63-
await page.route('**/ocs/v2.php/apps/libresign/api/v1/sign/**', async (route) => {
70+
const signRoute = '**/ocs/v2.php/apps/libresign/api/v1/sign/**'
71+
72+
const blockedHandler = async (route) => {
6473
await route.fulfill({
6574
status: 422,
6675
contentType: 'application/json',
@@ -81,7 +90,9 @@ test('closes password modal on non-retriable signing error', async ({ page }) =>
8190
},
8291
}),
8392
})
84-
})
93+
}
94+
95+
await page.route(signRoute, blockedHandler)
8596

8697
await page.getByRole('button', { name: 'Sign document' }).click()
8798

@@ -90,13 +101,17 @@ test('closes password modal on non-retriable signing error', async ({ page }) =>
90101
await expect(page.getByRole('button', { name: 'Try signing again' })).toBeVisible()
91102
await expect(page.locator('.button-wrapper').getByText('Certificate revocation status could not be verified').first()).toBeVisible()
92103
await page.screenshot({ path: '/tmp/playwright-results/non-retriable-blocked-ui.png', fullPage: true })
93-
})
94104

95-
test('keeps normal sign UI when no non-retriable error is returned', async ({ page }) => {
96-
const { adminUser } = await bootstrapAdminCertificate(page)
97-
await prepareSignFlow(page, adminUser)
105+
await setAppConfig(
106+
page.request,
107+
'libresign',
108+
'crl_external_validation_enabled',
109+
'0',
110+
)
111+
112+
await page.unroute(signRoute, blockedHandler)
98113

99-
await page.route('**/ocs/v2.php/apps/libresign/api/v1/sign/**', async (route) => {
114+
await page.route(signRoute, async (route) => {
100115
await route.fulfill({
101116
status: 200,
102117
contentType: 'application/json',
@@ -116,6 +131,9 @@ test('keeps normal sign UI when no non-retriable error is returned', async ({ pa
116131
})
117132
})
118133

134+
await page.getByRole('button', { name: 'Try signing again' }).click()
135+
await page.getByRole('button', { name: 'Sign the document.' }).click()
136+
await page.getByLabel('Signature password').fill('Password1234')
119137
await page.getByRole('button', { name: 'Sign document' }).click()
120138

121139
await expect(page.getByText('Signing is blocked until the certificate validation issue is resolved.')).toBeHidden()

0 commit comments

Comments
 (0)