question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

seeInThisFile, Playwright, is broken. freezes process

See original GitHub issue

What are you trying to achieve?

use I.seeInThisFile("some string"); and run my tests in a pipeline.

What do you get instead?

Test failures that crash & freeze the worker node. It fails every test at I.seeInThisFile, and the CSV file clearly contains the string it is attempting to search for. Additionally, a notice that says an after all hook fails, which causes the process to freeze up. I don’t have an “after all” hook in any of my test setup, so this is most likely a failure in a plugin, (videoOnFail most likely)… Since this happens in a CI pipeline, it is very frustrating because the node will run frozen until it times out.

Screen Shot 2022-10-26 at 10 31 14 PM

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

  • Playwright helper
  • custom I function including this seeInThisFile call.

Details

  • CodeceptJS version: 3.3.4+
  • NodeJS Version: v16.17.1
  • Operating System: MacOS, linux ubuntu
  • playwright: 1.23.4
exports.config = {
  tests: "./*/test_*.ts",
  output: "./results",
  helpers: {
    Playwright: {
      url: process.env.E2E_HOST || "https://localhost:8080",
      show: true,
      browser: "chromium",
      windowSize: "1600x1200",
      waitForNavigation: "load",
      waitForAction: 0,
      timeout: 60000,
      restart: false,
      ignoreHTTPSErrors: process.env.IGNORE_HTTPS === "true" || true,
      video: process.env.RECORD_FAILED === "true" || false,
      keepCookies: true,
      chromium: {
        // Launch args that make chrome run faster
        args: [
          "--blink-settings=imagesEnabled=false",
          "--proxy-server='direct://'",
          "--proxy-bypass-list=*",
        ],
      },
    },
    FileSystem: {},
    diffingHelper: {
      require: "./setup/diffingHelper",
    },
    attachVideoAllure: {
      require: "./setup/attachVideoAllure",
    },
    dataManipulation: {
      require: "./setup/dataManipulation",
    },
    ChaiWrapper: {
      require: "codeceptjs-chai",
    },
  },
  plugins: {
    allure: {
      // https://codecept.io/plugins/#allure
      enabled: process.env.ALLURE === "true" || false,
      outputDir: "./reports/allure",
    },
    coverage: {
      enabled: process.env.COVERAGE === "true" || false,
      coverageDir: "./reports/playwrightCoverageData",
      uniqueFileName: true,
    },
    autoDelay: {
      enabled: false,
    },
    eachElement: {
      enabled: true,
    },
    pauseOnFail: {
      enabled: false,
    },
    tryTo: {
      enabled: true,
    },
    retryTo: {
      enabled: true,
    },
    screenshotOnFail: {
      enabled: true,
      uniqueScreenshotNames: true,
    },
    autoLogin: {
    },
  },
  include: {
    I: "./setup/helperFunctions.ts",
  },
  bootstrap: null,
  mocha:
    process.env.MOCHA === "true"
      ? {
          reporter: "mocha-junit-reporter",
          reporterOptions: {
            testsuitesTitle: "E2E Tests",
            mochaFile: xmlDir,
            attachments: true,
            suiteTitleSeparatedBy: ".",
          },
        }
      : {},
  name: "codecept",
};

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nateGarciacommented, Nov 16, 2022

@StasGrishaevTutu Sure no problem. I think I took most of this from another user, but I forget their name. Note that it kills the browserContext in order to process the video. This could have some side effects depending on your setup.

In setup/attachVideoAllure.ts

import { readFileSync } from "fs";
import { Helper } from "codeceptjs";

/**
 * Helper class for the Playwright Report
 */
class PlaywrightHelper extends Helper {
  /**
   * Constructor
   * @param config
   */
  constructor(config) {
    super(config);
  }

  /**
   * Attach Video to allure report
   * @param test
   */
  async _attachVideo(test) {
    const Playwright = codeceptjs.container.helpers("Playwright");
    if (Playwright) {
      const allure = codeceptjs.container.plugins("allure");
      if (allure) {
        await Playwright.browserContext.close(); // Need to close browser context to get video to generate
        const FORMAT = "video/webm";
        const TITLE = "Execution Video";
        const video =
          test.artifacts?.video || test._retriedTest?.artifacts?.video;
        if (video) {
          codeceptjs.output.debug(`Attaching Video: ${video}`);
          allure.addAttachment(TITLE, readFileSync(video), FORMAT);
        }
      }
    }
  }

  /**
   * Run on test failure
   * @param test
   */
  async _failed(test) {
    await this._attachVideo(test);
  }
}

export = PlaywrightHelper;

in steps.d.ts, add in the helper

...
interface Methods extends Playwright, attachVideoAllure {}
interface I extends ReturnType<steps_file>, WithTranslation<attachVideoAllure> {}
...
0reactions
StasGrishaevTutucommented, Nov 17, 2022

@nateGarcia thank you, really appreciate it ! with a bit changes it works on my side !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · codeceptjs/CodeceptJS - GitHub
Integrate SauceLabs using CodeceptJS and Playwright Helper. #3482 opened on Oct 28 by jpaxtonrs · 6 · seeInThisFile, Playwright, is broken. freezes process....
Read more >
Playwright - Chromium keeps crashing while filling input ...
The process is as follows: Loop through several objects in an array; Find a category on the page that contains the object's name...
Read more >
Troubleshoot errors, freezes | Reader | Windows
Follow these steps to resolve common system errors that occur while you use Adobe Reader on Windows 2000 or XP.
Read more >
Fix an Android device that freezes or won't respond
If your phone is frozen with the screen on, hold down the power button for about 30 seconds to restart. Troubleshoot your phone....
Read more >
Ubuntu 16.04 freezes when I use libreoffice writer
To diagnose the problem, find out what process is guilty for the frozen graphics: I open a terminal (CTRL-ALT-F2) and run "Table of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found