Skip to content

cic/cd run headless tests on pr and in main#60

Merged
brumlablo merged 4 commits intomainfrom
add_cicd
Apr 8, 2026
Merged

cic/cd run headless tests on pr and in main#60
brumlablo merged 4 commits intomainfrom
add_cicd

Conversation

@brumlablo
Copy link
Copy Markdown
Collaborator

@brumlablo brumlablo commented Apr 8, 2026

adresses issue #16

Summary by CodeRabbit

  • Tests

    • Added comprehensive end-to-end test tasks documenting UI flows, assertions, and manual setup steps.
  • Chores

    • Introduced a CI pipeline to run automated tests on pushes and pull requests.
    • Enabled headless and consistent browser sizing for test runs to improve reliability.
    • Updated project ignore/configuration to exclude transient test artifacts and editor settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 04552eb6-7369-4769-84ee-64ce53270673

📥 Commits

Reviewing files that changed from the base of the PR and between 008d44e and b1859f1.

📒 Files selected for processing (1)
  • practice/tasks.txt
✅ Files skipped from review due to trivial changes (1)
  • practice/tasks.txt

📝 Walkthrough

Walkthrough

Adds a CI workflow for Maven/Java 17 tests, updates .gitignore, adds Czech end-to-end test task descriptions, and enables configurable headless browser options and fixed window sizing in the WebDriver provider.

Changes

Cohort / File(s) Summary
CI workflow & ignores
.github/workflows/ci.yml, .gitignore
Adds a GitHub Actions CI workflow that runs mvn test on pushes to main and on PRs, sets up Java 17 (Temurin) with Maven caching, and uploads failedScreenshots/ as an artifact on test failures; updates .gitignore to keep failedScreenshots/ and .vscode/settings.json ignored.
Test tasks (documentation)
practice/tasks.txt
Adds a new file with end-to-end UI test task instructions in Czech covering navigation, form inputs, assertions, and manual setup/login/edit flows for admissions/registrations.
WebDriver headless & sizing
src/main/java/cz/czechitas/automation/WebDriverProvider.java
Introduces a static HEADLESS flag (from headless system property or CI=true env), documents headless behavior, applies --window-size=1920,1080 and conditional headless flags/options for Firefox/Chrome/Edge, and uses configured capabilities when creating drivers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through code at break of day,
CI stitched tests along the way,
Headless windows set just right,
Screenshots saved from failing night,
A tiny rabbit cheers: hip-hip-hooray! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly and clearly reflects the main objective: setting up CI/CD to run headless tests on PRs and main branch, which is confirmed by the commit messages and file changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add_cicd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/ci.yml (1)

9-12: Add workflow concurrency to cancel superseded runs.

This reduces queue time and wasted CI minutes when multiple commits are pushed to the same PR.

Proposed snippet
 name: CI
 
 on:
   push:
     branches:
       - main
   pull_request:
 
+concurrency:
+  group: ci-${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 jobs:
   test:
     runs-on: ubuntu-latest
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 9 - 12, Add a workflow-level
concurrency stanza to cancel superseded runs so multiple pushes to the same PR
don’t queue redundant jobs; in the Actions YAML containing the jobs block and
the test job (symbol "test"), add a top-level concurrency configuration (e.g.,
group using github.workflow and github.ref and cancel-in-progress: true) to
ensure earlier runs are cancelled when a newer run for the same branch/PR is
created.
src/main/java/cz/czechitas/automation/WebDriverProvider.java (1)

49-56: Consider making Firefox viewport deterministic in headed mode too.

Chrome and Edge always set --window-size=1920,1080, but Firefox dimensions are currently only set when headless. This can introduce browser-specific layout variance in local runs.

Suggested direction
-            if (HEADLESS) {
-                options.addArguments("--headless");
-                options.addArguments("--width=1920");
-                options.addArguments("--height=1080");
-            }
+            if (HEADLESS) {
+                options.addArguments("--headless");
+            }
+            options.addArguments("--width=1920");
+            options.addArguments("--height=1080");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/cz/czechitas/automation/WebDriverProvider.java` around lines 49
- 56, The FirefoxOptions currently only sets dimensions when HEADLESS; make
viewport deterministic in headed mode too by ensuring the same 1920x1080
arguments are always applied to FirefoxOptions (either move
options.addArguments("--width=1920") and options.addArguments("--height=1080")
out of the HEADLESS branch or add them in the else branch). Update the code
around the FirefoxOptions creation in WebDriverProvider (the block that returns
WebDriverManager.firefoxdriver().capabilities(options).create()) so width/height
are applied for both headless and headed runs.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@practice/tasks.txt`:
- Line 7: Fix the Czech typo in the tasks text by replacing the incorrect word
"pustupně" with the correct "postupně" in the sentence "Napište test, který
pustupně projde všechny sekce horního veřejného menu." so the sentence reads
"Napište test, který postupně projde všechny sekce horního veřejného menu.";
update the string where it appears (search for the exact phrase) to preserve
spacing and punctuation.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 9-12: Add a workflow-level concurrency stanza to cancel superseded
runs so multiple pushes to the same PR don’t queue redundant jobs; in the
Actions YAML containing the jobs block and the test job (symbol "test"), add a
top-level concurrency configuration (e.g., group using github.workflow and
github.ref and cancel-in-progress: true) to ensure earlier runs are cancelled
when a newer run for the same branch/PR is created.

In `@src/main/java/cz/czechitas/automation/WebDriverProvider.java`:
- Around line 49-56: The FirefoxOptions currently only sets dimensions when
HEADLESS; make viewport deterministic in headed mode too by ensuring the same
1920x1080 arguments are always applied to FirefoxOptions (either move
options.addArguments("--width=1920") and options.addArguments("--height=1080")
out of the HEADLESS branch or add them in the else branch). Update the code
around the FirefoxOptions creation in WebDriverProvider (the block that returns
WebDriverManager.firefoxdriver().capabilities(options).create()) so width/height
are applied for both headless and headed runs.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4fc5e637-9562-475b-90ed-d3e9b6d302f2

📥 Commits

Reviewing files that changed from the base of the PR and between 8cc998c and 008d44e.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .gitignore
  • practice/tasks.txt
  • src/main/java/cz/czechitas/automation/WebDriverProvider.java

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

⚠️ Branch updated during autofix.

The branch was updated while autofix was in progress. Please try again.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found.

@brumlablo brumlablo merged commit 339e03d into main Apr 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant