Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using haveRequestHeaders (REST, Playwright) #3630

Closed
zhigulin-n opened this issue Mar 30, 2023 · 0 comments · Fixed by #3937
Closed

Using haveRequestHeaders (REST, Playwright) #3630

zhigulin-n opened this issue Mar 30, 2023 · 0 comments · Fixed by #3937

Comments

@zhigulin-n
Copy link

What are you trying to achieve?

I'm want to use REST.haveRequestHeaders

What do you get instead?

Playwright.haveRequestHeaders is called

Provide test source code if related

Before(async ({ I }) => {

  const authCookie = await I.getAuthCookie();

  I.haveRequestHeaders({
    'Auth': authCookie.Auth,
    'TimeCode': authCookie.TimeCode
  });
});

Details

  • CodeceptJS version: 3.3.6
  • NodeJS Version: 18.7.0
  • Operating System: Ubuntu 20.04.6 LTS
  • Configuration file:
import {
  setHeadlessWhen,
  setCommonPlugins
} from '@codeceptjs/configure';

const env = require('dotenv').config({
  path: '.env.test'
})

if (env.error && env.error.code === 'ENOENT') {
  throw new Error('Please, recreate env.test file')
}

const base_url = process.env.URL
const currentBrowser = process.env.PROFILE || 'chromium'; // 'firefox', 'webkit'

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();
setHeadlessWhen(JSON.parse(process.env.HEADLESS));


export const config: CodeceptJS.MainConfig = {
  tests: './tests/**/*_test.ts',
  output: './output',
  helpers: {
    ChaiWrapper: {
      require: "codeceptjs-chai"
    },
    Playwright: {
      url: base_url,
      show: true,
      browser: currentBrowser,
      waitForTimeout: 10000
    },
    REST: {
      endpoint: base_url,
      defaultHeaders: {
        'Content-Type': 'application/json',
        'ForceUseSession': true,
        'Auth': '',
        'TimeCode': []
      }
    },
    JSONResponse: {},
    DbHelper: {
      "require": "codeceptjs-dbhelper"
    },
    GeneralHelper: {
      require: './helpers/general_helper.ts',
    }
  },
  include: {
    I: "./common/custom_steps.ts",
  },
  plugins: {
    tryTo: {
      enabled: true
    },
    allure: {
      enabled: true,
      require: '@codeceptjs/allure-legacy',
      outputDir: './output/allure/allure-results',
    },
    retryFailedStep: {
      enabled: true
    },
    pauseOnFail: {}
  },
  name: 'test',
  fullPromiseBased: false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant