Writing Tests
Your first test
import { test, expect } from '@appetize/playwright'
test.setup({
publicKey: '<PUBLIC KEY>',
// ... other config
// see https://docs.appetize.io/javascript-sdk/configuration
})
// reinstall app after each test to reset data
test.afterEach(async ({ session }) => {
await session.reinstallApp()
})
test('logs in to the app', async ({ session }) => {
// type username
await session.tap({ element: { accessibilityIdentifier: 'username_field' } })
await session.type({ value: 'jordan' })
// type password
await session.tap({ element: { accessibilityIdentifier: 'password_field' } })
await session.type({ value: 'secretpassword' })
// tap login button
await session.tap({ element: { text: 'Login' } })
// wait for an element with 'Hello Jordan' to exist on the screen
await expect(session).toHaveElement({ text: 'Hello Jordan' })
})Setup
Actions
Sequencing actions
Assertions
expect
toHaveElement
Screenshot comparisons
Network
Helpers
waitForElement
waitForEvent
waitForTimeout
Last updated