accessibility

This commit is contained in:
Josh at WLTechBlog
2025-08-29 12:11:54 -05:00
parent 6bad614f9e
commit 7f4d8b8e84
12 changed files with 2708 additions and 1577 deletions

View File

@@ -262,22 +262,18 @@ cremote close-tab --tab="$TAB1"
Many commands support timeout parameters for robust testing:
```bash
# Wait up to 10 seconds for element to appear, then 5 seconds for action
cremote fill-form --selector="#slow-loading-field" --value="test" \
--selection-timeout=10 --action-timeout=5
# Wait up to 10 seconds for operation to complete
cremote fill-form --selector="#slow-loading-field" --value="test" --timeout=10
# Wait for elements that load dynamically
cremote click-element --selector=".ajax-button" \
--selection-timeout=15 --action-timeout=10
cremote click-element --selector=".ajax-button" --timeout=15
# Get elements that may take time to render
cremote get-element --selector=".dynamic-content" --selection-timeout=20
cremote get-element --selector=".dynamic-content" --timeout=20
```
**Timeout Parameters:**
- `--selection-timeout`: Seconds to wait for element to appear in DOM (default: 5 seconds)
- `--action-timeout`: Seconds to wait for action to complete (default: 5 seconds)
- `--timeout`: General timeout for operations (default: 5 seconds)
**Timeout Parameter:**
- `--timeout`: Seconds to wait for operation to complete (default: 5 seconds)
**Smart Navigation Waiting:**
The `wait-navigation` command intelligently detects if navigation is actually happening:
@@ -328,7 +324,7 @@ cremote load-url --url="https://myapp.com/register"
cremote click-element --selector="#submit-btn"
# Check for validation errors
ERROR_MSG=$(cremote get-element --selector=".error-message" --selection-timeout=5)
ERROR_MSG=$(cremote get-element --selector=".error-message" --timeout=5)
if [ -n "$ERROR_MSG" ]; then
echo "✓ Validation working: $ERROR_MSG"
else
@@ -340,7 +336,7 @@ cremote fill-form --selector="#email" --value="invalid-email"
cremote click-element --selector="#submit-btn"
# Verify email validation
EMAIL_ERROR=$(cremote get-element --selector="#email-error" --selection-timeout=5)
EMAIL_ERROR=$(cremote get-element --selector="#email-error" --timeout=5)
if echo "$EMAIL_ERROR" | grep -q "valid email"; then
echo "✓ Email validation working"
fi
@@ -408,7 +404,7 @@ echo "Error handling: $ERROR_RESPONSE"
# Test file upload limits
cremote upload-file --selector="#file-upload" --file="/path/to/large-file.zip"
UPLOAD_ERROR=$(cremote get-element --selector=".upload-error" --selection-timeout=10)
UPLOAD_ERROR=$(cremote get-element --selector=".upload-error" --timeout=10)
# Test iframe interaction (e.g., payment form)
cremote switch-iframe --selector="iframe.payment-widget"
@@ -417,12 +413,12 @@ cremote fill-form --selector="#expiry" --value="12/25"
cremote click-element --selector="#pay-now"
# Check for payment processing within iframe
PAYMENT_STATUS=$(cremote get-element --selector=".payment-status" --selection-timeout=10)
PAYMENT_STATUS=$(cremote get-element --selector=".payment-status" --timeout=10)
echo "Payment status: $PAYMENT_STATUS"
# Switch back to main page to check results
cremote switch-main
MAIN_STATUS=$(cremote get-element --selector=".order-confirmation" --selection-timeout=10)
MAIN_STATUS=$(cremote get-element --selector=".order-confirmation" --timeout=10)
```
## Testing Best Practices
@@ -448,10 +444,10 @@ Always use appropriate timeouts for dynamic content:
```bash
# Wait for AJAX content to load
cremote get-element --selector=".search-results" --selection-timeout=15
cremote get-element --selector=".search-results" --timeout=15
# Wait for form submission to complete
cremote submit-form --selector="#payment-form" --action-timeout=30
cremote submit-form --selector="#payment-form" --timeout=30
cremote wait-navigation --timeout=20
```
@@ -470,7 +466,7 @@ fi
# After form submission, check for success message
cremote submit-form --selector="#contact-form"
SUCCESS_MSG=$(cremote get-element --selector=".success-message" --selection-timeout=10)
SUCCESS_MSG=$(cremote get-element --selector=".success-message" --timeout=10)
if echo "$SUCCESS_MSG" | grep -q "Thank you"; then
echo "✓ Form submitted successfully"
fi
@@ -501,7 +497,7 @@ cremote fill-form --selector="#card-number" --value="4111111111111111"
cremote switch-main # Always switch back
# Good - verify iframe exists before switching
IFRAME_EXISTS=$(cremote get-element --selector="iframe.payment-form" --selection-timeout=5)
IFRAME_EXISTS=$(cremote get-element --selector="iframe.payment-form" --timeout=5)
if [ -n "$IFRAME_EXISTS" ]; then
cremote switch-iframe --selector="iframe.payment-form"
# ... iframe operations ...
@@ -534,7 +530,7 @@ cremote list-tabs
```bash
# Test if element exists before interacting
ELEMENT=$(cremote get-element --selector="#target-button" --selection-timeout=5)
ELEMENT=$(cremote get-element --selector="#target-button" --timeout=5)
if [ -n "$ELEMENT" ]; then
cremote click-element --selector="#target-button"
else
@@ -546,8 +542,7 @@ fi
```bash
# For slow-loading applications
cremote fill-form --selector="#username" --value="test" \
--selection-timeout=30 --action-timeout=15
cremote fill-form --selector="#username" --value="test" --timeout=30
cremote wait-navigation --timeout=60
```