diff --git a/.github/workflows/SSJ-Regression.yml b/.github/workflows/SSJ-Regression.yml new file mode 100644 index 000000000..449763e29 --- /dev/null +++ b/.github/workflows/SSJ-Regression.yml @@ -0,0 +1,87 @@ +name: PLATFORM BUSINESS - SSJ REGRESSION TESTS + +on: + workflow_dispatch: + inputs: + testBrowser: + description: 'Browser' + required: true + default: 'chrome' + +jobs: + build: + runs-on: self-hosted + env: + DISPLAY: ".99" + SCREEN_RESOLUTION: "1280x1024x24" + CI: 'true' # <-- added CI environment variable here + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + fetch-depth: 0 + - name: Setup Git LFS + run: | + sudo yum install -y git-lfs + git lfs install + - name: Set up JDK 1.11 + uses: actions/setup-java@v1 + with: + java-version: 1.11 + - name: Install Google Chrome + run: | + sudo yum install -y wget + wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm + sudo yum install -y ./google-chrome-stable_current_x86_64.rpm + - name: Replace variables in cloudEnv.properties + run: | + sed -i "s/SIDE_DOOR_USERNAME/${{ secrets.SIDEDOORUSERNAME }}/g" src/main/resources/conf/cloudEnv.properties + sed -i "s/SIDE_DOOR_PASSWORD/${{ secrets.SIDEDOORPASSWORD }}/g" src/main/resources/conf/cloudEnv.properties + sed -i "s/BROWSER_VAR/${{ github.event.inputs.testBrowser }}/g" src/main/resources/conf/cloudEnv.properties + sed -i "s/ENV_VAR/test/g" src/main/resources/conf/cloudEnv.properties + - name: Run specific runner class + run: mvn -B -q -Dtest=SSJ_Regression_Runners -DisCloud=true test + continue-on-error: true + - name: Generate timestamp + id: timestamp + run: echo "::set-output name=timestamp::$(TZ='America/New_York' date +'%Y-%m-%d_%I-%M-%S_%p')" + - name: Determine report path + id: reportpath + run: echo "::set-output name=path::ssj-regression-reports" + - name: Upload Cucumber Report + uses: actions/upload-artifact@v3 + if: always() + with: + name: cucumber-report-${{ github.run_number }} + path: target/ssj-regression-reports/* + - name: Push HTML Report + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + git config --global user.email "diegojuarezbusiness@gmail.com" + git config --global user.name "iamdez99" + git stash + git fetch + git checkout gh-pages + git stash pop + mkdir -p ${{ steps.reportpath.outputs.path }} + mv target/ssj-regression-reports/*.html ${{ steps.reportpath.outputs.path }}/report-${{ steps.timestamp.outputs.timestamp }}.html + git add . + git commit -m "Publishing cucumber report ${{ github.run_number }}" + git push -f https://${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:gh-pages + - name: Update Test Results and Append to Index File + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + if [[ -f "ssj-regression-test-results.html" ]]; then + sed -i '1s/.*/

SSJ Regression Test Results<\/h1>/' ssj-regression-test-results.html + echo "

Test Report ${{ steps.reportpath.outputs.path }}/report-${{ steps.timestamp.outputs.timestamp }}.html

" >> ssj-regression-test-results.html + git add ssj-regression-test-results.html + git commit -m "Update ssj-regression-test-results.html" + else + echo "

SSJ Regression Test Results

" > ssj-regression-test-results.html + echo "

Test Report ${{ steps.reportpath.outputs.path }}/report-${{ steps.timestamp.outputs.timestamp }}.html

" >> ssj-regression-test-results.html + git add ssj-regression-test-results.html + git commit -m "Create and update ssj-regression-test-results.html" + fi + git push https://${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:gh-pages \ No newline at end of file diff --git a/.gitignore b/.gitignore index b8573bdc3..8ed328fe8 100644 --- a/.gitignore +++ b/.gitignore @@ -54,6 +54,5 @@ src/test/java/ServiceNow/COVIDDash/Resources/.DS_Store src/test/java/ServiceNow/PlatformBusinessApps/CCT_CHAT_BOT/Playwright/Steps/Example.java src/test/java/PlaywrightTests_sandbox src/test/java/ServiceNow/PlatformBusinessApps/SSJ/playwright/Steps/Example.java -.github/workflows/SSJ-Regression.yml src/test/java/CustomBusiness/Egrants/pw src/test/java/CustomBusiness/Oasys \ No newline at end of file diff --git a/src/test/java/ServiceNow/PlatformBusinessApps/SSJ/SSJ_Runners/SSJ_Regression_Runners.java b/src/test/java/ServiceNow/PlatformBusinessApps/SSJ/SSJ_Runners/SSJ_Regression_Runners.java index d3a263c2e..4daded07e 100644 --- a/src/test/java/ServiceNow/PlatformBusinessApps/SSJ/SSJ_Runners/SSJ_Regression_Runners.java +++ b/src/test/java/ServiceNow/PlatformBusinessApps/SSJ/SSJ_Runners/SSJ_Regression_Runners.java @@ -8,7 +8,7 @@ "pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"} , features = {"src/test/java/ServiceNow/PlatformBusinessApps/SSJ/playwright/Features", "src/test/java/ServiceNow/PlatformBusinessApps/SSJ/selenium/Features"} , glue = {"ServiceNow.PlatformBusinessApps.SSJ.playwright.Steps", "ServiceNow.PlatformBusinessApps.SSJ.selenium.Steps", "Hooks"} - , tags = "@Regression" + , tags = "@ActionsTest" , dryRun = false ) diff --git a/src/test/java/appsCommon/Pages/Selenium_Common_Locators.java b/src/test/java/appsCommon/Pages/Selenium_Common_Locators.java index 76d30626f..b27dc2678 100644 --- a/src/test/java/appsCommon/Pages/Selenium_Common_Locators.java +++ b/src/test/java/appsCommon/Pages/Selenium_Common_Locators.java @@ -14,4 +14,4 @@ public class Selenium_Common_Locators { public static WebElement locateByXpath(String xpath){ return webDriver.findElement(By.xpath(xpath)); } -} +} \ No newline at end of file