From 6062fa3825db8412f4ea1255335287b281996f3f Mon Sep 17 00:00:00 2001 From: AEkaterina Date: Tue, 24 Oct 2023 21:14:57 +0400 Subject: [PATCH] updated logger hook and added link for report --- .github/workflows/maven.yml | 67 ++++++++++--------- src/test/java/features/BookDetailView.feature | 2 +- src/test/java/hooks/LoggerHooks.java | 2 + 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 369ba76..b9b1004 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -62,38 +62,41 @@ jobs: name: allure-report path: target/site/allure-maven-plugin -# - name: Get Allure history -# uses: actions/checkout@v3 -# if: always() -# continue-on-error: true -# with: -# ref: gh-pages -# path: gh-pages + - name: Get Allure history + uses: actions/checkout@v3 + if: always() + continue-on-error: true + with: + ref: gh-pages + path: gh-pages -# - name: Allure Report action from marketplace -# uses: simple-elf/allure-report-action@master -# if: always() -# id: allure-report -# with: -# allure_results: allure-results -# gh_pages: gh-pages -# allure_report: allure-report -# allure_history: allure-history + - name: Allure Report action from marketplace + uses: PavanMudigonda/allure-html-reporter-github-pages@v1.0 + if: always() + id: allure-report + with: + token: ${{ secrets.PERSONAL_TOKEN }} + WORKFLOW_ID: maven.yml + allure_results: allure-results + gh_pages: gh-pages + allure_report: allure-report + allure_history: allure-history -# - name: Deploy report to GitHub Pages -# if: always() -# uses: peaceiris/actions-gh-pages@v2 -# env: -# PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} -# PUBLISH_BRANCH: gh-pages -# PUBLISH_DIR: allure-history + - name: Deploy report to GitHub Pages + if: always() + uses: peaceiris/actions-gh-pages@v2 + env: + PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }} + PUBLISH_BRANCH: gh-pages + PUBLISH_DIR: allure-history + keep_files: true -# - name: Post the link to the report -# if: always() -# uses: Sibz/github-status-action@v1 -# with: -# authToken: ${{secrets.PERSONAL_TOKEN}} -# context: 'Test report' -# state: 'success' -# sha: ${{ github.event.pull_request.head.sha || github.sha }} -# target_url: https://thepalaceproject.github.io/allure-html-reporter-github-pages/${{ github.run_number }} \ No newline at end of file + - name: Post the link to the report + if: always() + uses: Sibz/github-status-action@v1 + with: + authToken: ${{secrets.PERSONAL_TOKEN}} + context: 'Test report' + state: 'success' + sha: ${{ github.event.pull_request.head.sha || github.sha }} + target_url: https://thepalaceproject.github.io/allure-html-reporter-github-pages/${{ github.run_number }} \ No newline at end of file diff --git a/src/test/java/features/BookDetailView.feature b/src/test/java/features/BookDetailView.feature index c0ad2cb..fda47d3 100644 --- a/src/test/java/features/BookDetailView.feature +++ b/src/test/java/features/BookDetailView.feature @@ -403,7 +403,7 @@ Feature: Book detail view screen And Tap the Sign in button on Sign in screen Then There is an alert "Invalid credentials" on Sign in screen - @smoke + @report Scenario: Book detail view: Perform check of Get button before log in from the Settings tab When Add library "LYRASIS Reads" on Add library screen Then Library "LYRASIS Reads" is opened on Libraries screen diff --git a/src/test/java/hooks/LoggerHooks.java b/src/test/java/hooks/LoggerHooks.java index 13a8fef..f005b6e 100644 --- a/src/test/java/hooks/LoggerHooks.java +++ b/src/test/java/hooks/LoggerHooks.java @@ -39,9 +39,11 @@ public void addLogToScenario(Scenario scenario) { @BeforeStep public void getStepName(Scenario scenario) throws Exception { Field delegateField = scenario.getClass().getDeclaredField("delegate"); + delegateField.setAccessible(true); TestCaseState testCaseState = (TestCaseState) delegateField.get(scenario); Field testCaseField = testCaseState.getClass().getDeclaredField("testCase"); + testCaseField.setAccessible(true); TestCase r1 = (TestCase) testCaseField.get(testCaseState); List stepDefinitions = r1.getTestSteps()