Integrate Circle CI

  1. Tạo tài khoản Github

  2. Install git bash

  3. setup git

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
  • Github Action is support run your code on circle CI free, blow is config:

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8
      - name: Run Selenium Test
        run: mvn test -Dtestplan=todoTestPlan.xml
      - name: Publish Test Report
        uses: scacap/action-surefire-report@v1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./target/surefire-reports/
  • Change open browser to headless mode

ublic static void launch(String name) {
    if (name.equalsIgnoreCase("chrome")) {
        WebDriverManager.chromedriver().setup();
        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.setHeadless(true);
        driver = new ChromeDriver(chromeOptions);
    } else if (name.equalsIgnoreCase("firefox")) {
        WebDriverManager.firefoxdriver().setup();
        driver = new FirefoxDriver();
    } else if (name.equalsIgnoreCase("ie")) {
        WebDriverManager.iedriver().setup();
        driver = new InternetExplorerDriver();
    }
    mouse = new Actions(getDriver());
    wait = new WebDriverWait(getDriver(), 30);
}

Last updated

Was this helpful?