Skip to content

Commit

Permalink
Merge branch '3.x' into task-4886-update-typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashohn committed Mar 7, 2025
2 parents b7e311c + 28f7837 commit 5745121
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
15 changes: 14 additions & 1 deletion lib/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ function loadGherkinSteps(paths) {
loadSupportObject(path, `Step Definition from ${path}`)
}
} else {
const folderPath = paths.startsWith('.') ? path.join(global.codecept_dir, paths) : ''
const folderPath = paths.startsWith('.') ? normalizeAndJoin(global.codecept_dir, paths) : ''
if (folderPath !== '') {
globSync(folderPath).forEach(file => {
loadSupportObject(file, `Step Definition from ${file}`)
Expand Down Expand Up @@ -562,3 +562,16 @@ function getHelperModuleName(helperName, config) {
// built-in helpers
return `./helper/${helperName}`
}
function normalizeAndJoin(basePath, subPath) {
// Normalize and convert slashes to forward slashes in one step
const normalizedBase = path.posix.normalize(basePath.replace(/\\/g, '/'))
const normalizedSub = path.posix.normalize(subPath.replace(/\\/g, '/'))

// If subPath is absolute (starts with "/"), return it as the final path
if (normalizedSub.startsWith('/')) {
return normalizedSub
}

// Join the paths using POSIX-style
return path.posix.join(normalizedBase, normalizedSub)
}
4 changes: 3 additions & 1 deletion lib/helper/Appium.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,10 @@ class Appium extends Webdriver {

_buildAppiumEndpoint() {
const { protocol, port, hostname, path } = this.browser.options
// Ensure path does NOT end with a slash to prevent double slashes
const normalizedPath = path.replace(/\/$/, '')
// Build path to Appium REST API endpoint
return `${protocol}://${hostname}:${port}${path}/session/${this.browser.sessionId}`
return `${protocol}://${hostname}:${port}${normalizedPath}/session/${this.browser.sessionId}`
}

/**
Expand Down
3 changes: 2 additions & 1 deletion lib/helper/Mochawesome.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ let currentSuite

const Helper = require('@codeceptjs/helper')
const { clearString } = require('../utils')
const { testToFileName } = require('../mocha/test')

class Mochawesome extends Helper {
constructor(config) {
Expand Down Expand Up @@ -50,7 +51,7 @@ class Mochawesome extends Helper {
fileName = clearString(`${test.title}_${currentTest.test.title}`)
} else {
currentTest = { test }
fileName = clearString(test.title)
fileName = `${testToFileName(test)}`
}
if (this.options.uniqueScreenshotNames) {
const uuid = test.uuid || test.ctx.test.uuid
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
"@codeceptjs/configure": "1.0.2",
"@codeceptjs/helper": "2.0.4",
"@cucumber/cucumber-expressions": "18",
"@cucumber/gherkin": "31",
"@cucumber/gherkin": "32",
"@cucumber/messages": "27.2.0",
"@xmldom/xmldom": "0.9.7",
"@xmldom/xmldom": "0.9.8",
"acorn": "8.14.0",
"arrify": "3.0.0",
"axios": "1.8.1",
Expand Down Expand Up @@ -123,8 +123,8 @@
"@apollo/server": "^4",
"@codeceptjs/expect-helper": "^0.2.2",
"@codeceptjs/mock-request": "0.3.1",
"@eslint/eslintrc": "3.2.0",
"@eslint/js": "9.19.0",
"@eslint/eslintrc": "3.3.0",
"@eslint/js": "9.21.0",
"@faker-js/faker": "9.4.0",
"@pollyjs/adapter-puppeteer": "6.0.6",
"@pollyjs/core": "5.1.0",
Expand All @@ -134,13 +134,13 @@
"@wdio/sauce-service": "9.7.2",
"@wdio/selenium-standalone-service": "8.15.0",
"@wdio/utils": "9.7.2",
"@xmldom/xmldom": "0.9.7",
"@xmldom/xmldom": "0.9.8",
"chai": "^4.0.0",
"chai-as-promised": "7.1.2",
"chai-subset": "1.6.0",
"documentation": "14.0.3",
"electron": "34.0.2",
"eslint": "^9.19.0",
"eslint": "^9.21.0",
"eslint-plugin-import": "2.31.0",
"eslint-plugin-mocha": "10.5.0",
"expect": "29.7.0",
Expand All @@ -155,7 +155,7 @@
"json-server": "0.17.4",
"playwright": "1.50.1",
"prettier": "^3.3.2",
"puppeteer": "24.1.1",
"puppeteer": "24.3.1",
"qrcode-terminal": "0.12.0",
"rosie": "2.1.1",
"runok": "0.9.3",
Expand Down

0 comments on commit 5745121

Please sign in to comment.