Playwright with TS - Page Object Model - Setup

Поділитися
Вставка
  • Опубліковано 2 жов 2024
  • Playwright with TS - Page Object Model - Setup
    Locators basics:
    • Playwright with Java -...
    • Playwright with Java -...
    • Playwright with Java -...

КОМЕНТАРІ • 5

  • @coolmahen
    @coolmahen Рік тому +1

    Thanks for sharing valuable info.QQ
    Under formPage.ts ;if line 4 is replaced with
    public static fname = '#firstname';
    then line 16
    await this.page.locator(Form.firstname).type(fname);
    My current real-time (POM)project looks like the above. Is this also considered a proper coding standard? Your input is highly appreciated.

    • @QaAutomationAlchemist
      @QaAutomationAlchemist  Рік тому +1

      Thanks for asking . You can use it.
      However,
      Use static variables when you want to share data or configuration across all instances of a class.
      Use instance variables (accessed via this) when you need to store and access data that is specific to each instance of an object.
      Better use "this", as it will be individual instance, so that you can change ( in specific test and will not impact other test ) or use in parallel testing.

    • @coolmahen
      @coolmahen Рік тому

      @@QaAutomationAlchemist Thank you for your explanation.👍

  • @mr.hgorgan1812
    @mr.hgorgan1812 Рік тому +1

    awesome content, nice and easy with the screenshot and video options in the config file. One question: in the case of a major project with hundreds of tests, will those features (screenshot and video capture) hinder the test run speed?

    • @QaAutomationAlchemist
      @QaAutomationAlchemist  Рік тому

      You can set video and screenshots on only test failures
      Go to Playwright. config. ts file and under use add the flag screenshot: 'only-on-failure'.