From b61858f559be518b4e39202ae4dec305b22ff718 Mon Sep 17 00:00:00 2001 From: pedro Date: Thu, 4 Apr 2024 11:49:05 +0200 Subject: [PATCH] skip pilot tests by default to make them work, change: test.describe.skip to test.describe --- tests/test-pilots.spec.ts | 225 +++++++++++++++++++------------------- 1 file changed, 115 insertions(+), 110 deletions(-) diff --git a/tests/test-pilots.spec.ts b/tests/test-pilots.spec.ts index 4186516..987fc40 100644 --- a/tests/test-pilots.spec.ts +++ b/tests/test-pilots.spec.ts @@ -62,6 +62,8 @@ async function oidc_flow(page) { } else if (/ereuse/.test(hostname)) { vcred_schema='Product and waste electronics operator claim' vcred_file='/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/e-operator-claim.xlsx' + } else { + test.skip(); } await set_org_key(page); @@ -114,122 +116,125 @@ async function oidc_flow(page) { // TODO test que hace la presentación de la credencial al revés -test('sign_pdf', async ({ page }) => { - await login(page); +test.describe.skip('test-pilots', () => { + test('sign_pdf', async ({ page }) => { + await login(page); - await set_org_key(page); + await set_org_key(page); - await accept_data_protection(page); + await accept_data_protection(page); - await page.getByRole('link', { name: ' Credentials' }).click(); - await page.getByRole('link', { name: 'Organization\'s wallet' }).click(); - await page.getByRole('link', { name: 'Configure credential issuance' }).click(); - await page.getByPlaceholder('Label').click(); - await page.getByPlaceholder('Label').fill('dni'); - await page.getByPlaceholder('Label').press('Tab'); - await page.getByPlaceholder('Password of certificate').fill('123456'); - //await page.getByLabel('File import').click(); - await page.getByLabel('File import').setInputFiles('/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/signerDNIe004.pfx'); - await page.getByRole('button', { name: 'Upload' }).click(); - await page.getByRole('link', { name: ' Data' }).click(); - await page.getByRole('link', { name: 'Import data ' }).click(); - await page.getByLabel('Signature with Eidas1').selectOption('signerDNIe004.pfx'); - await page.getByLabel('Schema').selectOption('1'); - await page.getByText('ID HUB PANGEA idhub_admin@pangea.org Dashboard Users View users Add user Roles').click(); - //await page.getByLabel('File to import').click(); - await page.getByLabel('File to import').setInputFiles('/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/course-credential.xlsx'); - await page.getByRole('button', { name: 'Save' }).click(); + await page.getByRole('link', { name: ' Credentials' }).click(); + await page.getByRole('link', { name: 'Organization\'s wallet' }).click(); + await page.getByRole('link', { name: 'Configure credential issuance' }).click(); + await page.getByPlaceholder('Label').click(); + await page.getByPlaceholder('Label').fill('dni'); + await page.getByPlaceholder('Label').press('Tab'); + await page.getByPlaceholder('Password of certificate').fill('123456'); + //await page.getByLabel('File import').click(); + await page.getByLabel('File import').setInputFiles('/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/signerDNIe004.pfx'); + await page.getByRole('button', { name: 'Upload' }).click(); + await page.getByRole('link', { name: ' Data' }).click(); + await page.getByRole('link', { name: 'Import data ' }).click(); + await page.getByLabel('Signature with Eidas1').selectOption('signerDNIe004.pfx'); + await page.getByLabel('Schema').selectOption('1'); + await page.getByText('ID HUB PANGEA idhub_admin@pangea.org Dashboard Users View users Add user Roles').click(); + //await page.getByLabel('File to import').click(); + await page.getByLabel('File to import').setInputFiles('/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/course-credential.xlsx'); + await page.getByRole('button', { name: 'Save' }).click(); - // await page.getByRole('link', { name: ' Data' }).click(); - // await page.getByRole('link', { name: 'Import data ' }).click(); - // // src https://playwright.dev/docs/input#select-options - // await page.getByLabel('Schema').selectOption('Financial Vulnerability Credential'); - // // src https://playwright.dev/docs/input#upload-files - // // TODO hardcoded URL - // await page.getByLabel('File to import').setInputFiles('/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/financial-vulnerability.xlsx'); - // //await page.setInputFiles('input[type="file"]', '/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/financial-vulnerability.xlsx'); - // await page.getByRole('button', { name: 'Save' }).click(); + // await page.getByRole('link', { name: ' Data' }).click(); + // await page.getByRole('link', { name: 'Import data ' }).click(); + // // src https://playwright.dev/docs/input#select-options + // await page.getByLabel('Schema').selectOption('Financial Vulnerability Credential'); + // // src https://playwright.dev/docs/input#upload-files + // // TODO hardcoded URL + // await page.getByLabel('File to import').setInputFiles('/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/financial-vulnerability.xlsx'); + // //await page.setInputFiles('input[type="file"]', '/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/financial-vulnerability.xlsx'); + // await page.getByRole('button', { name: 'Save' }).click(); - await page.getByRole('link', { name: '', exact: true }).click(); - await page.getByPlaceholder('Email address').click(); - await page.getByPlaceholder('Email address').fill('user1@example.org'); - await page.getByPlaceholder('Password').click(); - await page.getByPlaceholder('Password').fill('1234'); - await page.getByRole('button', { name: 'Log in' }).click(); + await page.getByRole('link', { name: '', exact: true }).click(); + await page.getByPlaceholder('Email address').click(); + await page.getByPlaceholder('Email address').fill('user1@example.org'); + await page.getByPlaceholder('Password').click(); + await page.getByPlaceholder('Password').fill('1234'); + await page.getByRole('button', { name: 'Log in' }).click(); - await accept_data_protection(page); + await accept_data_protection(page); - await page.getByRole('link', { name: 'Identities (DIDs)' }).click(); - await page.getByRole('link', { name: 'Add Identity ' }).click(); - await page.getByPlaceholder('Label').click(); - await page.getByPlaceholder('Label').fill('default'); - await page.getByLabel('Type').selectOption('1'); - await page.getByRole('button', { name: 'Save' }).click(); - await page.getByRole('link', { name: 'Request a credential' }).click(); - await page.getByRole('button', { name: 'Request' }).click(); - // TODO take last (because is the latest!!) - // src https://www.programsbuzz.com/article/playwright-select-first-or-last-element - // not tested - await page.getByRole('link', { name: '' }).last().click(); - const downloadPromise = page.waitForEvent('download'); - await page.getByRole('link', { name: 'Download as PDF (Catalan)' }).click(); - const download = await downloadPromise; - const download1Promise = page.waitForEvent('download'); - await page.getByRole('link', { name: 'Download as JSON' }).click(); - const download1 = await download1Promise; - const download2Promise = page.waitForEvent('download'); - await page.getByRole('link', { name: 'Download as PDF (Spanish)' }).click(); - const download2 = await download2Promise; - await page.pause(); + await page.getByRole('link', { name: 'Identities (DIDs)' }).click(); + await page.getByRole('link', { name: 'Add Identity ' }).click(); + await page.getByPlaceholder('Label').click(); + await page.getByPlaceholder('Label').fill('default'); + await page.getByLabel('Type').selectOption('1'); + await page.getByRole('button', { name: 'Save' }).click(); + await page.getByRole('link', { name: 'Request a credential' }).click(); + await page.getByRole('button', { name: 'Request' }).click(); + // TODO take last (because is the latest!!) + // src https://www.programsbuzz.com/article/playwright-select-first-or-last-element + // not tested + await page.getByRole('link', { name: '' }).last().click(); + const downloadPromise = page.waitForEvent('download'); + await page.getByRole('link', { name: 'Download as PDF (Catalan)' }).click(); + const download = await downloadPromise; + const download1Promise = page.waitForEvent('download'); + await page.getByRole('link', { name: 'Download as JSON' }).click(); + const download1 = await download1Promise; + const download2Promise = page.waitForEvent('download'); + await page.getByRole('link', { name: 'Download as PDF (Spanish)' }).click(); + const download2 = await download2Promise; + await page.pause(); + }); + + test('oidc_flow', async ({ page }) => { + await oidc_flow(page); + await page.pause(); + }); + + test('login', async ({ page }) => { + await login(page); + await page.pause(); + }); + + test('ereuse_pilot', async ({ page }) => { + // TEMP reenable + await oidc_flow(page); + + // TODO hardcoded domain + await page.goto('https://devicehub.demo.pangea.org/'); + await page.getByPlaceholder('Email').fill('manufacturer@hp.es'); + await page.getByPlaceholder('Email').press('Tab'); + await page.getByPlaceholder('Password').fill('1234'); + await page.getByPlaceholder('Password').press('Enter'); + + await page.getByRole('button', { name: ' Snapshots' }).click(); + await page.getByRole('link', { name: ' Upload files' }).click(); + + // TODO hardcoded URL + // TODO this was the first we tried and work + //const snapshot_file='/home/music/org-extra/projects-2024/2024_17_tchain/2024-04-02__piloto-ereuse/snapshot-2022-6-9-10-21_usody@pangea.org_7928afeb-e6a4-464a-a842-0c3de0d01677.json' + // TODO this comes from here: https://gitea.pangea.org/trustchain-oc1-orchestral/devicehub-teal/src/branch/idhub/examples/snapshots/snapshot01.json + //const snapshot_file='/home/music/trustchain-oc1-orchestral-docker/devicehub-teal/examples/snapshots/snapshot01.json' + await page.locator('#snapshot').setInputFiles(snapshot_file); + await page.getByRole('button', { name: 'Send' }).click(); + await page.getByRole('link', { name: ' Unassigned devices' }).click(); + + await page.getByRole('link', { name: ' Laptop hewlett-packard hp' }).click(); + await page.getByRole('button', { name: 'Digital Passports' }).click(); + + const page1Promise = page.waitForEvent('popup'); + await page.getByRole('link', { name: '169f2c6c0b60a529fce65ba619b2fa5ddc02207e0cbe8b7d64afe39bb247e02f:' }).click(); + const page1 = await page1Promise; + + await page1.getByRole('link', { name: 'Logout' }).click(); + await page1.getByRole('button', { name: 'Validate' }).click(); + await page1.getByRole('link', { name: 'Use a wallet' }).click(); + await page1.getByRole('button', { name: 'Go' }).click(); + await page1.getByRole('radio').check(); + await page1.getByRole('checkbox').check(); + await page1.getByRole('button', { name: 'Present' }).click(); + + await page.pause(); + }); }); -test('oidc_flow', async ({ page }) => { - await oidc_flow(page); - await page.pause(); -}); - -test('login', async ({ page }) => { - await login(page); - await page.pause(); -}); - -test('ereuse_pilot', async ({ page }) => { - // TEMP reenable - await oidc_flow(page); - - // TODO hardcoded domain - await page.goto('https://devicehub.demo.pangea.org/'); - await page.getByPlaceholder('Email').fill('manufacturer@hp.es'); - await page.getByPlaceholder('Email').press('Tab'); - await page.getByPlaceholder('Password').fill('1234'); - await page.getByPlaceholder('Password').press('Enter'); - - await page.getByRole('button', { name: ' Snapshots' }).click(); - await page.getByRole('link', { name: ' Upload files' }).click(); - - // TODO hardcoded URL - // TODO this was the first we tried and work - //const snapshot_file='/home/music/org-extra/projects-2024/2024_17_tchain/2024-04-02__piloto-ereuse/snapshot-2022-6-9-10-21_usody@pangea.org_7928afeb-e6a4-464a-a842-0c3de0d01677.json' - // TODO this comes from here: https://gitea.pangea.org/trustchain-oc1-orchestral/devicehub-teal/src/branch/idhub/examples/snapshots/snapshot01.json - //const snapshot_file='/home/music/trustchain-oc1-orchestral-docker/devicehub-teal/examples/snapshots/snapshot01.json' - await page.locator('#snapshot').setInputFiles(snapshot_file); - await page.getByRole('button', { name: 'Send' }).click(); - await page.getByRole('link', { name: ' Unassigned devices' }).click(); - - await page.getByRole('link', { name: ' Laptop hewlett-packard hp' }).click(); - await page.getByRole('button', { name: 'Digital Passports' }).click(); - - const page1Promise = page.waitForEvent('popup'); - await page.getByRole('link', { name: '169f2c6c0b60a529fce65ba619b2fa5ddc02207e0cbe8b7d64afe39bb247e02f:' }).click(); - const page1 = await page1Promise; - - await page1.getByRole('link', { name: 'Logout' }).click(); - await page1.getByRole('button', { name: 'Validate' }).click(); - await page1.getByRole('link', { name: 'Use a wallet' }).click(); - await page1.getByRole('button', { name: 'Go' }).click(); - await page1.getByRole('radio').check(); - await page1.getByRole('checkbox').check(); - await page1.getByRole('button', { name: 'Present' }).click(); - - await page.pause(); -});