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

564
Views
Error: no se puede encontrar el módulo '@dramaturgo/prueba'

Actualmente estoy tratando de usar expect para hacer aserciones usando const { expect } = require('@playwright/test'); pero cada vez que obtengo un error: no se puede encontrar el módulo '@playwright/test'. Es un guión muy corto, pero algo está mal en eso.

 const { chromium } = require("playwright"); const { expect } = require('@playwright/test'); const { matchers } = require('playwright-expect'); console.log("##########", expect) // add custom matchers expect.extend(matchers); (async () => { const browser = await chromium.launch({ headless: false, }); const page = await browser.newPage(); await page.goto("someurl"); await page.fill("input[name='userLoginId']", 'nnn'); await page.fill("input[name='password']", 'nnn'); await page.click("button[type=submit]"); })();

paquete.json

 { "name": "playwright", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "node ./index.js" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "playwright": "^1.15.1", "playwright-expect": "^0.1.2" } }

La prueba funciona bien sin esto:

 const { expect } = require('@playwright/test'); const { matchers } = require('playwright-expect'); console.log("##########", expect) // add custom matchers expect.extend(matchers);

Y hace lo que le pido que haga, pero ahora que quiero hacer afirmaciones y le agrego eso, ahora no funciona.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

  1. Tienes que instalar @playwright/test library:
 npm i -D @playwright/test
  1. No utilice la biblioteca playwright-expect . Playwright ya incluye aserciones basadas en la web . Por lo tanto, no hay razón para usar una biblioteca adicional para extender la expectativa.

  2. Eliminar código no utilizado:

 const { matchers } = require('playwright-expect'); console.log("##########", expect) // add custom matchers expect.extend(matchers);
about 4 years ago · Juan Pablo Isaza Report

0

Creé un problema sobre la misma pregunta aquí https://github.com/microsoft/playwright/issues/14971 y actualizaré el resultado cuando se responda.

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!