diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 025db33..e325488 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -1,35 +1,96 @@
-name: CI
+name: Java CI with Maven
on:
pull_request:
- branches: [main]
+ branches:
+ - main
+ push:
+ branches:
+ - main
jobs:
- run-test:
+ build:
name: 'Run tests'
runs-on: ubuntu-latest
steps:
+ # 1. Cloning
- name: Git clone
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
+ uses: actions/checkout@v4
- - name: Install JDK
- uses: actions/setup-java@v3
+ # 2. Install Java 17
+ - name: Setup JDK 17
+ uses: actions/setup-java@v4
with:
- distribution: 'corretto'
java-version: '17'
+ distribution: 'corretto'
cache: 'maven'
- - name: Get list of changed files
- run: echo "LIST_OF_CHANGED_FILES=$(git diff --name-only origin/$GITHUB_HEAD_REF $(git merge-base origin/$GITHUB_HEAD_REF origin/main) | tr '\n' ';')" >> $GITHUB_ENV
+ # 3. Run tests (not stop workflow if failure )
+ - name: Build and run tests with Maven
+ run: mvn -B -e clean test -Dselenium.headless=true || true
+ env:
+ CHROME_OPTIONS: --remote-allow-origins=*;--disable-gpu;--no-sandbox;--disable-dev-shm-usage;--headless=new;--window-size=1920,1080
- - name: Attach screenshots and reports
- uses: actions/upload-artifact@v3
+ # 4. Output failed tests
+ - name: Print failed tests
if: failure()
+ run: |
+ echo "---- TEST FAILURES ----"
+ cat target/surefire-reports/*.txt || true
+
+ # 5. Attach screenshots
+ - name: Attach screenshots
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: screenshots
+ path: ${{ github.workspace }}/screenshots
+
+ # 6. Get Allure (gh-pages)
+ - name: Get Allure history
+ uses: actions/checkout@v4
+ if: always()
+ continue-on-error: true
+ with:
+ ref: gh-pages
+ path: gh-pages
+
+ # 7. Build Allure report
+ - name: Build Allure report
+ uses: simple-elf/allure-report-action@master
+ if: always()
+ id: allure-report
+ with:
+ allure_results: target/allure-results
+ gh_pages: gh-pages
+ allure_report: allure-report
+ allure_history: allure-history
+
+ # 8. Upload Allure report artifact
+ - name: Upload Allure report artifact
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: allure-report
+ path: target/allure-report
+
+ # 9. Check allure-results
+ - name: Check Allure results
+ run: ls -la target/allure-results
+
+ # 10. Publish Allure to GitHub Pages
+ - name: Publish Allure report to Github Pages
+ if: always()
+ uses: peaceiris/actions-gh-pages@v2
+ env:
+ PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ PUBLISH_BRANCH: gh-pages
+ PUBLISH_DIR: allure-history
+
+ - name: Upload Allure HTML report as artifact
+ if: always()
+ uses: actions/upload-artifact@v4
with:
- name: screenshots-and-report
- path: |
- screenshots
- target/surefire-reports/emailable-report.html
\ No newline at end of file
+ name: allure-report
+ path: allure-report
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 5ff6309..ffe7f4b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ target/
*.iws
*.iml
*.ipr
+'.idea/workspace.xml
### Eclipse ###
.apt_generated
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 11e489f..223753f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,11 +6,7 @@
-
-
-
-
-
+
@@ -32,18 +28,18 @@
- {
+ "lastFilter": {
+ "state": "OPEN",
+ "assignee": "RomanBurlaka78"
}
-}]]>
-
+ {
+ "selectedUrlAndAccountId": {
+ "url": "https://github.com/RomanBurlaka78/DemoqaJava-.git",
+ "accountId": "bc05234d-3816-4ee0-9a85-a3a7ea48eb65"
}
-}]]>
+}
@@ -61,6 +57,7 @@
"Maven.szablon_javaTest [test].executor": "Run",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
"RunOnceActivity.git.unshallow": "true",
"TestNG.ElementsPageTest.testGoToElementsPage.executor": "Run",
"TestNG.ElementsPageTests.executor": "Run",
@@ -69,12 +66,18 @@
"TestNG.ElementsPageTests.testVerifyTextBox (1).executor": "Run",
"TestNG.ElementsPageTests.testVerifyTextBox.executor": "Run",
"TestNG.ElementsPageTests.testVerifyTextBoxForm.executor": "Run",
- "git-widget-placeholder": "main",
+ "git-widget-placeholder": "test",
"ignore.virus.scanning.warn.message": "true",
"kotlin-language-version-configured": "true",
- "last_opened_file_path": "C:/Disk D/RedRover.shools/automationExercise_java"
+ "last_opened_file_path": "C:/Disk D/RedRover.shools/automationExercise_java",
+ "settings.editor.selected.configurable": "terminal"
}
}]]>
+
+
+
+
+
@@ -168,7 +171,6 @@
-
diff --git a/pom.xml b/pom.xml
index 0231900..2573d7c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -12,9 +12,22 @@
17
17
+ 2.24.0
+ 1.9.22
UTF-8
+
+
+
+ io.qameta.allure
+ allure-bom
+ ${allure.version}
+ pom
+ import
+
+
+
@@ -35,8 +48,46 @@
test
+
+ io.qameta.allure
+ allure-testng
+ test
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.1.2
+
+
+ -javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
+
+
+
+
+ org.aspectj
+ aspectjweaver
+
+ ${aspectj.version}
+
+
+
+
+
+ io.qameta.allure
+ allure-maven
+ 2.12.0
+
+ ${project.build.directory}/allure-results
+
+
+
+
+
diff --git a/src/test/java/automatiom/tests/ElementsPage.java b/src/test/java/automatiom/tests/ElementsPage.java
index 611a1ad..f6d31ab 100644
--- a/src/test/java/automatiom/tests/ElementsPage.java
+++ b/src/test/java/automatiom/tests/ElementsPage.java
@@ -2,6 +2,7 @@
import automatiom.tests.base.BaseConfigurationPage;
import automatiom.tests.base.BasePage;
+import io.qameta.allure.Step;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@@ -25,7 +26,7 @@ public ElementsTextBoxPage clickGotoNewPage() {
}
- @FindBy(xpath ="//div[@class = 'accordion']//div[@class='element-group'][1]")
+ @FindBy(xpath = "//div[@class = 'accordion']//div[@class='element-group'][1]")
WebElement sectionElements;
@FindBy(xpath = "//span[contains(text(), 'Text Box')]")
@@ -36,6 +37,7 @@ public String getUrlOfPage() {
return getDriver().getCurrentUrl();
}
+ @Step("Show elements content")
public ElementsPage showElementsContent() {
sectionElements.click();
getDriver().navigate().back();
@@ -44,11 +46,11 @@ public ElementsPage showElementsContent() {
return this;
}
+ @Step("Show text box")
public ElementsTextBoxPage showTextBoxText() {
getTextBox.click();
return new ElementsTextBoxPage(getDriver());
}
-
}
diff --git a/src/test/java/automatiom/tests/tests/ElementsPageTest.java b/src/test/java/automatiom/tests/tests/ElementsPageTest.java
index 7fee99d..8dc57ed 100644
--- a/src/test/java/automatiom/tests/tests/ElementsPageTest.java
+++ b/src/test/java/automatiom/tests/tests/ElementsPageTest.java
@@ -4,9 +4,15 @@
import automatiom.tests.ElementsTextBoxPage;
import automatiom.tests.HomePage;
import automatiom.tests.runner.BaseTest;
+import io.qameta.allure.Epic;
+import io.qameta.allure.Feature;
+import io.qameta.allure.Story;
import org.testng.Assert;
import org.testng.annotations.Test;
+@Epic("Selenium elements")
+@Feature("Elements")
+
public class ElementsPageTest extends BaseTest {
private static final String ELEMENTS_PAGE = "https://demoqa.com/elements";
@@ -19,7 +25,7 @@ public class ElementsPageTest extends BaseTest {
private ElementsTextBoxPage titleOfTextBoxElementsPage;
- @Test()
+ @Test
public void testGetTitle() {
String homePage = new HomePage(getDriver())
.accetpCookies()
@@ -44,6 +50,7 @@ public void testGoToElementsPage() {
@Test
+ @Story("Text box")
public void testVerifyTextBox() {
String titleOfTextBoxElementsPage = new HomePage(getDriver())
.accetpCookies()
@@ -58,6 +65,7 @@ public void testVerifyTextBox() {
}
@Test
+ @Story("Text box")
public void testVerifyTextBoxForm() {
String titleOfTextBoxElementsPage = new HomePage(getDriver())
.accetpCookies()
diff --git a/src/test/resources/allure.properties b/src/test/resources/allure.properties
new file mode 100644
index 0000000..6c1e0bb
--- /dev/null
+++ b/src/test/resources/allure.properties
@@ -0,0 +1 @@
+allure.results.directory=target/allure-results
\ No newline at end of file