Localization testing with Playwright

Having a non-english desktop environment, we need to switch locales
e.g. for localization/ internationalization testing
solved by using Playwright’s local option for switching languages within a new browser session

  'emulate english browser',
  { /* Playwright specific option */ locale: 'en-US' },
  () => {...})


// this works for Playwright only
  'use preferred browser language (navigator.locale) to rediect the url, en -> /',
  (I) => {
    // switch browser to english localizaton
    // set browser local to english see https://github.com/microsoft/playwright/blob/master/docs/api.md
      'english browser',
      { /* Playwright specific option */ locale: 'en-US' },
      () => {
        // in case language detection relies on the request header vs navigator.language(s)
          'en-US, de;q=0.9, fr;q=0.8, es;q=0.7, *;q=0.5'
        I.see('English') // language picker shows english
        I.dontSeeInCurrentUrl('/de') // not redirected to german url
        I.dontSee('Deutsch') // language picker does not show german

Thanks to HansHammel for the recipe!
Taken from https://github.com/codecept-js/CodeceptJS/issues/2331

Hi, this recipe does not work anymore in CodeceptJS 3+

I get this error:

> /my-project/tests/node_modules/codeceptjs/lib/cli.js:40
>       if (test.ctx.currentTest) {
>                    ^
> TypeError: Cannot read property 'currentTest' of undefined
>     at Runner.<anonymous> (/my-project/tests/node_modules/codeceptjs/lib/cli.js:40:20)

Does somebody know how to make still use of Playwright “session()” function with CodeceptJS 3?