<p dir="auto">If I wrap the playwright test object with our own custom test class, no tests run. Importing the playwright test object into the spec file directly works as expected.</p>
<p dir="auto">I am attempting to move a large codebase from a Selenium based framework (theintern.io) to playwright. We already have a strong test API that the framework implementation sits behind, unfortunately when it comes to implementing the test runner part of that API using Playwright we are running into an issue where it doesn't seem to find any thing to run.</p>
<p dir="auto">The repo below has a very simple repro case.<br>
Importing <code class="notranslate">test</code> from <code class="notranslate">@playwight/test</code> works as expected, but as soon as I try and use it from my wrapper class, nothing runs.</p>
<p dir="auto"><strong>Test</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { MyBdd } from &quot;../bdd&quot;;
// import { test } from &quot;@playwright/test&quot;;

MyBdd.test(&quot;run google&quot;, async (page) =&gt; {
  // test(&quot;run google&quot;, async ({ page }) =&gt; {
  await page.goto(&quot;https://www.google.com&quot;);
  await page.goto(&quot;https://www.google.com/&quot;);
  await page.getByRole(&quot;button&quot;, { name: &quot;Reject all&quot; }).click();
  await page.getByRole(&quot;combobox&quot;, { name: &quot;Search&quot; }).click();
  await page.getByRole(&quot;combobox&quot;, { name: &quot;Search&quot; }).fill(&quot;bob&quot;);
  await page.getByRole(&quot;combobox&quot;, { name: &quot;Search&quot; }).press(&quot;Enter&quot;);
});"><pre class="notranslate"><code class="notranslate">import { MyBdd } from "../bdd";
// import { test } from "@playwright/test";

MyBdd.test("run google", async (page) =&gt; {
  // test("run google", async ({ page }) =&gt; {
  await page.goto("https://www.google.com");
  await page.goto("https://www.google.com/");
  await page.getByRole("button", { name: "Reject all" }).click();
  await page.getByRole("combobox", { name: "Search" }).click();
  await page.getByRole("combobox", { name: "Search" }).fill("bob");
  await page.getByRole("combobox", { name: "Search" }).press("Enter");
});
</code></pre></div>
<p dir="auto"><strong>Test wrapper</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { test, Page } from &quot;@playwright/test&quot;;
export class MyBdd {
  public static describe(name: string, func: () =&gt; void) {
    return test.describe(name, func);
  }
  public static before(func: () =&gt; void) {
    return test.beforeAll(func);
  }
  public static test(name: string, func: (args: Page) =&gt; Promise&lt;void&gt;) {
    return test(name, (args) =&gt; func(args.page));
  }
}"><pre class="notranslate"><code class="notranslate">import { test, Page } from "@playwright/test";
export class MyBdd {
  public static describe(name: string, func: () =&gt; void) {
    return test.describe(name, func);
  }
  public static before(func: () =&gt; void) {
    return test.beforeAll(func);
  }
  public static test(name: string, func: (args: Page) =&gt; Promise&lt;void&gt;) {
    return test(name, (args) =&gt; func(args.page));
  }
}
</code></pre></div>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.33.0]</li>
<li>Operating System: [All]</li>
<li>Browser: [All]</li>
<li>Other info:</li>
</ul>
<h3 dir="auto">Source code</h3>
<ul dir="auto">
<li>[ x] I provided exact source code that allows reproducing the issue locally.</li>
</ul>




<p dir="auto"><strong>Link to the GitHub repository with the repro</strong><br>
<a href="https://github.com/David-Hart-i2/playwright-bdd-test">https://github.com/David-Hart-i2/playwright-bdd-test</a></p>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>[Run the test]</li>
</ul>
<p dir="auto"><strong>Expected</strong><br>
The test to be found and run</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">The test doesn't seem to be found. I get the output like a test has been run, but with zero tests.</p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.31.1]</li>
<li>Operating System: macOS 13.0</li>
<li>Browser: Chromium</li>
<li>Other info:</li>
</ul>
<h3 dir="auto">Source code</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I provided exact source code that allows reproducing the issue locally.</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" const fileToUpload = path.join(
    __dirname,
    `../e2e/__shared__/fixtures/samples/${wsdlRestApi}.wsdl`
  )

//fileToUpload yields:  /Users/calvin/Github/ui/e2e/__shared__/fixtures/samples/weather.wsdl

  const fileChooserPromise = page.waitForEvent('filechooser')
  await page
    .getByRole('button', {
      name: 'Drag and drop files here or click to upload (json/wsdl/xml/xsd/yml/yaml/zip)',
    })
    .click()
  const fileChooser = await fileChooserPromise
  await fileChooser.setFiles(fileToUpload)
"><pre class="notranslate"><code class="notranslate"> const fileToUpload = path.join(
    __dirname,
    `../e2e/__shared__/fixtures/samples/${wsdlRestApi}.wsdl`
  )

//fileToUpload yields:  /Users/calvin/Github/ui/e2e/__shared__/fixtures/samples/weather.wsdl

  const fileChooserPromise = page.waitForEvent('filechooser')
  await page
    .getByRole('button', {
      name: 'Drag and drop files here or click to upload (json/wsdl/xml/xsd/yml/yaml/zip)',
    })
    .click()
  const fileChooser = await fileChooserPromise
  await fileChooser.setFiles(fileToUpload)

</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/19965265/227322811-dbbf00ba-a6a2-4768-bb33-3dc65b5a1f0a.png"><img width="813" alt="image" src="https://user-images.githubusercontent.com/19965265/227322811-dbbf00ba-a6a2-4768-bb33-3dc65b5a1f0a.png" style="max-width: 100%;"></a></p>
<p dir="auto">This seems to only be happening for .wsdl files, as similar code was used for .yaml files and didn't seem to come up with this path error.</p>
<p dir="auto"><strong>Expected</strong><br>
Filechooser should select the path that fileToUpload yields, but cuts out the folders in the directory <code class="notranslate">/e2e/__shared__/fixtures/samples/</code></p>
<p dir="auto"><strong>Actual</strong><br>
Filechooser is choosing  <code class="notranslate">/Users/calvin/Github/ui/weather.wsdl</code> instead of <code class="notranslate">/Users/calvin/Github/ui/e2e/__shared__/fixtures/samples/weather.wsdl</code></p>
<p dir="auto">[Describe actual behavior]</p>