Giter Site home page Giter Site logo

Comments (7)

dgozman avatar dgozman commented on May 22, 2024 1

Another thing to consider: currently, many users write their tests sharing a page per describe and using it to do some steps. Since we insist on test isolation, it would be nice to have some kind of "test steps" that could be reported back to the test runner, especially when I am focusing on the test or suite.

from playwright-test.

celeryclub avatar celeryclub commented on May 22, 2024 1

Has any thought been given to an automatic log of commands performed by Playwright? I implemented this in a project. It's modeled after Cypress's in-browser command log. The dots are yellow while pending and then green on success or red on failure.

https://share.getcloudapp.com/OAubBAbv

My current implementation is a bit hacky (see microsoft/playwright#1654), but I'm curious what you think of this general idea.

from playwright-test.

dgozman avatar dgozman commented on May 22, 2024 1

@celeryclub Yep, we are thinking about this. The new Logger api in Playwright should be able to provide such a log, and test runner will be able to consume it.

from playwright-test.

JoelEinbinder avatar JoelEinbinder commented on May 22, 2024

jestjs/jest#9819 is working on this.

from playwright-test.

JoelEinbinder avatar JoelEinbinder commented on May 22, 2024

Another thing to consider: currently, many users write their tests sharing a page per describe and using it to do some steps. Since we insist on test isolation, it would be nice to have some kind of "test steps" that could be reported back to the test runner, especially when I am focusing on the test or suite.

Interesting! step alongside it! I like it. We'd report each step as its own test case to jest, and guarantee that they run serially with the same state.

from playwright-test.

JoelEinbinder avatar JoelEinbinder commented on May 22, 2024
steps('should work', ({page}) => {
  step('setup the page', async() => {
    await page.goto('https://joel.tools/')
  });
  step('click the button', async() => {
    await page.click('button');
    expect(await page.evaluate('clicked')).toBe(true);
  });
  step('click the other button button', async() => {
    await page.click('other-button');
    expect(await page.evaluate('otherClicked')).toBe(true);
  });
});
it('should work', ({page}) => {
  await step('setup the page', async() => {
    await page.goto('https://joel.tools/')
  });
  await step('click the button', async() => {
    await page.click('button');
    expect(await page.evaluate('clicked')).toBe(true);
  });
  await step('click the other button button', async() => {
    await page.click('other-button');
    expect(await page.evaluate('otherClicked')).toBe(true);
  });
});
it('should work', ({page}) => {
  step('setup the page');
  await page.goto('https://joel.tools/')
  
  step('click the button');
  await page.click('button');
  expect(await page.evaluate('clicked')).toBe(true);
  
  step('click the other button button');
  await page.click('other-button');
  expect(await page.evaluate('otherClicked')).toBe(true);
});

Which do you like?

from playwright-test.

dgozman avatar dgozman commented on May 22, 2024

The last one. However, it would probably be it('should work', ({page, step}) => {...})

from playwright-test.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.