Task 1 - Add Product to Cart#271
Task 1 - Add Product to Cart#271Eugeniya1981 wants to merge 5 commits intovividus-framework:mainfrom
Conversation
📝 WalkthroughWalkthroughUpdates VIVIDUS web test skill documentation to enforce story-only output with stricter validation rules. Bumps VIVIDUS BOM to 0.6.18-SNAPSHOT. Adds web-sauce configuration profile, environment properties for UI timeouts, and new web app test stories covering login and cart operations while removing legacy test scenario. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/skills/generate-vividus-web-tests/SKILL.md (1)
144-323: 🧹 Nitpick | 🔵 TrivialConsider running
spotlessApplyto fix markdown formatting.Static analysis detected several markdown formatting issues (missing blank lines around fenced code blocks, headings, and tables). As documented in lines 320-323, these can be auto-fixed by running:
gradlew.bat spotlessApply🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/skills/generate-vividus-web-tests/SKILL.md around lines 144 - 323, The markdown in the "Fix Formatting Violations" / Step 5 sections has missing blank lines around fenced code blocks, headings and tables; run the formatter by executing the Gradle task (gradlew.bat spotlessApply) as suggested, re-open and verify the fenced blocks and headings are separated by blank lines (the sections referencing the spotlessApply command and code fences), then commit the resulting SKILL.md changes so the markdown formatting issues are auto-fixed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@build.gradle`:
- Line 9: Replace the snapshot dependency string
"org.vividus:vividus-bom:0.6.18-SNAPSHOT" with the stable release
"org.vividus:vividus-bom:0.6.17" in the implementation platform declaration, or
if the SNAPSHOT is intentional, add an inline comment next to the implementation
platform('org.vividus:vividus-bom:0.6.18-SNAPSHOT') entry explaining why the
pre-release is required for this sample (e.g., to demonstrate an unreleased
feature), so readers know the choice is deliberate.
In `@src/main/resources/story/web_app/Add` Bolt T-Shirt to Cart.story:
- Line 12: The two stories use inconsistent locators for the shopping cart
badge: in Add Product to Cart.story the element name 'shopping_cart_badge' is
used, while Add Bolt T-Shirt to Cart.story uses
cssSelector([data-test="shopping-cart-badge"]); update Add Bolt T-Shirt to
Cart.story to use the same locator strategy as the other story (preferably
replace cssSelector([data-test="shopping-cart-badge"]) with the element name
'shopping_cart_badge') so both stories reference the identical symbol and
locator approach for the shopping cart badge.
In `@src/main/resources/story/web_app/Add` Product to Cart.story:
- Around line 15-16: After the wait-for-element step that uses
id(back-to-products) and the text assertion for "Sauce Labs Bolt T-Shirt", add a
URL verification step to enforce the required navigation check; specifically,
after the When I wait until element located by `id(back-to-products)` appears
and/or after the Then text `Sauce Labs Bolt T-Shirt` exists, insert a step using
Then `<current-page-url>` matches `<regex>` (choose the regex that matches the
product details page URL pattern for this product) so the flow includes both the
element sync and a page-unique URL assertion.
- Line 22: The step "When I wait until element located by `id(remove)` appears"
should be changed to an assertion step because the "remove" element is a
same-page state change after clicking the "add-to-cart" control; replace the
wait with an assertion such as using a Then step that checks visibility/presence
of the element located by id(remove) (refer to the "add-to-cart" click step and
the element id(remove) in the story) so the test verifies state rather than
performing an explicit wait.
- Line 31: After the step that waits for the page element
caseInsensitiveText(Your Cart) to appear, add a URL assertion step to verify
navigation to the cart page; specifically insert a step using the
current-page-url matcher (Then `${current-page-url}` matches `<regex>`)
immediately after the wait step and use a regex that matches your cart route
(eg. /cart or /checkout/cart as appropriate) so the story both syncs on a unique
element and validates the URL.
- Around line 7-30: Remove the eight prohibited step-descriptive comments that
start with "!-- Step" (e.g., "!-- Step 1: Log in", "!-- Step 2: Open details
page for Bolt T-Shirt", etc.) and leave the executable steps intact (the
When/Then lines such as the login step "When I login to web app...", the
waits/clicks using selectors like
`cssSelector([data-test="item-1-title-link"])`, `id(back-to-products)`,
`id(add-to-cart)`, `id(remove)`, and the cart verification `Then an element with
the name 'shopping_cart_badge' and text '1' exists`); do not remove or alter any
allowed `!--` comments that are `[MISSING STEP]`, `[ASSUMPTION]`, or
`[DISCREPANCY]` markers—only delete the "Step X" descriptive comment lines.
---
Outside diff comments:
In @.github/skills/generate-vividus-web-tests/SKILL.md:
- Around line 144-323: The markdown in the "Fix Formatting Violations" / Step 5
sections has missing blank lines around fenced code blocks, headings and tables;
run the formatter by executing the Gradle task (gradlew.bat spotlessApply) as
suggested, re-open and verify the fenced blocks and headings are separated by
blank lines (the sections referencing the spotlessApply command and code
fences), then commit the resulting SKILL.md changes so the markdown formatting
issues are auto-fixed.
🪄 Autofix (Beta)
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: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 01ee930d-ac28-4e52-8ddb-c758ee6dbb12
📒 Files selected for processing (11)
.github/skills/generate-vividus-web-tests/SKILL.mdbuild.gradlesrc/main/resources/properties/configuration.propertiessrc/main/resources/properties/environment/environment.propertiessrc/main/resources/properties/environment/sauce/environment.propertiessrc/main/resources/properties/profile/web/headless/chrome/1920x1080/profile.propertiessrc/main/resources/steps/web/login.stepssrc/main/resources/story/web_app/Add Bolt T-Shirt to Cart.storysrc/main/resources/story/web_app/Add Product to Cart.storysrc/main/resources/story/web_app/Login & Logout.storysrc/main/resources/story/web_app/Web application.story
💤 Files with no reviewable changes (1)
- src/main/resources/story/web_app/Web application.story
|
|
||
| dependencies { | ||
| implementation platform('org.vividus:vividus-bom:0.6.17') | ||
| implementation platform('org.vividus:vividus-bom:0.6.18-SNAPSHOT') |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check if VIVIDUS 0.6.18-SNAPSHOT is published and verify available stable versions
echo "Checking Maven Central for VIVIDUS BOM versions..."
curl -s "https://search.maven.org/solrsearch/select?q=g:org.vividus+AND+a:vividus-bom&rows=20&wt=json" | jq -r '.response.docs[] | .v' | head -10
echo -e "\nChecking if 0.6.18-SNAPSHOT might be available in snapshot repository..."
curl -s "https://oss.sonatype.org/content/repositories/snapshots/org/vividus/vividus-bom/" | grep -o '0\.6\.[0-9]*-SNAPSHOT' | sort -u | tail -5Repository: vividus-framework/vividus-sample-tests
Length of output: 207
🏁 Script executed:
cat -n build.gradleRepository: vividus-framework/vividus-sample-tests
Length of output: 934
🌐 Web query:
VIVIDUS BOM version 0.6.18 stable release available
💡 Result:
No, there is no stable release of VIVIDUS BOM version 0.6.18 available as of 2026-04-24. The official VIVIDUS GitHub releases page lists the latest stable release as 0.6.17 (2026-03-20). A 0.6.18-SNAPSHOT version exists for various packages (e.g., vividus-util, vividus-plugin-web-app, vividus-to-xray-exporter), published on GitHub Packages around March 23, 2026, indicating ongoing development toward a future stable 0.6.18 release. Official documentation references 0.6.16-SNAPSHOT in examples, and no Maven repository or release notes confirm a stable 0.6.18 BOM.
Citations:
- 1: https://github.com/vividus-framework/vividus/releases
- 2: https://github.com/vividus-framework/vividus/packages/875005?version=0.6.18-SNAPSHOT
- 3: https://docs.vividus.dev/vividus/latest/configuration/plugin-management.html
- 4: https://github.com/vividus-framework/vividus/packages/875004
- 5: https://github.com/vividus-framework/vividus
🏁 Script executed:
#!/bin/bash
# Try alternative methods to check VIVIDUS versions
echo "Attempting to fetch Maven metadata directly..."
# Try Maven Central metadata
echo "=== Maven Central Metadata ==="
curl -s "https://repo1.maven.org/maven2/org/vividus/vividus-bom/maven-metadata.xml" | grep -oP '(?<=<version>)[^<]+' | tail -10
echo -e "\n=== Snapshot Repository Metadata ==="
# Try snapshot repository
curl -s "https://oss.sonatype.org/content/repositories/snapshots/org/vividus/vividus-bom/maven-metadata.xml" | grep -oP '(?<=<version>)[^<]+' | tail -10Repository: vividus-framework/vividus-sample-tests
Length of output: 198
Consider using stable release version 0.6.17 instead of snapshot for sample code.
The dependency currently uses 0.6.18-SNAPSHOT, which is a pre-release version under active development. While the latest stable release 0.6.17 was published recently (March 2026) and is available, sample projects are typically better served by stable versions unless demonstrating unreleased features.
If the snapshot is intentionally chosen to showcase upcoming features, add a comment explaining the reason.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@build.gradle` at line 9, Replace the snapshot dependency string
"org.vividus:vividus-bom:0.6.18-SNAPSHOT" with the stable release
"org.vividus:vividus-bom:0.6.17" in the implementation platform declaration, or
if the SNAPSHOT is intentional, add an inline comment next to the implementation
platform('org.vividus:vividus-bom:0.6.18-SNAPSHOT') entry explaining why the
pre-release is required for this sample (e.g., to demonstrate an unreleased
feature), so readers know the choice is deliberate.
| Then `${current-page-url}` matches `.+/inventory-item\.html\?id=1` | ||
| When I click on element located by `id(add-to-cart)` | ||
| Then number of elements found by `id(remove)` is equal to `1` | ||
| When I save text of element located by `cssSelector([data-test="shopping-cart-badge"])` to scenario variable `cartBadgeText` |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Find all references to shopping cart badge across story files
echo "=== Searching for shopping cart badge references in story files ==="
rg -n -C2 "shopping.*cart.*badge" --type-add 'story:*.story' --type story src/main/resources/story/
echo -e "\n=== Checking for element registry definitions ==="
fd -e xml -e properties . src/main/resources/ --exec rg -l "shopping.*cart.*badge" {}Repository: vividus-framework/vividus-sample-tests
Length of output: 1346
Standardize shopping cart badge locator strategy across stories.
Two story files reference the shopping cart badge element using different locator strategies:
Add Product to Cart.story(line 25): Uses element name'shopping_cart_badge'Add Bolt T-Shirt to Cart.story(line 12): UsescssSelector([data-test="shopping-cart-badge"])
Inconsistent locators reduce maintainability and can cause issues if locators change. Choose one consistent approach:
- Use element names throughout (preferred for maintainability), or
- Use the same cssSelector pattern in both stories.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/main/resources/story/web_app/Add` Bolt T-Shirt to Cart.story at line 12,
The two stories use inconsistent locators for the shopping cart badge: in Add
Product to Cart.story the element name 'shopping_cart_badge' is used, while Add
Bolt T-Shirt to Cart.story uses cssSelector([data-test="shopping-cart-badge"]);
update Add Bolt T-Shirt to Cart.story to use the same locator strategy as the
other story (preferably replace cssSelector([data-test="shopping-cart-badge"])
with the element name 'shopping_cart_badge') so both stories reference the
identical symbol and locator approach for the shopping cart badge.
| !-- Step 1: Log in | ||
| When I login to web app with username `${username}` and password `${password}` | ||
|
|
||
| !-- Step 2: Open details page for Bolt T-Shirt | ||
| When I wait until element located by `cssSelector([data-test="item-1-title-link"])` appears | ||
| When I click on element located by `cssSelector([data-test="item-1-title-link"])` | ||
|
|
||
| !-- Step 3: Verify details page is displayed | ||
| When I wait until element located by `id(back-to-products)` appears | ||
| Then text `Sauce Labs Bolt T-Shirt` exists | ||
|
|
||
| !-- Step 4: Click Add to cart | ||
| When I click on element located by `id(add-to-cart)` | ||
|
|
||
| !-- Step 5: Verify button changes to Remove | ||
| When I wait until element located by `id(remove)` appears | ||
|
|
||
| !-- Step 6: Verify cart badge shows 1 | ||
| Then an element with the name 'shopping_cart_badge' and text '1' exists | ||
|
|
||
| !-- Step 7: Open cart | ||
| When I click on element located by `cssSelector([data-test="shopping-cart-link"])` | ||
|
|
||
| !-- Step 8: Verify Bolt T-Shirt is present in cart |
There was a problem hiding this comment.
Remove step-by-step descriptive comments.
The story contains eight sequential comments (!-- Step 1:, !-- Step 2:, etc.) that describe what each step does. These violate the project's coding guidelines. As per coding guidelines: "Do NOT add !-- comments before each step describing what it does (e.g., !-- Step 1: Log in). Only use !-- comments for [MISSING STEP], [ASSUMPTION], or [DISCREPANCY] markers."
🧹 Proposed fix to remove prohibited comments
Scenario: Add Bolt T-Shirt to cart and verify it appears in cart
-!-- Step 1: Log in
When I login to web app with username `${username}` and password `${password}`
-!-- Step 2: Open details page for Bolt T-Shirt
When I wait until element located by `cssSelector([data-test="item-1-title-link"])` appears
When I click on element located by `cssSelector([data-test="item-1-title-link"])`
-!-- Step 3: Verify details page is displayed
When I wait until element located by `id(back-to-products)` appears
Then text `Sauce Labs Bolt T-Shirt` exists
-!-- Step 4: Click Add to cart
When I click on element located by `id(add-to-cart)`
-!-- Step 5: Verify button changes to Remove
When I wait until element located by `id(remove)` appears
-!-- Step 6: Verify cart badge shows 1
Then an element with the name 'shopping_cart_badge' and text '1' exists
-!-- Step 7: Open cart
When I click on element located by `cssSelector([data-test="shopping-cart-link"])`
-!-- Step 8: Verify Bolt T-Shirt is present in cart
When I wait until element located by `caseInsensitiveText(Your Cart)` appears
Then text `Sauce Labs Bolt T-Shirt` exists📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| !-- Step 1: Log in | |
| When I login to web app with username `${username}` and password `${password}` | |
| !-- Step 2: Open details page for Bolt T-Shirt | |
| When I wait until element located by `cssSelector([data-test="item-1-title-link"])` appears | |
| When I click on element located by `cssSelector([data-test="item-1-title-link"])` | |
| !-- Step 3: Verify details page is displayed | |
| When I wait until element located by `id(back-to-products)` appears | |
| Then text `Sauce Labs Bolt T-Shirt` exists | |
| !-- Step 4: Click Add to cart | |
| When I click on element located by `id(add-to-cart)` | |
| !-- Step 5: Verify button changes to Remove | |
| When I wait until element located by `id(remove)` appears | |
| !-- Step 6: Verify cart badge shows 1 | |
| Then an element with the name 'shopping_cart_badge' and text '1' exists | |
| !-- Step 7: Open cart | |
| When I click on element located by `cssSelector([data-test="shopping-cart-link"])` | |
| !-- Step 8: Verify Bolt T-Shirt is present in cart | |
| Scenario: Add Bolt T-Shirt to cart and verify it appears in cart | |
| When I login to web app with username `${username}` and password `${password}` | |
| When I wait until element located by `cssSelector([data-test="item-1-title-link"])` appears | |
| When I click on element located by `cssSelector([data-test="item-1-title-link"])` | |
| When I wait until element located by `id(back-to-products)` appears | |
| Then text `Sauce Labs Bolt T-Shirt` exists | |
| When I click on element located by `id(add-to-cart)` | |
| When I wait until element located by `id(remove)` appears | |
| Then an element with the name 'shopping_cart_badge' and text '1' exists | |
| When I click on element located by `cssSelector([data-test="shopping-cart-link"])` | |
| When I wait until element located by `caseInsensitiveText(Your Cart)` appears | |
| Then text `Sauce Labs Bolt T-Shirt` exists |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/main/resources/story/web_app/Add` Product to Cart.story around lines 7 -
30, Remove the eight prohibited step-descriptive comments that start with "!--
Step" (e.g., "!-- Step 1: Log in", "!-- Step 2: Open details page for Bolt
T-Shirt", etc.) and leave the executable steps intact (the When/Then lines such
as the login step "When I login to web app...", the waits/clicks using selectors
like `cssSelector([data-test="item-1-title-link"])`, `id(back-to-products)`,
`id(add-to-cart)`, `id(remove)`, and the cart verification `Then an element with
the name 'shopping_cart_badge' and text '1' exists`); do not remove or alter any
allowed `!--` comments that are `[MISSING STEP]`, `[ASSUMPTION]`, or
`[DISCREPANCY]` markers—only delete the "Step X" descriptive comment lines.
| When I wait until element located by `id(back-to-products)` appears | ||
| Then text `Sauce Labs Bolt T-Shirt` exists |
There was a problem hiding this comment.
Add mandatory URL verification after navigation.
After navigating to the product details page, the code waits for an element but does not verify the URL. As per coding guidelines: "After navigating to a new page, synchronize using When I wait until element located by \` appearsfollowed by a URL check withThen `${current-page-url}` matches ```."
🔗 Proposed fix to add URL verification
When I wait until element located by `id(back-to-products)` appears
+Then `${current-page-url}` matches `.+/inventory-item\.html\?id=1`
Then text `Sauce Labs Bolt T-Shirt` exists🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/main/resources/story/web_app/Add` Product to Cart.story around lines 15 -
16, After the wait-for-element step that uses id(back-to-products) and the text
assertion for "Sauce Labs Bolt T-Shirt", add a URL verification step to enforce
the required navigation check; specifically, after the When I wait until element
located by `id(back-to-products)` appears and/or after the Then text `Sauce Labs
Bolt T-Shirt` exists, insert a step using Then `<current-page-url>` matches
`<regex>` (choose the regex that matches the product details page URL pattern
for this product) so the flow includes both the element sync and a page-unique
URL assertion.
| When I click on element located by `id(add-to-cart)` | ||
|
|
||
| !-- Step 5: Verify button changes to Remove | ||
| When I wait until element located by `id(remove)` appears |
There was a problem hiding this comment.
Replace wait with assertion for same-page verification.
After clicking the "add-to-cart" button, the code waits for the "remove" element to appear. Since this is a state change on the same page (not a navigation), a Then assertion should be used instead of When I wait. As per coding guidelines: "wait used as verification on an already-loaded page (use assertion instead)".
✅ Proposed fix to use assertion instead of wait
When I click on element located by `id(add-to-cart)`
-When I wait until element located by `id(remove)` appears
+Then number of elements found by `id(remove)` is equal to `1`
Then an element with the name 'shopping_cart_badge' and text '1' exists📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| When I wait until element located by `id(remove)` appears | |
| Then number of elements found by `id(remove)` is equal to `1` |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/main/resources/story/web_app/Add` Product to Cart.story at line 22, The
step "When I wait until element located by `id(remove)` appears" should be
changed to an assertion step because the "remove" element is a same-page state
change after clicking the "add-to-cart" control; replace the wait with an
assertion such as using a Then step that checks visibility/presence of the
element located by id(remove) (refer to the "add-to-cart" click step and the
element id(remove) in the story) so the test verifies state rather than
performing an explicit wait.
| When I click on element located by `cssSelector([data-test="shopping-cart-link"])` | ||
|
|
||
| !-- Step 8: Verify Bolt T-Shirt is present in cart | ||
| When I wait until element located by `caseInsensitiveText(Your Cart)` appears |
There was a problem hiding this comment.
Add mandatory URL verification after navigation to cart.
After clicking the shopping cart link, the code waits for a page element but does not verify the URL. As per coding guidelines: "After navigating to a new page, synchronize using When I wait until element located by \` appearsfollowed by a URL check withThen `${current-page-url}` matches ```."
🔗 Proposed fix to add URL verification
When I wait until element located by `caseInsensitiveText(Your Cart)` appears
+Then `${current-page-url}` matches `.+/cart\.html`
Then text `Sauce Labs Bolt T-Shirt` exists📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| When I wait until element located by `caseInsensitiveText(Your Cart)` appears | |
| When I wait until element located by `caseInsensitiveText(Your Cart)` appears | |
| Then `${current-page-url}` matches `.+/cart\.html` | |
| Then text `Sauce Labs Bolt T-Shirt` exists |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/main/resources/story/web_app/Add` Product to Cart.story at line 31, After
the step that waits for the page element caseInsensitiveText(Your Cart) to
appear, add a URL assertion step to verify navigation to the cart page;
specifically insert a step using the current-page-url matcher (Then
`${current-page-url}` matches `<regex>`) immediately after the wait step and use
a regex that matches your cart route (eg. /cart or /checkout/cart as
appropriate) so the story both syncs on a unique element and validates the URL.
|
a mistake |
Create a test story for the test cases below. Use credentials from "\src\main\resources\overriding.properties".
The scenario is:
Log in
Open details page for Bolt T-Shirt
Verify details page is displayed
Click Add to cart
Verify button changes to Remove
Verify cart badge shows 1
Open cart
Verify Bolt T-Shirt is present in cart
Summary by CodeRabbit
Tests
Chores