From d7666b7749b727810430cbdeaafbbb61b72e0b7c Mon Sep 17 00:00:00 2001 From: Cedric Ong <67156011+cedricongjh@users.noreply.github.com> Date: Tue, 20 Feb 2024 21:14:23 +0800 Subject: [PATCH] Add config for e2e sql tests (#12762) --- .github/workflows/e2e-sql.yml | 59 +++++++++++++++++++ build.gradle | 37 ++++++++++++ src/e2e/resources/testng-e2e-sql.xml | 12 ++++ src/e2e/resources/testng-unstable-e2e-sql.xml | 11 ++++ 4 files changed, 119 insertions(+) create mode 100644 .github/workflows/e2e-sql.yml create mode 100644 src/e2e/resources/testng-e2e-sql.xml create mode 100644 src/e2e/resources/testng-unstable-e2e-sql.xml diff --git a/.github/workflows/e2e-sql.yml b/.github/workflows/e2e-sql.yml new file mode 100644 index 00000000000..907e042f12f --- /dev/null +++ b/.github/workflows/e2e-sql.yml @@ -0,0 +1,59 @@ +name: E2E Tests + +on: + push: + branches: + - master + - release + - v9-migration + pull_request: + branches: + - master + - release + - v9-migration + schedule: + - cron: "0 0 * * *" #end of every day +jobs: + E2E-testing: + runs-on: ubuntu-latest + strategy: + fail-fast: false #ensure both tests run even if one fails + matrix: + browser: [firefox] + tests: [stable, unstable] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + - name: Cache Gradle packages + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Update Property File + run: mv src/e2e/resources/test.ci-${{ matrix.browser }}.properties src/e2e/resources/test.properties + - name: Run Solr search service + local Datastore emulator + run: docker-compose up -d + - name: Create Config Files + run: ./gradlew createConfigs testClasses generateTypes + - name: Install Frontend Dependencies + run: npm ci + - name: Build Frontend Bundle + run: npm run build + - name: Start Server + run: | + ./gradlew serverRun & + ./wait-for-server.sh + - name: Start Tests + run: xvfb-run --server-args="-screen 0 1024x768x24" ./gradlew -P${{ matrix.tests }} e2eTestsSql + \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1613ad421a6..d87e517c431 100644 --- a/build.gradle +++ b/build.gradle @@ -570,6 +570,43 @@ task e2eTests { e2eTests.dependsOn "e2eTestTry${id}" } +task e2eTestsSql { + description "Runs the E2E test suite and retries failed test up to ${numOfTestRetries} times." + group "Test" +} + +(1..numOfTestRetries + 1).each { id -> + def isFirstTry = id == 1 + def isLastRetry = id == numOfTestRetries + 1 + def runUnstableTests = project.hasProperty('unstable') + def outputFileName = runUnstableTests ? "e2e-sql-unstable-test-try-" : "e2e-test-try-" + + task "e2eSqlTestTry${id}"(type: Test) { + useTestNG() + options.suites isFirstTry + ? (runUnstableTests ? "src/e2e/resources/testng-unstable-e2e-sql.xml" : "src/e2e/resources/testng-e2e-sql.xml") + : file("${buildDir}/reports/${outputFileName}${id - 1}/testng-failed.xml") + options.outputDirectory = file("${buildDir}/reports/${outputFileName}${id}") + options.useDefaultListeners = true + ignoreFailures = !isLastRetry + maxHeapSize = "1g" + reports.html.required = false + reports.junitXml.required = false + jvmArgs "-Xss2m", "-Dfile.encoding=UTF-8" + testLogging { + events "passed" + } + afterTest afterTestClosure + if (isFirstTry) { + afterSuite checkTestNgFailureClosure + } + onlyIf { + isFirstTry || file("${buildDir}/reports/${outputFileName}${id - 1}/testng-failed.xml").exists() + } + } + e2eTestsSql.dependsOn "e2eSqlTestTry${id}" +} + task axeTests { description "Runs the full accessibility test suite and retries failed tests once." group "Test" diff --git a/src/e2e/resources/testng-e2e-sql.xml b/src/e2e/resources/testng-e2e-sql.xml new file mode 100644 index 00000000000..64907a933ff --- /dev/null +++ b/src/e2e/resources/testng-e2e-sql.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/e2e/resources/testng-unstable-e2e-sql.xml b/src/e2e/resources/testng-unstable-e2e-sql.xml new file mode 100644 index 00000000000..8855681cfed --- /dev/null +++ b/src/e2e/resources/testng-unstable-e2e-sql.xml @@ -0,0 +1,11 @@ + + + + + + + + + + +