Context:
- Playwright Version: 15.2
- Operating System: Windows
- Node.js version: 14.17.3
- Browser: Chromium
Describe the bug
My use case is a simple data driven scenario. Where I am using async/await calls when reading data sets under test.describe its not able to identify the test available. Maybe because test.describe can not be async. Getting no tests found response when executing my test file.
// MY TEST FILE -- 1
import { test, expect } from '@playwright/test';
import { TestData } from '../../data/testData';
test.describe('Test suite 1', async () => {
const sample = new TestData();
await console.log('Testing starts');
const urlList = await sample.getUrlList();
urlList.forEach((url) => {
test(`Testing URL: ${url}`, async ({ page }) => {
await page.goto(url);
});
});
});
============================================
// TEST DATA FILE
export class TestData {
async getUrlList() {
const urlList = ['https://playwright.dev', 'https://google.com', 'https://github.com/'];
return urlList;
}
}
Even if I don't use test.describe as async and move my fetching dataset logic to test.beforeAll hook then also its not working.. Maybe the reason is that its not looking for the test inside the loop i.e. urlList.forEach. Getting no tests found response when executing my test file.
// MY TEST FILE -- 2
import { test, expect } from '@playwright/test';
import { TestData } from '../../data/testData';
test.describe('Test suite 1', () => {
let urlList = [];
test.beforeAll(async () => {
const sample = new TestData();
await console.log('Testing starts');
urlList = await sample.getUrlList();
});
urlList.forEach((url) =>
test(`Testing URL: ${url}`, async ({ page }) => {
await page.goto(url);
});
});
});
Context:
Describe the bug
My use case is a simple data driven scenario. Where I am using async/await calls when reading data sets under
test.describeits not able to identify thetestavailable. Maybe becausetest.describecan not beasync. Gettingno tests foundresponse when executing my test file.============================================
Even if I don't use
test.describeas async and move my fetching dataset logic totest.beforeAllhook then also its not working.. Maybe the reason is that its not looking for thetestinside the loop i.e.urlList.forEach. Getting no tests found response when executing my test file.