/*
https://mdn.github.io/dom-examples/indexeddb-api/index.html
*/
import { test , expect} from '@playwright/test';
test
( '@authenticate'
, async ( { page, context, storageState , baseURL/**/} /* ,workerInfo*/ ) =>
{
// Modify for your own website
// ===========================================================================
// clear valid storage prior to runnging
// otherwise the login page may redirect to index page..
await page.goto(https://mdn.github.io/dom-examples/indexeddb-api/index.html); // needs to get to a page..
//await page.goto('https://examples.eze2e.com/login/cookie/'); // needs to get to a page..
// console.log( 'storageState='+ storageState );
//
// as per helper, clearCookies via context not by page.
await context.clearCookies();
await page.evaluate(() => window.localStorage .clear() );
await page.evaluate(() => window.sessionStorage .clear() );
//
//- await page.context().storageState({ path: storageState });
// ===========================================================================
// ===========================================================================
await page.getByRole('textbox', { name: 'Title:*' }).click();
await page.getByRole('textbox', { name: 'Title:*' }).fill('title1');
await page.getByRole('textbox', { name: 'Bibliographic ID: (ISBN, ISSN, etc.) *' }).click();
await page.getByRole('textbox', { name: 'Bibliographic ID: (ISBN, ISSN, etc.) *' }).fill('id1');
await page.getByRole('button', { name: 'Add Publication' }).click();
//
//console.log( 'storageState='+ storageState );
// https://playwright.dev/docs/release-notes
// make sure to save indexedDB
await page.context().storageState({ path: storageState, indexedDB: true });
// ===========================================================================
}
) ;