Files

206 lines
6.2 KiB
YAML

appId: ${APP_ID}
tags:
- util
---
- runScript:
file: ../../../utils/scripts/defaults.js
# ===========================================
# Swap Order Transaction (Pending State)
# ===========================================
# Tests the swap order transaction detail view for pending transactions
# Can handle both active and expired swap orders
#
# Environment variables:
# ORDER_STATUS: Expected status of the swap order - "Expired", "Execution needed", or "Pending"
# Defaults to "Execution needed" if not provided
# For expired orders, the Continue button should NOT be visible
- assertVisible: 'Confirm transaction'
# Verify swap order container is visible
# ===========================================
# Swap Header - Sell and Receive Sections
# ===========================================
# Verify sell container and amount
- assertVisible:
id: 'swap-header-sell-container'
- assertVisible: 'Sell'
- assertVisible:
id: 'swap-header-sell-amount'
text: '.*\d+.*[A-Z]{2,}.*'
# Verify receive container and amount
- assertVisible:
id: 'swap-header-receive-container'
- assertVisible: 'For at least'
- assertVisible:
id: 'swap-header-receive-amount'
text: '.*\d+.*[A-Z]{2,}.*'
# ===========================================
# Swap Order Details Section
# ===========================================
- assertVisible:
id: 'swap-order-table'
# Price row - for pending orders it should be "Limit price"
- assertVisible:
id: 'swap-order-table'
containsDescendants:
- text: '.*Limit price.*'
# Verify price format (1 TOKEN = AMOUNT TOKEN)
- assertVisible:
id: 'swap-order-table'
containsDescendants:
- text: '.*1 [A-Z]{2,} = .*\d+.*[A-Z]{2,}.*'
# Order ID row (scoped to details section)
- assertVisible:
id: 'swap-order-table'
containsDescendants:
- text: 'Order ID'
- assertVisible:
id: 'swap-order-table'
containsDescendants:
- text: '0x[0-9a-fA-F]{4}.*'
# Network row (scoped to details section)
- assertVisible:
id: 'swap-order-table'
containsDescendants:
- text: 'Network'
# Status row (scoped to details section)
# Parse ORDER_STATUS environment variable to determine expected status
- evalScript: '${output.orderStatus = (typeof ORDER_STATUS !== "undefined" && ORDER_STATUS) ? ORDER_STATUS : "Execution needed"}'
- evalScript: '${output.isExpired = output.orderStatus === "Expired"}'
- evalScript: '${output.isActive = output.orderStatus !== "Expired"}'
- assertVisible:
id: 'swap-order-table'
containsDescendants:
- text: 'Status'
# Verify status based on ORDER_STATUS
- runFlow:
when:
true: '${output.isExpired === true}'
commands:
- assertVisible:
id: 'swap-order-table'
containsDescendants:
- text: '.*Expired.*'
- runFlow:
when:
true: '${output.isActive === true}'
commands:
- assertVisible:
id: 'swap-order-table'
containsDescendants:
- text: '.*(Execution needed|Pending).*'
# Widget fee row (scoped to details section)
- extendedWaitUntil:
visible:
id: 'swap-order-table'
containsDescendants:
- text: 'Widget fee'
optional: true
timeout: ${output.defaults.extendedWaitUntilTimeout}
# Expiry row (scoped to details section)
- extendedWaitUntil:
visible:
id: 'swap-order-table'
containsDescendants:
- text: 'Expiry'
optional: true
timeout: ${output.defaults.extendedWaitUntilTimeout}
# ===========================================
# Transaction Details Button
# ===========================================
- runFlow:
file: ../../assertions/verify-tx-details.yml
# ===========================================
# Actions Section
# ===========================================
# Verify Actions section is visible (swap orders have actions)
- assertVisible:
text: 'Actions'
# Tap on Actions to view the actions list
- tapOn:
text: 'Actions'
# Test the actions list using shared component
- runFlow:
file: ../../assertions/verify-actions-list.yml
# Go back from Actions screen to Confirm transaction
- tapOn:
id: 'go-back'
# Verify we're back on Confirm transaction screen
- assertVisible: 'Confirm transaction'
# ===========================================
# SafeShield Transaction Checks
# ===========================================
- runFlow:
file: ../../assertions/verify-tx-checks.yml
env:
WIDGET_HEADER_PATTERN: '.*(Review details|Issues found|Checks passed).*'
BALANCE_CHANGE_PATTERN: 'No balance change detected'
RUN_SIMULATION: 'true'
EXPECTED_SIMULATION_RESULT: 'success'
# ===========================================
# Confirmations
# ===========================================
# Test tapping on confirmations to open the bottom sheet and verify signed badge
# For pending transactions, we use the confirmations from the confirm transaction screen
- scroll
- runFlow:
file: ../../assertions/verify-tx-confirmations.yml
env:
CONFIRMATIONS_PATTERN: '.*1/2.*'
# ===========================================
# Continue Button Verification
# ===========================================
# For expired orders, the Continue button should NOT be visible
# For active orders, we proceed to Review and Execute screen
- runFlow:
when:
true: '${output.isExpired === true}'
commands:
# Verify Continue button is NOT visible for expired orders
# Scroll to bottom to ensure we check the entire screen
- scroll
# Wait a short time to ensure any animations complete
- waitForAnimationToEnd:
timeout: 1000
# For expired orders, verify that Continue button is NOT visible
# This is the key assertion: expired orders should not allow continuation
- assertNotVisible:
text: 'Continue'
# Verify we're still on Confirm transaction screen
- assertVisible: 'Confirm transaction'
- runFlow:
when:
true: '${output.isActive === true}'
commands:
# For active orders, test navigating to Review and execute screen
- runFlow:
file: ../../assertions/verify-review-and-execute.yml
env:
EXPECTED_SIGNER_PATTERN: '.*6fED.*'
IS_FULLY_SIGNED: 'false'