Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

230
Views
El navegador Playwright está reabriendo cada declaración de prueba

¿Cómo evitar que el navegador se vuelva a abrir cada vez que se realiza cada declaración de prueba? Quiero decir que el código a continuación supuestamente está en 1 página continua. ¿Por qué se cierra el navegador, se abre de nuevo y se ejecuta la segunda prueba? ¿Cómo prevenir eso? Gracias

 test('When user logs in', async ({page}) => { const commonAction = new CommonAction(); await commonAction.gotoPage(page); await expect(page).toHaveURL('https://uat.mercator.createit.dev/login'); await commonAction.login( page, janEmail, janPasswd ); }); test('Then user is in my account page', async ({page}) => { const navigationAction = new NavigationAction(); await navigationAction.verifyAccountPage(page); }); test('When user goes to newsletter subscriptions', async ({page}) => { const navigationAction = new NavigationAction(); await navigationAction.goToNewsSubscription(page); }); test('Then user is in Newsletter subscription page', async ({page}) => { const navigationAction = new NavigationAction(); await navigationAction.verifyNewsletterPage(page); }); test('When user updates subscription', async ({page}) => { const newsletterAction = new NewsletterAction(); newsletterAction.subscribe(page); }); test('Then user is redirected to My Account page after subscription updates', async ({page}) => { const navigationAction = new NavigationAction(); await navigationAction.verifyAccountPage(); }); })```
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Para las pruebas que comparten la misma página y se basan en los resultados de las pruebas anteriores, debe envolverlas en test.describe.serial e inicializar la página en beforeAll , consulte esta guía para obtener más información.

Su ejemplo se vería así:

 const { test } = require('@playwright/test'); test.describe.serial('use the same page', () => { /** @type {import('@playwright/test').Page} */ let page; test.beforeAll(async ({ browser }) => { page = await browser.newPage(); }); test.afterAll(async () => { await page.close(); }); test('When user logs in', async ({}) => { const commonAction = new CommonAction(); await commonAction.gotoPage(page); await expect(page).toHaveURL('https://uat.mercator.createit.dev/login'); await commonAction.login( page, janEmail, janPasswd ); }); test('Then user is in my account page', async ({}) => { const navigationAction = new NavigationAction(); await navigationAction.verifyAccountPage(page); }); test('When user goes to newsletter subscriptions', async ({}) => { const navigationAction = new NavigationAction(); await navigationAction.goToNewsSubscription(page); }); test('Then user is in Newsletter subscription page', async ({}) => { const navigationAction = new NavigationAction(); await navigationAction.verifyNewsletterPage(page); }); test('When user updates subscription', async ({}) => { const newsletterAction = new NewsletterAction(); newsletterAction.subscribe(page); }); test('Then user is redirected to My Account page after subscription updates', async ({}) => { const navigationAction = new NavigationAction(); await navigationAction.verifyAccountPage(); }); });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!