Skip to content

dbspt/newMobileaf-ult-test

Repository files navigation

Mobile Automation Framework

Automação E2E mobile utilizando:

WebdriverIO

Appium

Cucumber (BDD)

TypeScript

Allure Report

🧰 Requisitos

Node.js v22.22.1

Java JDK 11+

Android SDK

ADB configurado no PATH

Dispositivo físico ou emulador Android

Appium 2.x

Verificar versões:

node -v npm -v adb devices 🚀 1. Criação do Projeto mkdir mobile-automation cd mobile-automation npm init -y 🚀 2. Instalar WebdriverIO (E2E + Mobile + Cucumber)

Execute o wizard:

npm init wdio@latest .

Selecione:

✔ E2E Testing ✔ Mobile Testing ✔ On my local machine ✔ Android ✔ Cucumber ✔ TypeScript ✔ Spec Reporter

Isso irá instalar automaticamente:

@wdio/cli

@wdio/local-runner

@wdio/cucumber-framework

@wdio/spec-reporter

@wdio/appium-service

typescript

ts-node

🚀 3. Instalar Appium

Globalmente:

npm install -g appium

Instalar driver Android:

appium driver install uiautomator2

Verificar instalação:

appium driver list --installed 🚀 4. Instalar Allure npm install --save-dev @wdio/allure-reporter allure-commandline 📂 Estrutura de Pastas Recomendada mobile-automation │ ├── features/ │ └── poc.feature │ ├── step-definitions/ │ └── poc.steps.ts │ ├── pageobjects/ │ └── login.page.ts │ ├── reports/ │ ├── allure-results/ ├── allure-report/ │ ├── wdio.conf.ts ├── tsconfig.json ├── package.json ⚙️ Configuração do TypeScript tsconfig.json { "compilerOptions": { "target": "ES2020", "module": "commonjs", "strict": true, "esModuleInterop": true, "types": [ "node", "@wdio/globals/types", "@wdio/cucumber-framework" ] } } ⚙️ Configuração do wdio.conf.ts import { execSync } from 'child_process' import type { Options } from '@wdio/types'

export const config: Options.Testrunner = {

runner: 'local',

specs: [
    './features/**/*.feature'
],

framework: 'cucumber',

reporters: [
    'spec',
    ['allure', {
        outputDir: './allure-results',
        disableWebdriverStepsReporting: true,
        disableWebdriverScreenshotsReporting: false
    }]
],

services: ['appium'],

capabilities: [{
    platformName: 'Android',
    'appium:automationName': 'UiAutomator2',
    'appium:deviceName': 'ANDROID_DEVICE_NAME',
    'appium:appPackage': 'com.seu.app',
    'appium:appActivity': 'com.seu.app.MainActivity',
    'appium:noReset': true
}],

cucumberOpts: {
    require: ['./step-definitions/**/*.ts'],
    timeout: 60000
},

onComplete: function () {

    console.log('Gerando relatório Allure...')

    try {
        execSync(
            'npx allure generate allure-results --clean -o allure-report',
            { stdio: 'inherit' }
        )
        console.log('Relatório gerado em ./allure-report/index.html')
    } catch (error) {
        console.error('Erro ao gerar relatório Allure')
    }

}

} 🧪 Executar Testes

Executar todos:

npx wdio run ./wdio.conf.ts

Executar feature específica:

npx wdio run ./wdio.conf.ts --spec ./features/poc.feature

About

automacao mobile

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors