Trying to execute the playwright
test from the specified location results in a message prompting to run npm install -D @playwright/test
before running the test. Despite having already installed playwright
as a dev dependency, the test is still not being executed successfully. Any insights on what might be causing this issue would be greatly appreciated.
Attempts made so far:
1)
Test User@TestUser MINGW64 /c/Test
$ npx playwright test --headed
Please install @playwright/test package to use Playwright Test.
npm install -D @playwright/test
Test User@TestUser MINGW64 /c/Test $ npx playwright test Please install @playwright/test package to use Playwright Test. npm install -D @playwright/test
// test/test1.spec.js
const { test, expect } = require('@playwright/test');
test('basic test', async ({ page }) => {
await page.goto('https://playwright.dev/');
const title = page.locator('.navbar__inner .navbar__title');
await expect(title).toHaveText('Playwright');
});
//package.json
{
"name": "play",
"version": "1.0.0",
"description": "Playwright test",
"main": "index.js",
"directories": {
"test": "test"
},
"dependencies": {},
"devDependencies": {
"@playwright/test": "^1.16.1"
},
"scripts": {
"test": "npx playwright test"
},
"author": "Test",
"license": "ISC"
}