const assert = require('node:assert/strict'); const { remote } = require('webdriverio'); const capabilities = { platformName: 'Android', 'appium:automationName': 'UiAutomator2', 'appium:deviceName': 'Android', 'appium:appPackage': 'com.android.settings', 'appium:appActivity': '.Settings', }; describe('Android Settings Appium smoke test', function () { let driver; afterEach(async function () { if (driver) { await driver.deleteSession(); driver = undefined; } }); it('opens Battery settings', async function () { driver = await remote({ hostname: process.env.APPIUM_HOST || '127.0.0.1', port: Number(process.env.APPIUM_PORT || 4723), path: process.env.APPIUM_PATH || '/', logLevel: 'error', capabilities, }); const battery = await driver.$('//*[@text="Battery"]'); await battery.click(); const title = await driver.$('//*[@text="Battery"]'); assert.equal(await title.getText(), 'Battery'); }); });