codeceptjs / codeceptjs/CodeceptJS

Codeceptjs test fails on click but it clicks

Đang mở
#2,683 2 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
4.2k
Fork
757
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
16

Mô tả

#### What are you trying to achieve?

I click an element y test fails, but when you see the screenshots the click was made.
Test sees the element exits before clicking it.

#### What do you get instead?

Error can't found element

> Provide console output if related. Use `--verbose` mode for more details.

```js
Clickable element ".btn-primary" was not found by text|CSS|XPath

Scenario Steps:

- I.click(".btn-primary") at Object.login (steps_file.js:26:12)
- I.wait(2) at Object.login (steps_file.js:25:12)
- I.seeElement(".btn-primary") at Object.login (steps_file.js:24:12)
- I.fillField("#j_password", "A1b2c3d4") at Object.login (steps_file.js:23:12)
- I.fillField("#j_username", "pruebaqa.maks@gmail.com") at Object.login (steps_file.js:22:12)
- I.amOnPage("/login") at Object.login (steps_file.js:21:12)

Error: Clickable element ".btn-primary" was not found by text|CSS|XPath
at new ElementNotFound (node_modules/codeceptjs/lib/helper/errors/ElementNotFound.js:14:11)
at assertElementExists (node_modules/codeceptjs/lib/helper/WebDriver.js:2675:11)
at WebDriver.click (node_modules/codeceptjs/lib/helper/WebDriver.js:839:7)
at processTicksAndRejections (internal/process/task_queues.js:97:5)

```

> Provide test source code if related

```js

module.exports = function() {

return actor({

login: function() {
this.amOnPage('/login');
this.fillField('#j_username', "pruebaqa.maks@gmail.com");
this.fillField('#j_password', "A1b2c3d4");
this.seeElement('.btn-primary');
this.wait(2);
this.click('.btn-primary');
this.wait(2);
}
});
}

```

### Details

* CodeceptJS version:
* NodeJS Version: v12.19.0
* Operating System: Ubuntu 20.04.1 LTS
* webdriverio
* Configuration file:

```js
exports.config = {
output: './output',
helpers: {
WebDriver: {
url: 'https://zerca.com/',
browser: 'chrome',
smartWait: 5000,
restart: false,
windowSize: "maximize",
keepBrowserState: false,
keepCookies: false,
timeouts: {
script: 70000,
"page load": 15000
},
},
customHelper: {
require: './resources/CustomHelper.js',
},
},
include: {
I: './steps_file.js',
//Marketplace
homePage: './pages/marketplace/Home.js',
headerPage: './pages/marketplace/Header.js',
cestaPage: './pages/marketplace/Cesta.js',
productoPage: './pages/marketplace/Producto.js',
registroPage: './pages/marketplace/Registro.js',

//PageObject Backoffice
},
mocha: {},
bootstrap: null,
teardown: null,
hooks: [],
gherkin: {
features:
'./features/**/*.feature',
steps: [
// Marketplace
// Header
"./step_definitions/marketplace/Header/steps_precabecera.js",
"./step_definitions/marketplace/Header/steps_logotipo.js",
"./step_definitions/marketplace/Header/steps_buscador.js",
"./step_definitions/marketplace/Header/steps_cesta_header.js",
"./step_definitions/marketplace/Header/steps_identificacion_registro.js",
"./step_definitions/marketplace/Header/steps_aumentarCantidadCarrito.js",
"./step_definitions/marketplace/Header/steps_disminuirCantidadCarrito.js",
"./step_definitions/marketplace/Header/steps_eliminarCarrito.js",
"./step_definitions/marketplace/Header/steps_verCarro.js",
// Home
"./step_definitions/marketplace/Home/steps_home.js",
// Cesta
"./step_definitions/marketplace/Cesta/steps_cesta.js",
"./step_definitions/marketplace/Cesta/steps_aumentarCantidadCesta.js",
"./step_definitions/marketplace/Cesta/steps_disminuirCantidadCesta.js",
"./step_definitions/marketplace/Cesta/steps_eliminarCesta.js",
"./step_definitions/marketplace/Cesta/steps_saldoAcumulado.js",
"./step_definitions/marketplace/Cesta/steps_seguirComprando.js",
"./step_definitions/marketplace/Cesta/steps_tramitarPedido.js",
// FichaProducto
"./step_definitions/marketplace/FichaProducto/steps_cestaProducto.js",
"./step_definitions/marketplace/FichaProducto/steps_seleccionCantidad.js",
"./step_definitions/marketplace/FichaProducto/steps_carrouseles.js",
// RegistroUsuario
"./step_definitions/marketplace/Registro/steps_registro.js",
// Backoffice
]
},
plugins: {
allure: {
enabled: true,
outputDir: "report",
},
stepByStepReport: {
enabled: true,
screenshotsForAllureReport: false
},
screenshotOnFail: {
enabled: true
},
retryFailedStep: {
enabled: true,
minTimeout: 5000,
},
wdio: {
enabled: true,
services: ['selenium-standalone']
},
selenoid: {
enabled: true,
deletePassed: true,
autoCreate: false,
autoStart: true,
sessionTimeout: '30m',
//enableVideo: true,
//enableLog: true,
enableVNC: true
},
},
tests: './*_test.js',
name: 'zerca-validation-test'
}

```

I have the same issue in the same project, but other feature

Code:

```js
const { I } = inject();

module.exports = {

// insert your locators and methods here

botones: {
facebook: '.facebook-login button',
},

// Entrar con RRSS

clicarFacebook () {
I.waitForClickable(this.botones.facebook);
I.click(this.botones.facebook);
},

}
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.