Search code examples
javascripttypescriptautomationtagsplaywright

Prevent Playwright form considering @ char as tag in a specific test


I have the following test:

const specialChars = `#@<`;

for (let specialChar of specialChars) {
  if (specialChar === "@") specialChar = `\@`;
  test(`search special character: "${specialChar}"`, async ({ page }) => {
    // test content
  });
}

The problem is that Playwright consider the ' that closes the test name as tag. enter image description here

I've tried to add \ before the @ like that, but it didn't help:

if (specialChar === "@") specialChar = `\@`;

Is there any way to prevent that?


Solution

  • I've found a solution using Unicode value \u{ff20} (original value u+ff20) like so:

    const specialChars = `#\u{ff20}<`;
    for (let specialChar of specialChars) {
      test(`search special character: "${specialChar}"`, async ({ page }) => {
       // test content
      });
    }
    

    enter image description here