Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: The command "npx playwright show-trace" doesn't work with trace zipped folder if name contains spaces #7640

Closed
AlexKomanov opened this issue Jul 15, 2021 · 2 comments

Comments

@AlexKomanov
Copy link
Contributor

Playwright version

1.12.3

Operating system

Windows

What browsers are you seeing the problem on?

No response

Other information

Node.js version: v14.16.1
Windows version: 10
WebStorm version 2021.1.3

What happened? / Describe the bug

I record a trace for each test that I perform.
In order to avoid file overwriting - I use the title of the test (testInfo.title) as the name of the file (see the complete code in the section below).

image

After test performing - I get the following trace zipped folder:

image

As can be seen - the name of the zipped folder is 'Search and buy item.zip'.

In order to open the trace of the test, I use the "npx playwright show-trace" command via the IDE terminal. Using the terminal autocompletion - I get the following path:

image

But the attempt to perform this command with the provided path - triggers error:

image

Only if I'll remove the spaces from the zipped directory (for example: 'Searchandbuyitem.zip') - it will work as well.

See the full code in the section below.

Code snippet to reproduce your bug

import test, { BrowserContext, Page } from "@playwright/test";
import BasePage from "../../common/BasePage";
import ApplicationUrl from "../../helpers/applicationUrl";
import Header from "../components/Header";
import RegisterForm from "../components/RegisterForm";
import UpperNavigationMenu from "../components/UpperNavigationMenu";
import MerchandisePage from "../pages/MerchandisePage";

test.describe("Buy Merchandise Feature", async () => {
  let basePage: BasePage;
  let header: Header;
  let registerForm: RegisterForm;
  let upperNavigationMenu: UpperNavigationMenu;
  let merchandisePage: MerchandisePage;


  test.beforeAll(async ({ }) => {});

  test.beforeEach(async ({ page, context}) => {
    basePage = new BasePage(page);
    header = new Header(page);
    registerForm = new RegisterForm(page);
    upperNavigationMenu = new UpperNavigationMenu(page);
    merchandisePage = new MerchandisePage(page);

    await basePage.loadApplication(ApplicationUrl.ESRO);
    await context.tracing.start({
      screenshots: true,
      snapshots: true,
    });
  });

  test.afterAll(async ({browser}) => {
    await browser.close();
  });

  test.afterEach(async ({context, page, }, testInfo) => {
      await context.clearCookies();

      //await page.screenshot();
    await context.tracing.stop({path: 'traces/'+ testInfo.status + '/' + testInfo.title +'.zip'});
    //await page.close();
    //await context.close();


  });

  test.only('Search and buy item', async ({browser}) => {
    let firstName = basePage.getRandomFirstName;
    let lastName = basePage.getRandomLastName;
    let email = basePage.getRandomMail;
    let phone = basePage.getRandomPhone;

    await header.openRegisterForm();
    await registerForm.fillRegisterFormWithSkip(firstName, lastName, email, phone);
    await header.validateUserDetails(firstName, lastName);

    await upperNavigationMenu.chooseMenuTab('Merchandise');
    await upperNavigationMenu.validateEndPoint('/merchandise');
    await merchandisePage.searchAndChooseItem('Tea');
  })

});

Relevant log output

No response

@aslushnikov
Copy link
Collaborator

@AlexKomanov This seems to be an NPX issue on Windows:

The official "workaround" for this would be to install NPM v7:

$ npm i -g npm@v7

@AlexKomanov
Copy link
Contributor Author

@aslushnikov
Thanks!
Worked for me perfectly!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants