Playwright Java Tutorial 🎭 | Running Playwright Tests using Jenkins | Part XIII | LambdaTest

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ต.ค. 2024

ความคิดเห็น • 7

  • @LambdaTest
    @LambdaTest  11 หลายเดือนก่อน

    github.com/ortoniKC/LambdaTest-Playwright-Java

  • @bhavanahs6639
    @bhavanahs6639 9 หลายเดือนก่อน +1

    can you please show how to run a playwright test that takes some command line parameters like user name and password and run them on Jenkins using gradle

    • @LambdaTest
      @LambdaTest  9 หลายเดือนก่อน +1

      Hey there,
      To run Playwright tests with command line parameters and integrate them into Jenkins using Gradle, follow these condensed steps:
      Step 1: Modify Playwright Test for Environment Variables
      // Use environment variables for credentials in your Playwright test
      const username = process.env.USERNAME;
      const password = process.env.PASSWORD;
      Step 2: Set Up Gradle Task
      Add a task in build.gradle to run your Playwright test, using environment variables for any sensitive data.
      task runPlaywrightTest(type: Exec) {
      commandLine 'node', 'path/to/test.js'
      environment 'USERNAME', project.findProperty('username') ?: System.getenv('USERNAME')
      environment 'PASSWORD', project.findProperty('password') ?: System.getenv('PASSWORD')
      }
      Run it with:
      ./gradlew runPlaywrightTest -Pusername=user -Ppassword=pass
      Step 3: Configure Jenkins
      Freestyle Project: Add a "Invoke Gradle" build step with the runPlaywrightTest task.
      Pipeline: Use a Jenkinsfile to define stages, including setting environment variables and running the Gradle task.
      pipeline {
      agent any
      stages {
      stage('Test') {
      steps {
      sh './gradlew runPlaywrightTest -Pusername=${USERNAME} -Ppassword=${PASSWORD}'
      }
      }
      }
      }

    • @bhavanahs6639
      @bhavanahs6639 9 หลายเดือนก่อน

      @@LambdaTest thank you so much.

    • @LambdaTest
      @LambdaTest  8 หลายเดือนก่อน +1

      Thank you. Please susbcribe the channel for more such videos🙂

  • @bhavanahs6639
    @bhavanahs6639 9 หลายเดือนก่อน

    can you please show how to run a playwright test which take some parameters passed to them , run them on Jenkins using gradle. Your help will be much appeciated

    • @LambdaTest
      @LambdaTest  9 หลายเดือนก่อน +1

      Hi there! Thanks for reaching out! We're actively looking into your query on running a Playwright test with command line parameters like username and password on Jenkins using Gradle. We'll get back to you soon with the details you need. Appreciate your patience!