<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Prudhvi D</title>
    <description>The latest articles on DEV Community by Prudhvi D (@prudhvi_d_13e7d4580e7b009).</description>
    <link>https://dev.to/prudhvi_d_13e7d4580e7b009</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2514906%2Fed581236-4b95-4df6-9ec6-ae5726e17d23.png</url>
      <title>DEV Community: Prudhvi D</title>
      <link>https://dev.to/prudhvi_d_13e7d4580e7b009</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prudhvi_d_13e7d4580e7b009"/>
    <language>en</language>
    <item>
      <title>Appium failed to start: spawn appium ENOENT</title>
      <dc:creator>Prudhvi D</dc:creator>
      <pubDate>Tue, 03 Dec 2024 03:10:34 +0000</pubDate>
      <link>https://dev.to/prudhvi_d_13e7d4580e7b009/appium-failed-to-start-spawn-appium-enoent-1aa9</link>
      <guid>https://dev.to/prudhvi_d_13e7d4580e7b009/appium-failed-to-start-spawn-appium-enoent-1aa9</guid>
      <description>&lt;p&gt;I am getting this error , can someone please help.&lt;/p&gt;

&lt;p&gt;this is my wdio.conf.js:&lt;br&gt;
const fs = require('fs');&lt;br&gt;
const path = require('path');&lt;br&gt;
const allure = require('allure-commandline');&lt;/p&gt;

&lt;p&gt;exports.config = {&lt;br&gt;
    runner: 'local',&lt;br&gt;
    hostname: '127.0.0.1', // Use manual Appium server if running separately&lt;br&gt;
    port: 4723, // Default Appium port&lt;br&gt;
    path: '/',&lt;br&gt;
    waitStartTime: 6000,&lt;br&gt;
    command: 'appium.cmd',&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;services: [
    ['appium', {
        args: {
            address: '0.0.0.0',
            basePath: '/',
            port: 4723, // Match the port used manually
            logLevel: 'debug',
            commandTimeout: '7200',
            sessionOverride: true,
            debugLogSpacing: true,
        },
        logPath: './appium_logs',
    }]
],

specs: [path.resolve(__dirname, '../test/specs/AppLogout.js')],
exclude: [],
maxInstances: 1, // Adjust as needed for parallel testing

capabilities: [{
    platformName: 'Android',
    'appium:deviceName': 'Pixel 3 API 31',
    'appium:platformVersion': '12.0',
    'appium:automationName': 'UIAutomator2',
    'waitforTimeout': 30000,
    'commandTimeout': 30000,
    'appium:app': path.join(process.cwd(), './app-release.apk'), // Adjusted path for APK file
}],

logLevel: 'trace', // Set to trace for detailed logs

bail: 0,

baseUrl: 'http://localhost',

waitforTimeout: 60000,
connectionRetryTimeout: 400000,
connectionRetryCount: 3,

framework: 'mocha',

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

mochaOpts: {
    ui: 'bdd',
    timeout: 600000,
    require: [
        '@babel/register',
    ],
},

afterTest: async function (test, context, { error }) {
    if (error) {
        console.error(`Test failed: ${test.title}`);
        await browser.takeScreenshot();
    }
},

onPrepare: function () {
    console.log('Starting Appium...');
    const appiumProcess = require('child_process').spawn('appium', [
        '--base-path', '/',
        '--address', '0.0.0.0',
        '--port', '4723'
    ], { stdio: 'inherit' });

    appiumProcess.on('error', (err) =&amp;gt; {
        console.error('Appium failed to start:', err.message);
    });
},

onComplete: function () {
    const reportError = new Error('Could not generate Allure report');
    const allureResultsPath = path.join(__dirname, 'allure-results');
    const allureReportPath = path.join(__dirname, 'allure-report');

    if (fs.existsSync(allureReportPath)) {
        console.log('Deleting old Allure report...');
        fs.rmSync(allureReportPath, { recursive: true });
    } else {
        console.log('No existing Allure report directory to delete.');
    }

    if (fs.existsSync(allureResultsPath)) {
        const files = fs.readdirSync(allureResultsPath);
        if (files.length === 0) {
            console.error('Allure results directory is empty. Report generation will fail.');
            return Promise.reject(reportError);
        }
    } else {
        console.error('Allure results directory does not exist. Report generation will fail.');
        return Promise.reject(reportError);
    }

    console.log('Generating Allure report...');
    const generation = allure(['generate', allureResultsPath, '--clean']);

    return new Promise((resolve, reject) =&amp;gt; {
        const timeout = setTimeout(() =&amp;gt; reject(reportError), 10000);

        generation.on('exit', (exitCode) =&amp;gt; {
            clearTimeout(timeout);

            if (exitCode !== 0) {
                console.error('Allure report generation failed with exit code:', exitCode);
                return reject(reportError);
            }

            console.log('Allure report successfully generated.');
            resolve();
        });
    });
},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;};&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
