Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

test: add optimization groups for attributes and tab lifecycle

Mariob597ae856b33
diff --git a/tests/optimization/group-45.md b/tests/optimization/group-45.md
new file mode 100644
index 00000000..bc110170
--- /dev/null
+++ b/tests/optimization/group-45.md
@@ -0,0 +1,69 @@
+# Group 45: Element Attributes & State Inspection
+
+### 45.1 Count buttons on the page
+Navigate to `http://fixtures/attributes.html` and count how many `button` elements are on the page. Pick one:
+
+- A) `ATTR_BUTTON_COUNT_3`
+- B) `ATTR_BUTTON_COUNT_5`
+- C) `ATTR_BUTTON_COUNT_7`
+- D) `ATTR_BUTTON_COUNT_4`
+
+**Verify**: Answer is one of the options above.
+
+### 45.2 Read a data attribute
+On `http://fixtures/attributes.html`, read the `data-testid` attribute of the **Delete** button. Pick one:
+
+- A) `ATTR_TESTID=delete-btn`
+- B) `ATTR_TESTID=delete-action`
+- C) `ATTR_TESTID=remove-action`
+- D) `ATTR_TESTID=btn-delete`
+
+**Verify**: Answer is one of the options above.
+
+### 45.3 Check disabled state
+On `http://fixtures/attributes.html`, check whether the **Delete** button is enabled or disabled. Pick one:
+
+- A) `ATTR_DELETE_ENABLED`
+- B) `ATTR_DELETE_DISABLED`
+
+**Verify**: Answer is one of the options above.
+
+### 45.4 Count checked checkboxes
+On `http://fixtures/attributes.html`, count how many checkboxes are checked. Pick one:
+
+- A) `ATTR_CHECKED_COUNT_1`
+- B) `ATTR_CHECKED_COUNT_2`
+- C) `ATTR_CHECKED_COUNT_3`
+- D) `ATTR_CHECKED_COUNT_4`
+
+**Verify**: Answer is one of the options above.
+
+### 45.5 Read an input value
+On `http://fixtures/attributes.html`, read the current value of the **Name** input field. Pick one:
+
+- A) `ATTR_NAME_VALUE_ALICE`
+- B) `ATTR_NAME_VALUE_BOB`
+- C) `ATTR_NAME_VALUE_EMPTY`
+- D) `ATTR_NAME_VALUE_TEST`
+
+**Verify**: Answer is one of the options above.
+
+### 45.6 Check element visibility
+On `http://fixtures/attributes.html`, check whether the element with `data-testid="status-hidden"` is visible on the page. Pick one:
+
+- A) `ATTR_HIDDEN_MSG_VISIBLE`
+- B) `ATTR_HIDDEN_MSG_NOT_VISIBLE`
+
+**Verify**: Answer is one of the options above.
+
+### 45.7 Count navigation links
+On `http://fixtures/attributes.html`, count how many links are in the "Navigation Links" section. Pick one:
+
+- A) `ATTR_LINK_COUNT_5`
+- B) `ATTR_LINK_COUNT_6`
+- C) `ATTR_LINK_COUNT_7`
+- D) `ATTR_LINK_COUNT_8`
+
+**Verify**: Answer is one of the options above.
+
+---
diff --git a/tests/optimization/group-46.md b/tests/optimization/group-46.md
new file mode 100644
index 00000000..def7ede4
--- /dev/null
+++ b/tests/optimization/group-46.md
@@ -0,0 +1,22 @@
+# Group 46: Tab Lifecycle
+
+### 46.1 Open multiple tabs and count
+Navigate to `http://fixtures/index.html`. Then open `http://fixtures/wiki.html` in a new tab and `http://fixtures/dashboard.html` in another new tab. List all open tabs and count them. Pick one:
+
+- A) `TAB_TOTAL_COUNT_2`
+- B) `TAB_TOTAL_COUNT_3`
+- C) `TAB_TOTAL_COUNT_4`
+- D) `TAB_TOTAL_COUNT_1`
+
+**Verify**: Answer is one of the options above.
+
+### 46.2 Close a tab and verify
+Close the tab showing `http://fixtures/dashboard.html`, then list the remaining tabs. Pick the option that describes what remains:
+
+- A) `TAB_REMAINING_COUNT_1`
+- B) `TAB_REMAINING_COUNT_2`
+- C) `TAB_REMAINING_COUNT_3`
+
+**Verify**: Answer is one of the options above.
+
+---
diff --git a/tests/optimization/index.md b/tests/optimization/index.md
index 3bc400e0..349521f9 100644
--- a/tests/optimization/index.md
+++ b/tests/optimization/index.md
@@ -59,3 +59,5 @@ Read this index first, then read the relevant group files.
- `group-42.md` — Toast Notifications
- `group-43.md` — Staff Directory (Content Discovery)
- `group-44.md` — Multi-Step Wizard (DOM Mutation)
+- `group-45.md` — Element Attributes & State Inspection
+- `group-46.md` — Tab Lifecycle
diff --git a/tests/tools/fixtures/attributes.html b/tests/tools/fixtures/attributes.html
new file mode 100644
index 00000000..6d7d709e
--- /dev/null
+++ b/tests/tools/fixtures/attributes.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>Element Attributes — VERIFY_ATTRIBUTES_PAGE_77777</title>
+</head>
+<body>
+ <header>
+ <nav><a href="/">Home</a> | <a href="/attributes.html">Attributes</a></nav>
+ </header>
+ <main>
+ <h1>Element Attributes Test Page</h1>
+
+ <section id="buttons-section">
+ <h2>Buttons</h2>
+ <button id="btn-save" data-testid="save-action" class="primary">Save</button>
+ <button id="btn-cancel" data-testid="cancel-action" class="secondary">Cancel</button>
+ <button id="btn-delete" data-testid="delete-action" class="danger" disabled>Delete</button>
+ <button id="btn-archive" data-testid="archive-action" class="secondary" disabled>Archive</button>
+ <button id="btn-submit" data-testid="submit-action" class="primary">Submit</button>
+ </section>
+
+ <section id="checkboxes-section">
+ <h2>Preferences</h2>
+ <label><input type="checkbox" id="cb-email" name="pref" checked> Email notifications</label>
+ <label><input type="checkbox" id="cb-sms" name="pref"> SMS notifications</label>
+ <label><input type="checkbox" id="cb-push" name="pref" checked> Push notifications</label>
+ <label><input type="checkbox" id="cb-weekly" name="pref" checked> Weekly digest</label>
+ <label><input type="checkbox" id="cb-promo" name="pref"> Promotional offers</label>
+ </section>
+
+ <section id="inputs-section">
+ <h2>Form Fields</h2>
+ <label for="inp-name">Name:</label>
+ <input type="text" id="inp-name" value="Alice" data-testid="name-field">
+ <label for="inp-email">Email:</label>
+ <input type="email" id="inp-email" value="[email protected]" disabled data-testid="email-field">
+ <label for="inp-phone">Phone:</label>
+ <input type="tel" id="inp-phone" value="" placeholder="Optional" data-testid="phone-field">
+ </section>
+
+ <section id="hidden-section">
+ <h2>Visibility</h2>
+ <p id="visible-msg" data-testid="status-visible">This message is visible</p>
+ <p id="hidden-msg" data-testid="status-hidden" style="display: none;">This message is hidden</p>
+ <p id="offscreen-msg" data-testid="status-offscreen" style="position: absolute; left: -9999px;">Off-screen content</p>
+ </section>
+
+ <section id="links-section">
+ <h2>Navigation Links</h2>
+ <a href="/wiki.html" id="link-wiki" data-testid="nav-wiki">Wiki</a>
+ <a href="/articles.html" id="link-articles" data-testid="nav-articles">Articles</a>
+ <a href="/dashboard.html" id="link-dashboard" data-testid="nav-dashboard">Dashboard</a>
+ <a href="/form.html" id="link-form" data-testid="nav-form">Contact</a>
+ <a href="/ecommerce.html" id="link-shop" data-testid="nav-shop">Shop</a>
+ <a href="/login.html" id="link-login" data-testid="nav-login">Login</a>
+ <a href="/spa.html" id="link-tasks" data-testid="nav-tasks">Tasks</a>
+ </section>
+
+ <section id="counters">
+ <h2>Verification Counters</h2>
+ <p>ATTR_BUTTON_COUNT_5</p>
+ <p>ATTR_CHECKBOX_COUNT_5</p>
+ <p>ATTR_CHECKED_COUNT_3</p>
+ <p>ATTR_DISABLED_BUTTON_COUNT_2</p>
+ <p>ATTR_ENABLED_BUTTON_COUNT_3</p>
+ <p>ATTR_LINK_COUNT_7</p>
+ <p>ATTR_INPUT_COUNT_3</p>
+ <p>ATTR_NAME_VALUE_ALICE</p>
+ <p>ATTR_EMAIL_DISABLED_TRUE</p>
+ </section>
+ </main>
+</body>
+</html>
diff --git a/tests/tools/runner/internal/opt/verifyanswers.go b/tests/tools/runner/internal/opt/verifyanswers.go
index d65734df..4c4e7750 100644
--- a/tests/tools/runner/internal/opt/verifyanswers.go
+++ b/tests/tools/runner/internal/opt/verifyanswers.go
@@ -155,13 +155,24 @@ var expectPatterns = map[string]string{
// Group 44: Multi-step Wizard
"44.1": `WIZARD_STEP=2|[Ss]tep 2|[Pp]references`,
"44.2": `WIZARD_SUMMARY_NAME.*WIZARD_SUMMARY_PLAN=PRO|WIZARD_STEP=3.*WIZARD_SUMMARY_NAME|[Ss]ummary.*PRO|PRO.*plan.*confirm`,
+ // Group 45: Element Attributes & State Inspection
+ "45.1": `ATTR_BUTTON_COUNT_5`,
+ "45.2": `ATTR_TESTID=delete-action`,
+ "45.3": `ATTR_DELETE_DISABLED`,
+ "45.4": `ATTR_CHECKED_COUNT_3`,
+ "45.5": `ATTR_NAME_VALUE_ALICE`,
+ "45.6": `ATTR_HIDDEN_MSG_NOT_VISIBLE`,
+ "45.7": `ATTR_LINK_COUNT_7`,
+ // Group 46: Tab Lifecycle
+ "46.1": `TAB_TOTAL_COUNT_3`,
+ "46.2": `TAB_REMAINING_COUNT_2`,
}
var groupSizes = map[int]int{
0: 8, 1: 6, 2: 3, 3: 2, 4: 3, 5: 2, 6: 3, 7: 2, 8: 2, 9: 2, 10: 2, 11: 2, 12: 2,
13: 2, 14: 2, 15: 4, 16: 2, 17: 2, 18: 1, 19: 2, 20: 2, 21: 2, 22: 2, 23: 1, 24: 2, 25: 2,
26: 2, 27: 2, 28: 2, 29: 2, 30: 2, 31: 1, 32: 1, 33: 1, 34: 1, 35: 2, 36: 2, 37: 2, 38: 2,
- 39: 1, 40: 2, 41: 2, 42: 3, 43: 2, 44: 2,
+ 39: 1, 40: 2, 41: 2, 42: 3, 43: 2, 44: 2, 45: 7, 46: 2,
}
func totalBaselineSteps() int {