Search code examples
appiumgherkincodeceptjs

Appium - Codeceptjs - Gherkin, can not execute steps script and config failed


I've got some issues with codeceptjs appium.

  1. I run test script by npx codeceptjs run , it did not execute the step_definitions file.
  2. I config steps definition with /*steps.js and its not working, i have to direct exact path of steps file.

The app crashed without throw exception, the script still being execute.

add-task.feature Feature: Add task Background: I opened the application Scenario: Add task Given I click Add Task button And I input all information

add-task-steps.js
When("I input all information", () => {
    AddTaskScreen.inputTaskName('sdsada')
});
const  HomeScreen = require("../screens/home-screen.js")

 const { I } = inject();
home-screen-steps.js
Given("I click Add Task button", () => {
    HomeScreen.tapAddTaskButton();
});

Details

  • CodeceptJS version: ^3.3.6
  • NodeJS Version: 8.15.0
  • Operating System: Windows 10
  • webdriverio 7.25.2
  • Configuration file:
exports.config = {
  output: './output',
  helpers: {
    Appium: {
      app: 'Appium/ToDoList.apk',
      platform: 'Android',
      device: 'emulator-5556'
    }
  },
  include: {
    I: './steps_file.js',
    env:{
      TIMEOUT: 5000,
    }
  },
  mocha: {},
  bootstrap: null,
  timeout: null,
  teardown: null,
  hooks: [],
  gherkin: {
    features: './features/*.feature',
    steps: ['./step_definitions/home-screen-steps.js']
  },
  plugins: {
    screenshotOnFail: {
      enabled: true
    },
    tryTo: {
      enabled: true
    },
    retryFailedStep: {
      enabled: false
    },
    retryTo: {
      enabled: true
    },
    eachElement: {
      enabled: true
    },
    pauseOnFail: {}
  },
  stepTimeout: 10000,
  stepTimeoutOverride: [{
      pattern: 'wait.*',
      timeout: 0
    },
    {
      pattern: 'amOnPage',
      timeout: 0
    }
  ],
  tests: './*_test.js',
  name: 'appium'
}

Thanks in advance. <3


Solution

  • I resolved it by replace waitForElementToBeClickable with waitForElement. Idk why Codeceptjs not recognize waitForElementToBeClickabe and also not throw any exception.