Replies: 1 comment · 7 replies
-
@duyp6090 please always provide the whole stack trace, otherwise it is impossible to say what is going on. |
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
First of all, I want to send my sincere thanks to you for your enthusiasm in helping me. I sincerely apologize for not understanding your meaning and for influencing you. Please allow me to resend all terminal information. one more time thank you very much 2024-04-23T07:43:16.694Z INFO chromedriver: Initiate Chromedriver Launcher (v8.1.1) DevTools listening on ws://127.0.0.1:54959/devtools/browser/19dc5114-9312-4a9b-be24-86a8575a06b8 |
Beta Was this translation helpful? Give feedback.
All reactions
-
Please see the error:
You are trying to import an ESM file ( |
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
Now, chai is require ES6, in my wdio,conf.js, i use: import chai from "chai", but i have error: because my project is commonJS, so i config babel, My babel configuration doesn't seem correct. Can you help me point out what's wrong when using babel? Thank you very much. |
Beta Was this translation helpful? Give feedback.
All reactions
-
this is wdio.conf.js import chai from "chai" exports.config = {
} |
Beta Was this translation helpful? Give feedback.
All reactions
-
i also install old version of chai, but i don't like it |
Beta Was this translation helpful? Give feedback.
-
Hello everyone, have a good day for you. During the process of learning automated testing using webdriverio, I encountered an error that I could not fix. I hope everyone can look at the code and help me, thank you very much.
This is testLoginVerifycation.js
`
const loginPage = require("../loginPage.js");
const loginData = require("../Test_Data/testLogin.json");
const expect = require('chai').expect
describe('API Command', function() {
let pageUrl = "https://the-internet.herokuapp.com/login";
});
This is wdio.conf.js
const babel = require("@babel/register")({
rootMode: "upward",
});
exports.config = {
//
// ====================
// Runner Configuration
// ====================
// WebdriverIO supports running e2e tests as well as unit and component tests.
runner: 'local',
//
// ==================
// Specify Test Files
// ==================
// Define which test specs should run. The pattern is relative to the directory
// of the configuration file being run.
//
// The specs are defined as an array of spec files (optionally using wildcards
// that will be expanded). The test for each spec file will be run in a separate
// worker process. In order to have a group of spec files run in the same worker
// process simply enclose them in an array within the specs array.
//
// The path of the spec files will be resolved relative from the directory of
// of the config file unless it's absolute.
//
specs: [
'./test/pageObject2/testScript/testloginVerifycation.js'
],
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
],
//
// ============
// Capabilities
// ============
// Define your capabilities here. WebdriverIO can run multiple capabilities at the same
// time. Depending on the number of capabilities, WebdriverIO launches several test
// sessions. Within your capabilities you can overwrite the spec and exclude options in
// order to group specific specs to a specific capability.
//
// First, you can define how many instances should be started at the same time. Let's
// say you have 3 different capabilities (Chrome, Firefox, and Safari) and you have
// set maxInstances to 1; wdio will spawn 3 processes. Therefore, if you have 10 spec
// files and you set maxInstances to 10, all spec files will get tested at the same time
// and 30 processes will get spawned. The property handles how many capabilities
// from the same test should run tests.
//
maxInstances: 10,
//
// If you have trouble getting all important capabilities together, check out the
// Sauce Labs platform configurator - a great tool to configure your capabilities:
// https://saucelabs.com/platform/platform-configurator
//
capabilities: [{
browserName: 'chrome'
}],
}
`
I had dectect a problem that if i remove command: const expect = require('chai').expect, my code is run well. However, i want to use chaijs to code.
I will send some picture:
Thank you so much everyone!
Beta Was this translation helpful? Give feedback.
All reactions