CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Cannot run CodeCeptJS - Playwright on a RedHat Server

Open jbergeronjr opened this issue 3 years ago • 4 comments

What are you trying to achieve?

Running Codeceptjs with Playwright on a RedHat 8 server.

What do you get instead?

> codeceptjs run --plugins allure --grep "localtest"
/root/qa/node_modules/playwright-core/lib/server/recorder/javascript.js:181
      var  test= require("@playwright/test").test;var  expect${options.deviceName ? '= require("@playwright/test").expect${options.deviceName ? ';var  devices' : ''} = require("@playwright/test").devices' : ''};;
                                                                                                                                                 ^

SyntaxError: Unexpected token ';'
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1026:15)
    at Module._compile (node:internal/modules/cjs/loader:1061:27)
    at Object.Module._extensions.<computed> [as .js] (/root/qa/node_modules/node-hook/index.js:73:14)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/root/qa/node_modules/playwright-core/lib/server/recorder/java.js:16:19)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)

Details

  • CodeceptJS version: ^3.1.1
  • NodeJS Version: v18.3.0
  • Operating System: Linux RedHat 8
  • puppeteer || webdriverio || testcafe version (if related): Playwright ^1.14.1
  • Configuration file: Don't think the config is applicable here.
Config not applicable.

jbergeronjr avatar Jun 08 '22 16:06 jbergeronjr

I encountered the same and suspected that's from playwright yet codeceptjs.

kobenguyent avatar Jun 08 '22 16:06 kobenguyent

I was thinking the same, I went ahead and posted in the the playwright repo as well. Works perfectly fine locally but as soon as its on a server no dice. Did you have any success running on a server Peter?

jbergeronjr avatar Jun 08 '22 16:06 jbergeronjr

This happens on my local unfortunately so i need to do some trick to make it work. 😄

kobenguyent avatar Jun 08 '22 17:06 kobenguyent

If anyone else has an idea with this.. Folks at playwright think its a problem with Codecept

jbergeronjr avatar Jun 13 '22 18:06 jbergeronjr

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.

kobenguyent avatar Oct 19 '23 12:10 kobenguyent