CodeceptJS
CodeceptJS copied to clipboard
CodeceptJS version 3.0.5 not executing gherkin steps in order
What are you trying to achieve?
Trying to execute in order my features
What do you get instead?
Errors while executing the same features and scenarios ,as I saw it was executing the tests in order so It was throwing some exceptions because it was not finding some elements because of the same reason of not being executed in order
Provide console output if related. Use
--verbosemode for more details.
I updated from the "2.6.10" to the 3.0.5 and the same steps and scenarios stopped working , after debugging for hours I discovered that the test were not being executed in order
# Envio de dinero --
- As a ClaroPay user, I want to send money
[1] Starting recording promises
Envio de dinero a cuenta con mi moto1 {"Type":"CLABE","Number":"036180710012804928","Amount":"5"} @claropay @mx @moto1 @probando
Ya inicie sesión
Given I am logged in
loginPage: validateHomeScreen
I run on android () => {
I.waitForElement(this.fields.home, 20)
}
[1] Starting <Android-only actions> session
When I confirm my NIP
I wait for element "#com.globalhitss.claro.pay.uat:id/recentItemList", 20
[1] <Android-only actions> Finalize <undefined> session
Then I should see Procesando Transaccion
transferenciaPage: validateTransaccion
I run on android () => {
I.waitForElement({ xpath: this.fields.procesando_transaccion }, 15)
I.seeElement({ xpath: this.fields.procesando_transaccion })
}
[1] Starting <Android-only actions> session
I wait for element {"xpath":"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/android.widget.LinearLayout"}, 15
Given I am logged in
loginPage: validateHomeScreen
I run on i o s () => {
I.waitForElement(this.fields.home_ios, 20)
I.waitForElement(this.fields.recargar_ios, 20)
I.waitForElement(this.fields.retirar_ios, 20)
}
And I tap on Enviar dinero
transferenciaPage: tapEnviarDinero
I run on android () => {
I.tap({ xpath: this.fields.enviar_dinero })
}
[1] <Android-only actions> Starting <Android-only actions> session
I tap {"xpath":"/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/androidx.drawerlayout.widget.DrawerLayout/android.view.…
[1] <Android-only actions> Finalize <undefined> session
And I tap on Enviar dinero
transferenciaPage: tapEnviarDinero
I run on i o s () => {
I.tap({ xpath: this.fields.enviar_dinero_ios })
}
And I fill the amount of the transfer which is 5
transferenciaPage: fillAmount "5"
I run on android () => {
I.fillField(this.fields.cantidad, amount)
I.hideDeviceKeyboard()
}
[1] Starting <Android-only actions> session
I fill field "#com.globalhitss.claro.pay.uat:id/eTxtAmount", "5"
I hide device keyboard
[1] <Android-only actions> Finalize <undefined> session
And I fill the amount of the transfer which is 5
transferenciaPage: fillAmount "5"
I run on i o s () => {
I.fillField({ xpath: this.fields.cantidad_ios }, amount)
}
And I choose the destinatary, the type CLABE which is 036180710012804928
transferenciaPage: fillDestinatary "036180710012804928"
I run on android () => {
I.fillField(this.fields.destinatario, destinatary)
}
[1] Starting <Android-only actions> session
I fill field "#com.globalhitss.claro.pay.uat:id/eTxtAccount", "036180710012804928"
[1] <Android-only actions> Retrying... Attempt #2
[1] <Android-only actions> Finalize <undefined> session
And I choose the destinatary, the type CLABE which is 036180710012804928
transferenciaPage: fillDestinatary "036180710012804928"
I run on i o s () => {
I.fillField({ xpath: this.fields.destinatario_ios }, destinatary)
I.seeElement({ xpath: this.fields.destinatario_ios }, destinatary)
I.tap(this.fields.esconder_teclado_ios)
}
And I fill the concept which is "Concepto de prueba"
transferenciaPage: fillConcept "Concepto de prueba"
I run on android () => {
I.fillField(this.fields.concepto, concept)
I.performSwipe({ x: 559, y: 655 }, { x: 586, y: 5 })
}
[1] Starting <Android-only actions> session
I fill field "#com.globalhitss.claro.pay.uat:id/eTxtConcept", "Concepto de prueba"
I perform swipe {"x":559,"y":655}, {"x":586,"y":5}
[1] <Android-only actions> Finalize <undefined> session
And I fill the concept which is "Concepto de prueba"
transferenciaPage: fillConcept "Concepto de prueba"
I run on i o s () => {
I.fillField({ xpath: this.fields.concepto_ios }, concept)
I.tap(this.fields.esconder_teclado_ios)
}
And I tap on Continuar
I run on android () => {
I.waitForElement('Continuar', 5)
I.tap('Continuar')
}
[1] Starting <Android-only actions> session
I wait for element "Continuar", 5
I tap "Continuar"
[1] <Android-only actions> Finalize <undefined> session
And I tap on Continuar
I run on i o s () => {
I.waitForElement('~Continuar', 15)
I.tap('~Continuar')
}
And I scroll down
I run on android () => {
I.wait(5)
I.performSwipe({ x: 559, y: 655 }, { x: 586, y: 5 })
}
[1] Starting <Android-only actions> session
I wait 5
[1] <Android-only actions> Error | Error: element (/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/android.widget.LinearL…
[1] <Android-only actions> Error | Error: element (/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/android.widget.LinearL…
[1] <Android-only actions> Error | Error: element (/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/android.widget.LinearL…
[1] <Android-only actions> Error | Error: element (/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/android.widget.LinearL…
[1] <Android-only actions> Error | Error: element (/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/android.widget.LinearL…
[1] <Android-only actions> Starting <teardown> session
[1] <teardown> Stopping recording promises
› <screenshotOnFail> Test failed, try to save a screenshot
› Screenshot has been saved to /Users/rjfm/WebstormProjects/Appium-CodeceptJS/evidence/Envio_de_dinero_a_cuenta_con_mi_mot.failed.png
(node:47769) UnhandledPromiseRejectionWarning: Error: element (/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/android.widget.LinearLayout) still not present on page after 15 sec
at /Users/rjfm/WebstormProjects/Appium-CodeceptJS/node_modules/webdriverio/build/commands/browser/waitUntil.js:34:15
at async Browser.wrapCommandFn (/Users/rjfm/WebstormProjects/Appium-CodeceptJS/node_modules/webdriverio/node_modules/@wdio/utils/build/shim.js:74:23)
(node:47769) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:47769) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✖ FAILED in 41236ms
[2] Starting recording promises
-- FAILURES:
1) Envio de dinero
Envio de dinero a cuenta con mi moto1 {"Type":"CLABE","Number":"036180710012804928","Amount":"5"} @claropay @mx @moto1 @probando:
element (/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.view.ViewGroup/android.widget.FrameLayout/android.view.ViewGroup/android.widget.LinearLayout) still not present on page after 15 sec
at /Users/rjfm/WebstormProjects/Appium-CodeceptJS/node_modules/webdriverio/build/commands/browser/waitUntil.js:34:15
at async Browser.wrapCommandFn (node_modules/webdriverio/node_modules/@wdio/utils/build/shim.js:74:23)
Scenario Steps:
- I.runOnAndroid(() => {
I.waitForElement({ xpath: this.fields.procesando_transaccion }, 15)
I.seeElement({ xpath: this.fields.procesando_transaccion })
}) at Object.validateTransaccion (./pages/Transferencia.js:79:5)
- I.waitForElement("#com.globalhitss.claro.pay.uat:id/recentItemList", 20) at ./pages/Login.js:28:6
- I.runOnAndroid(() => {
I.waitForElement(this.fields.home, 20)
}) at Object.validateHomeScreen (./pages/Login.js:27:5)
Artifacts:
- screenshot: /Users/rjfm/WebstormProjects/Appium-CodeceptJS/evidence/Envio_de_dinero_a_cuenta_con_mi_mot.failed.png
FAIL | 0 passed, 1 failed // 1m
allure-js-commons: Unexpected endStep(). There are no any steps running
allure-js-commons: Unexpected startStep() of I perform swipe {"x":559,"y":655}, {"x":586,"y":5}. There is no parent step
I perform swipe {"x":559,"y":655}, {"x":586,"y":5}
[2] Error | RequestError: read ECONNRESET
allure-js-commons: Unexpected endStep(). There are no any steps running
[2] Error | RequestError: read ECONNRESET
[2] Error | RequestError: read ECONNRESET
[2] Error | RequestError: read ECONNRESET
[2] Error | RequestError: read ECONNRESET
[2] Error | RequestError: read ECONNRESET
[2] Error | RequestError: read ECONNRESET
[2] Error | RequestError: read ECONNRESET
[2] Error | RequestError: read ECONNRESET
(node:47769) UnhandledPromiseRejectionWarning: RequestError: read ECONNRESET
at ClientRequest.<anonymous> (/Users/rjfm/WebstormProjects/Appium-CodeceptJS/node_modules/got/dist/source/core/index.js:891:25)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:327:22)
at ClientRequest.EventEmitter.emit (domain.js:482:12)
at ClientRequest.origin.emit (/Users/rjfm/WebstormProjects/Appium-CodeceptJS/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
at Socket.socketErrorListener (_http_client.js:426:9)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:482:12)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
(node:47769) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:47769) UnhandledPromiseRejectionWarning: RequestError: read ECONNRESET
at ClientRequest.<anonymous> (/Users/rjfm/WebstormProjects/Appium-CodeceptJS/node_modules/got/dist/source/core/index.js:891:25)
at Object.onceWrapper (events.js:422:26)
at ClientRequest.emit (events.js:327:22)
at ClientRequest.EventEmitter.emit (domain.js:482:12)
at ClientRequest.origin.emit (/Users/rjfm/WebstormProjects/Appium-CodeceptJS/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
at Socket.socketErrorListener (_http_client.js:426:9)
at Socket.emit (events.js:315:20)
at Socket.EventEmitter.emit (domain.js:482:12)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
(node:47769) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
npm ERR! code 1
npm ERR! path /Users/rjfm/WebstormProjects/Appium-CodeceptJS
npm ERR! command failed
npm ERR! command sh -c codeceptjs "run" "--features" "--debug" "--grep" "@probando" "--plugins" "allure" "--verbose"
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rjfm/.npm/_logs/2021-03-24T04_14_11_211Z-debug.log
npm ERR! code 1
npm ERR! path /Users/rjfm/WebstormProjects/Appium-CodeceptJS
npm ERR! command failed
npm ERR! command sh -c npx -n --async-stack-traces codeceptjs run --features --debug --grep '@probando' --plugins allure --verbose
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rjfm/.npm/_logs/2021-03-24T04_14_11_261Z-debug.log
Provide test source code if related
Details
- CodeceptJS version: 3.0.5
- NodeJS Version:12.18.2.
- Operating System:Bigsur
- appium
- Configuration file:
# env = {
output: 'evidence',
helpers: {
Appium: {
platform: 'Android',
device: process.env.DEVICE_TARGET,
desiredCapabilities: {
platformName: 'Android',
deviceName: 'Mi cel',
appPackage: 'com.globalhitss.claro.pay.uat',
appActivity: 'com.globalhitss.claro.pay.ui.activities.SplashScreen',
newCommandTimeout: '60',
fullReset: false,
noReset: true,
autoLaunch: true,
systemPort: process.env.PORT,
},
},
ChaiWrapper: {
require: 'codeceptjs-chai',
},
},
include: {
I: './steps_file.js',
loginPage: './pages/Login.js',
consultaSaldoPage: './pages/ConsultaSaldo.js',
nipPage: './pages/NIP.js',
pagoDeAguaPage: './pages/PagoDeAgua.js',
recargaPage: './pages/Recarga.js',
transferenciaPage: './pages/Transferencia.js',
retiroPage: './pages/Retiro.js',
aclaracionesPage: './pages/Aclaraciones.js',
consultaCarteraPage: './pages/ConsultaDeCartera.js',
pagoEnComercioPage: './pages/PagoEnComercio.js',
agregarDineroPage: './pages/AgregarDinero.js',
onBoardingPage: './pages/OnBoarding.js',
pospagoPage: './pages/Pospago.js',
agregarMetodoPage: './pages/AgregarMetodoDePago.js',
borrarTarjetaPage: './pages/BorrarTarjeta.js',
menuHamburguesaPage: './pages/MenuHamburguesa.js',
miPerfilPage: './pages/MiPerfil.js',
miniappsPage: './pages/MiniApps.js',
barraInferiorPage: './pages/BarraInferior.js',
ayudaAclaracionesPage: './pages/AyudaAclaraciones.js',
cercaDeMiPage: './pages/CercaDeMi.js',
seleccionarMetodoDePagoFragment: './fragments/SeleccionarMetodoDePago.js',
iniciarSesionPage: './pages/IniciarSesion.js',
},
mocha: {},
bootstrap: null,
teardown: null,
hooks: [],
gherkin: {
features: './features/*.feature',
steps: [
'./step_definitions/steps.js',
'./step_definitions/LoginSteps.js',
'./step_definitions/ConsultaDeSaldoSteps.js',
'./step_definitions/PagoDeAguaSteps.js',
'./step_definitions/RecargaSteps.js',
'./step_definitions/TransferenciaSteps.js',
'./step_definitions/RetiroSteps.js',
'./step_definitions/AclaracionesSteps.js',
'./step_definitions/ConsultaDeCarteraSteps.js',
'./step_definitions/PagoEnComercioSteps.js',
'./step_definitions/AgregarDineroSteps.js',
'./step_definitions/OnBoardingSteps.js',
'./step_definitions/PospagoSteps.js',
'./step_definitions/AgregarMetodoDePagoSteps.js',
'./step_definitions/BorrarTarjetaSteps.js',
'./step_definitions/MiPerfilSteps.js',
'./step_definitions/MiniAppsSteps.js',
'./step_definitions/AyudaAclaracionesSteps.js',
'./step_definitions/CercaDeMiSteps.js',
'./step_definitions/SeleccionarMetodoDePagoSteps.js',
'./step_definitions/IniciarSesionSteps.js',
],
},
plugins: {
screenshotOnFail: {
enabled: true,
},
retryFailedStep: {
enabled: true,
},
stepByStepReport: {
enabled: false,
screenshotsForAllureReport: false,
},
allure: {},
pauseOnFail: {},
},
tests: 'tests/*_test.js',
name: 'Appium-CodeceptJS',
}
Hi ,
Did you find a solution to this? Even I am facing a lot of issues lately with the order of execution with the latest 3.0.5 Codeceptjs version.
Hi ,
Did you find a solution to this? Even I am facing a lot of issues lately with the order of execution with the latest 3.0.5 Codeceptjs version.
Not really , I decided to downgrade to the 2.6.10 version , I think my case is that its seems that the I .runOnAndroid and I.runOnIos now needs and async and await but not sure
Yes, I am trying that too, with different combinations, but still having too many issues with order of execution.
@punjaan @javierfuentesm Thanks for the report Please narrow down that issue to something that would be possible to reproduce. Thanks!
I am facing the same problem. Even though my I.runOnIOS is awaited, it is executing functions that are written after the runOnIOS before the runOnIOS has executed. I have async/awaited every combination of things but it seems the runOnIOS method of resolving promises isn't working as expected.
This code runs as expected, if the commented code is uncommented to run the test in specifically iOS it fails as it starts to run the next step before the loginWithStaticUserIos function has completed
Closed for now! Feel free to reopen if you still encounter the issue with latest version and would be nice to provide a sample code to reproduce the issue.

