fix(auth): skip sign widget open if already visible
- check for file input visibility before clicking the sign button - prevents double-open when Готово triggers the widget automatically - remove stale scenario-25-export.json (superseded by notes export)
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"name": "Diia STG — Create certificate application (987825)",
|
||||
"steps": [
|
||||
{
|
||||
"order": 0,
|
||||
"type": "login",
|
||||
"sessionName": "diia-stg-session",
|
||||
"execCode": "{\"keyId\": \"3273334361\", \"environmentName\": \"liquio-diia-stg\"}",
|
||||
"validateCode": null
|
||||
},
|
||||
{
|
||||
"order": 1,
|
||||
"type": "exec",
|
||||
"sessionName": "diia-stg-session",
|
||||
"execCode": "// Navigate to the tasks/services list for this user\nawait page.goto(\"https://cabinet-liquio-diia-stg.kitsoft.ua/tasks\", { waitUntil: \"networkidle\" });\nhelpers.log(\"URL: \" + page.url());\nhelpers.log(\"title: \" + await page.title());\n\nconst headings = await page.locator(\"h1, h2, h3\").allTextContents();\nhelpers.log(\"headings: \" + JSON.stringify(headings));\n\n// Find any links that look like task/service links\nconst links = await page.locator(\"a[href*=task], a[href*=service], a[href*=create]\").all();\nconst linkData = [];\nfor (const a of links.slice(0, 20)) {\n linkData.push({ href: await a.getAttribute(\"href\"), text: (await a.textContent()).trim().slice(0, 80) });\n}\nhelpers.log(\"task links: \" + JSON.stringify(linkData));\n\nconst bodyText = await page.locator(\"body\").innerText();\nhelpers.log(\"body (first 800): \" + bodyText.slice(0, 800));\n\nreturn page.url();\n",
|
||||
"validateCode": null
|
||||
},
|
||||
{
|
||||
"order": 2,
|
||||
"type": "exec",
|
||||
"sessionName": "diia-stg-session",
|
||||
"execCode": "helpers.log(\"url=\" + page.url());\nconst btns = await page.locator(\"button\").all();\nconst labels = [];\nfor (const b of btns) { const t = (await b.textContent()) || \"\"; const vis = await b.isVisible(); if (vis) labels.push(t.trim()); }\nhelpers.log(\"visible buttons: \" + JSON.stringify(labels));\nreturn labels;",
|
||||
"validateCode": null
|
||||
},
|
||||
{
|
||||
"order": 3,
|
||||
"type": "sign",
|
||||
"sessionName": "diia-stg-session",
|
||||
"execCode": "{\"keyId\": \"3273334361\"}",
|
||||
"validateCode": null
|
||||
},
|
||||
{
|
||||
"order": 4,
|
||||
"type": "exec",
|
||||
"sessionName": "diia-stg-session",
|
||||
"execCode": "return page.url();",
|
||||
"validateCode": "\nconst url = page.url();\nconst successEl = await page.locator('.success, [data-test=\"success\"], .task-success, .done-message').count();\nconst successText = /успішно|success|заяву подано|виконано/i.test(await page.locator('body').innerText());\nreturn {\n success: successEl > 0 || successText,\n description: `Final URL: ${url}`,\n};\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -219,13 +219,19 @@ export class AuthService {
|
||||
|
||||
this.logger.log(`Signing with key ${keyId} on page: ${page.url()}`);
|
||||
|
||||
// Open the EDS sign widget
|
||||
await page
|
||||
.locator("button")
|
||||
.filter({ hasText: /підпис|sign/i })
|
||||
.first()
|
||||
.click();
|
||||
await page.waitForTimeout(500);
|
||||
// Open the EDS sign widget (skip if it's already open)
|
||||
const isSignDialogOpen = await page
|
||||
.locator('input[accept=".dat,.pfx,.pk8,.zs2,.jks"][type="file"]')
|
||||
.isVisible()
|
||||
.catch(() => false);
|
||||
if (!isSignDialogOpen) {
|
||||
await page
|
||||
.locator("button")
|
||||
.filter({ hasText: /підпис|sign/i })
|
||||
.first()
|
||||
.click();
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
|
||||
// Select the file key tab inside the widget
|
||||
await page
|
||||
|
||||
Reference in New Issue
Block a user