Advertisement
happymammont

Untitled

Apr 16th, 2020
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const fs = require('fs');
  2.  
  3. exports.config = {
  4.     runner: 'local',
  5.     port: 4723,
  6.     path: '/wd/hub',
  7.     services: ['appium'],
  8.     appium: {
  9.         command: 'appium'
  10.     },
  11.     specs: [
  12.         './tests/**/*.spec.js'
  13.     ],
  14.     sync: true,
  15.     maxInstances: 1,
  16.     capabilities: [{
  17.         platformName: 'Android',
  18.         platformVersion: '8.0',
  19.         deviceName: process.env.DEVICE_NAME,
  20.         app: process.env.APP_URL,
  21.         appPackage: 'mainapp',
  22.         appActivity: 'MainActivity',
  23.         automationName: 'uiautomator2',
  24.         newCommandTimeout: 1000,
  25.         uiautomator2ServerInstallTimeout: 4000,
  26.         adbExecTimeout: 120000,
  27.         autoGrantPermissions: true,
  28.         autoAcceptAlerts: true,
  29.         unicodeKeyboard: true,
  30.         reporters: ['spec']
  31.     }],
  32.     logLevel: 'warn',
  33.     framework: 'mocha',
  34.     reporters: ['spec'],
  35.     mochaOpts: {
  36.         timeout: 600000
  37.     },
  38.     waitforTimeout: 4000,
  39.     connectionRetryTimeout: 90000,
  40.     afterTest: (test, context, {
  41.         error, result, duration, passed, retries
  42.     }) => {
  43.         if (!passed) {
  44.             const screenshot = driver.takeScreenshot();
  45.  
  46.             fs.writeFile(`./screenshots/${test.parent}:${test.title.replace(/,/g, '').replace(/ /g, '-')}.png`, screenshot, 'base64', (err) => {
  47.                 if (err) {
  48.                     throw err;
  49.                 }
  50.             });
  51.         }
  52.     }
  53. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement