Skip to content

Commit f93465f

Browse files
committed
fix: cypress v12
1 parent f105e9e commit f93465f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

bin/testObservability/cypress/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,19 @@ Cypress.on('command:start', (command) => {
5757
options: { log: false }
5858
});
5959
/* Send platform details */
60+
let testTitle = '';
61+
try {
62+
const runner = Cypress.mocha.getRunner();
63+
const ctx = runner.suite.ctx;
64+
testTitle = ctx.currentTest.title || ctx._runnable.title;
65+
} catch (error) {
66+
// Silently handle if any property is undefined
67+
}
68+
6069
eventsQueue.push({
6170
task: 'test_observability_platform_details',
6271
data: {
63-
testTitle: Cypress?.mocha?.getRunner()?.suite?.ctx?.currentTest?.title || Cypress?.mocha?.getRunner()?.suite?.ctx?._runnable?.title,
72+
testTitle,
6473
browser: Cypress.browser,
6574
platform: Cypress.platform,
6675
cypressVersion: Cypress.version

0 commit comments

Comments
 (0)