add ereuse pilot test

it is still hardcoded but works on my computer :)

(it requires some files not published)

also converted oidc_flow as a function to be reused by pilots
This commit is contained in:
pedro 2024-04-03 19:07:22 +02:00
parent 16c612762c
commit f09e5b4e65
1 changed files with 59 additions and 12 deletions

View File

@ -40,7 +40,7 @@ async function set_org_key(page) {
// useful for DEBUG // useful for DEBUG
// await page.pause(); // await page.pause();
test('oidc_flow', async ({ page }) => { async function oidc_flow(page) {
await login(page); await login(page);
@ -52,12 +52,16 @@ test('oidc_flow', async ({ page }) => {
// 1. make it relative // 1. make it relative
// 2. add file in e2e test directory (maybe already exists) // 2. add file in e2e test directory (maybe already exists)
// see ./vc_excel/financial-vulnerability.xlsx (visto, no es el mismo) // see ./vc_excel/financial-vulnerability.xlsx (visto, no es el mismo)
// TODO change hardcoded paths
if (/setem/.test(hostname)) { if (/setem/.test(hostname)) {
vcred_schema='Membership Card' vcred_schema='Membership Card'
vcred_file='/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/membership-card.xlsx' vcred_file='/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/membership-card.xlsx'
} else { } else if (/xo9b/.test(hostname)) {
vcred_schema='Financial Vulnerability Credential' vcred_schema='Financial Vulnerability Credential'
vcred_file='/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/financial-vulnerability.xlsx' vcred_file='/home/music/trustchain-oc1-orchestral-docker/IdHub/examples/excel_examples/financial-vulnerability.xlsx'
} 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'
} }
await set_org_key(page); await set_org_key(page);
@ -92,18 +96,19 @@ test('oidc_flow', async ({ page }) => {
await page.getByRole('button', { name: 'Save' }).click(); await page.getByRole('button', { name: 'Save' }).click();
await page.getByRole('link', { name: 'Request a credential' }).click(); await page.getByRole('link', { name: 'Request a credential' }).click();
await page.getByRole('button', { name: 'Request' }).click(); await page.getByRole('button', { name: 'Request' }).click();
// TODO hardcoded domain VERIFIER
if (/xo9b/.test(hostname)) {
await page.goto(IDHUB_VERIFIER + '/promotion/'); await page.goto(IDHUB_VERIFIER + '/promotion/');
await page.getByRole('link', { name: 'Contractar amb credencial' }).click(); await page.getByRole('link', { name: 'Contractar amb credencial' }).click();
await page.getByRole('button', { name: 'Go' }).click(); await page.getByRole('button', { name: 'Go' }).click();
await page.getByRole('radio').first().check(); await page.getByRole('radio').first().check();
await page.getByRole('checkbox').check(); await page.getByRole('checkbox').check();
await page.getByRole('button', { name: 'Present' }).click(); await page.getByRole('button', { name: 'Present' }).click();
await page.pause(); }
// TODO averiguar si devuelve código es final 1 (OIDC_REDIRECT=false)
// TODO averiguar si devuelve código es final 1 (OIDC_REDIRECT=false)
// TODO averiguar si hace redirección a 2 es final 2 (OIDC_REDIRECT=true) // TODO averiguar si hace redirección a 2 es final 2 (OIDC_REDIRECT=true)
}); }
// TODO test que hace la presentación de la credencial al revés // TODO test que hace la presentación de la credencial al revés
@ -178,7 +183,49 @@ test('sign_pdf', async ({ page }) => {
await page.pause(); await page.pause();
}); });
test('oidc_flow', async ({ page }) => {
await oidc_flow(page);
await page.pause();
});
test('login', async ({ page }) => { test('login', async ({ page }) => {
await login(page); await login(page);
await page.pause(); 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
await page.locator('#snapshot').setInputFiles('/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');
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();
});