Appetize Docs
HomeDemoUploadPricing
  • Introduction
  • Platform
    • App Management
      • Uploading Apps
        • Android
        • iOS
      • App Dashboard
      • Running Apps
      • App Permissions
    • Device Sandbox
    • Embedding
    • Sharing
    • Session Inactivity Timeout
    • Query Params Reference
  • Features
    • Devices & OS Versions
    • Network Traffic Monitor
    • Debug Logs
    • UI Automation
    • Proxy
    • Language & Locale
    • Mock Location
    • Deep links
    • Launch Params
    • Media
    • Auto-grant Permissions
    • Custom Branding
    • Custom Launch Pages
    • Advanced Features
      • Android
        • ADB tunnel
        • Hide Password Visibility
      • Reserved Devices
  • Account
    • Invite your team
    • Single Sign-On
      • OpenID Connect
      • SAML
      • Azure Active Directory
      • Google Workspace (GSuite)
    • Reporting
      • Session History
      • Usage Summary
  • Infrastructure
    • Configure Network Access
    • Enterprise Hosting Options
  • JavaScript SDK
    • Configuration
    • Automation
      • Device commands
      • Touch interactions
    • API reference
      • Initialization
      • Client
      • Session
      • Types
        • AdbConnectionInfo
        • AppetizeApp
        • AndroidElementAttributes
        • Coordinates
        • DeviceInfo
        • Element
        • ElementBounds
        • IOSAccessibilityElement
        • IOSElementAttributes
        • NetworkRequest
        • NetworkResponse
        • SessionConfig
        • SwipeMove
        • RecordedAction
        • RecordedSwipeAction
        • RecordedKeypressAction
        • RecordedPosition
        • RecordedTapAction
        • RecordedTouchAction
        • UserInteraction
  • Testing
    • Getting Started
    • Writing Tests
    • Running Tests
    • Test Configuration
    • Continuous Integration
    • Record Tests (experimental)
    • Trace Viewer
    • Web Tests on Mobile Browsers
  • REST API
    • Create new app
    • Update existing app
    • Direct file uploads
    • Delete app
    • List apps
    • Usage summary
    • Devices & OS Versions
      • v1
    • IP Blocks
      • v1
  • Guides & Samples
    • Impersonation
    • Automate Sign-in Flow
    • Screenshot Automation
    • Unlock Device
    • Validate Analytics Events
    • Lock Your Device to One App
    • Test Accessibility Font Sizes
    • Common testing scenarios
    • Samples Repository
  • Deprecated
    • Cross-document messages
  • Changelog
  • Additional Support
    • Knowledge Base
    • Support Request
Powered by GitBook
On this page
  • Changing configuration
  • Getting configuration
  • Projects
  • Examples
  • During tests
  1. Testing

Test Configuration

Run your tests against multiple device configurations

PreviousRunning TestsNextContinuous Integration

Last updated 11 months ago

Changing configuration

You can change the configuration for a test suite with test.use. Note that config changes will start a new session when used within a test.describe.

See for more details on test.use.

import { test, expect } from '@appetize/playwright'

test.use({
  config: {
    publicKey: '<buildId|publicKey>'
    device: 'nexus5'
  },
});

test('app works on nexus5', async ({ session }) => {
  ...
})

Getting configuration

The current configuration can be accessed with the config argument in the test

test('my test', async ({ session, config }) => {
   if (config.osVersion === '7.0') {
      // do os 7.0 specific behaviour
   } else {
      
   }
})

You can also use this to skip tests

test.describe('iOS 16 features', () => {
    // skip suite if osVersion is less than 16
    test.skip(({ config }) => parseInt(config.osVersion) < 16);
    
    test('some feature', async ({ session }) => { ... })
})

Projects

Below are some examples that may fit your use case.

Examples

Test Android and iOS apps

Runs tests under tests/ios for the iOS configuration, and tests/android for the Android configuration

const config = {
    // ... 
    
    projects: [
        {
            name: 'ios',
            testDir: './tests/ios',
            use: {
                config: {
                    device: 'iphone14pro',
                    publicKey: '<IOS APP BUILD ID (PUBLIC KEY)>'
                }
            },
        },
        {
            name: 'android',
            testDir: './tests/android',
            use: {
                config: {
                    device: 'pixel6',
                    publicKey: '<ANDROID APP BUILD ID (PUBLIC KEY)>'
                }
            },
        }      
    ]
} 
   

Test iOS app against multiple iOS Versions

Runs the test suite against iOS 16 and iOS 15

const config = {
    // ... 
    
    use: {
        config: {
            publicKey: '<BUILD ID (PUBLIC KEY)>'
        }
    },
    projects: [
        {
            name: 'ios-16',
            use: {
                config: {
                    device: 'iphone14pro',
                    osVersion: '16',
                }
            },
        },
        {
            name: 'ios-15',
            use: {
                config: {
                    device: 'iphone14pro',
                    osVersion: '15'
                }
            },
        }
    ]
} 
   

Test Android against multiple devices

Runs the test suite against a Pixel 7 and a Pixel 6

const config = {
    // ... 
    
    use: {
        config: {
            publicKey: '<BUILD ID (PUBLIC KEY)>'
        }
    },
    projects: [
        {
            name: 'pixel7',
            use: {
                config: {
                    device: 'pixel7'
                }
            },
        },
        {
            name: 'pixel6',
            use: {
                config: {
                    device: 'pixel6'
                }
            },
        }
    ]
}

During tests

You can reference the current project configuration in your tests. This is useful if you need to change or skip a test based on a certain device

allow you to run your entire test suite with different configurations. This is useful if you have a cross platform app or wish to test against a set of devices and/or osVersions.

Playwright documentation
Projects