mardi 19 décembre 2017

How to do OS Profile based Protractor configuration

I am writing a protractor test suite and I want to execute them across different OS platforms. I develop on Windows, hence my primary settings is set according to Windows, but my primary execution environment is linux. The issue is that before I push the code I need to comment settings specific to Windows and enable settings specific to linux. Is there any way to maintain both settings and select them based on execution profile?

Example: The settings for a video-reporter on windows is -

jasmine.getEnv().addReporter(new VideoReporter({
  baseDirectory: './test-output/videoreport',
  createSubtitles: false,
  saveSuccessVideos: true,
  singleVideo: true,
  ffmpegCmd: "C:/FFmpeg/bin/ffmpeg.exe",
  ffmpegArgs: [
    '-f', 'gdigrab',
    '-framerate', '30',
    '-video_size', 'wsxga',
    '-i', 'desktop',
    '-q:v', '10',
  ]
}));

While the same for linux is -

jasmine.getEnv().addReporter(new VideoReporter({
  baseDirectory: './test-output/videos',
  saveSuccessVideos: true,
  ffmpegCmd: '/usr/local/bin/ffmpeg',
  ffmpegArgs: [
    '-y',
    '-r', '30',
    '-f', 'x11grab',
    '-s', '1280x1024',
    '-i', process.env.DISPLAY,
    '-g', '300',
    '-vcodec', 'mpeg4'
  ]
}));

At present I disable one and enable other as I switch between windows/linux. I want this to go and have both of them enabled but activate based on execution environment. Is there a way to do it?

Aucun commentaire:

Enregistrer un commentaire