constructor()

in integration/js/utils/SdkBaseTest.js [12:119]


  constructor(name, kiteConfig, testName) {
    super(name, kiteConfig);
    this.baseUrl = this.url;
    if (testName === 'ContentShareOnlyAllowTwoTest') {
      this.url = this.getTransformedURL(this.url, 'max-content-share', 'true');
    }

    if (testName === 'MessagingSessionTest') {
      this.userArn = this.payload.userArn;
    }

    if (testName === 'MediaCapture' || testName === 'Transcription') {
      this.region = this.payload.region;
    }

    if (['Video', 'Audio'].includes(testName)) {
      this.url = this.getTransformedURL(this.url, 'attendee-presence-timeout-ms', 5000);
      // Allows us to easily treat unexpected reconnects as failures
      this.url = this.getTransformedURL(this.url, 'abort-on-reconnect', 'true');
      this.url = this.getTransformedURL(this.url, 'fatal', '1');
    }

    this.originalURL = this.url;
    this.testReady = false;
    this.testFinish = false;
    if(kiteConfig.capabilities.platform == 'IOS' || kiteConfig.capabilities.platform == 'ANDROID') {
      this.testName = 'Mobile_'+testName;
    }
    else {
      this.testName = testName;
    }
    this.useSimulcast = !!this.payload.useSimulcast;
    this.cwNamespaceInfix = this.payload.cwNamespaceInfix || '';

    if (this.useSimulcast) {
      this.testName += 'Simulcast';
    }
    this.useVideoProcessor = !!this.payload.useVideoProcessor;
    if (this.useVideoProcessor) {
      this.testName += 'Processor';
    }
    if(process.env.STAGE !== undefined) {
      if(this.cwNamespaceInfix !== '')  {
        this.capabilities['name'] = `${this.testName}-${this.cwNamespaceInfix}-${process.env.TEST_TYPE}-${process.env.STAGE}`;
      } else  {
        this.capabilities['name'] = `${this.testName}-${process.env.TEST_TYPE}-${process.env.STAGE}`;
      }
    } else  {
      if(this.cwNamespaceInfix !== '')  {
        this.capabilities['name'] = `${this.testName}-${this.cwNamespaceInfix}-${process.env.TEST_TYPE}`;
      } else  {
        this.capabilities['name'] = `${this.testName}-${process.env.TEST_TYPE}`;
      }
    }
    this.seleniumSessions = [];
    this.timeout = this.payload.testTimeout ? this.payload.testTimeout : 60;
    if (this.numberOfParticipant > 1) {
      this.io.emit('test_name', this.testName);
      this.io.emit('test_capabilities', this.capabilities);
      this.io.on('all_clients_ready', isReady => {
        this.testReady = !!isReady;
      });
      this.io.on('remote_video_on', (id) => {
        console.log(`[${id}] turned on video`);
        this.numVideoRemoteOn += 1;
        this.numVideoRemoteOff = Math.max(1, this.numVideoRemoteOff - 1);
      });
      this.io.on('remote_video_off', (id) => {
        console.log(`[${id}] turned off video`);
        this.numVideoRemoteOff += 1;
        this.numVideoRemoteOn = Math.max(1, this.numVideoRemoteOn - 1);
      });
      this.io.on('video_check_completed_by_other_participants', (id) => {
        console.log(`[${id}] completed video checks`);
        this.numOfParticipantsCompletedVideoCheck += 1;
      });
      this.io.on('audio_check_completed_by_other_participants', (id) => {
        console.log(`[${id}] completed audio checks`);
        this.numOfParticipantsCompletedAudioCheck += 1;
      });
      this.io.on('remote_audio_on', (id) => {
        console.log(`[${id}] turned on audio`);
        this.numRemoteAudioOn += 1;
        this.numRemoteAudioOff = Math.max(1, this.numRemoteAudioOff - 1);
      });
      this.io.on('remote_audio_off', (id) => {
        console.log(`[${id}] turned off audio`);
        this.numRemoteAudioOff += 1;
        this.numRemoteAudioOn = Math.max(1, this.numRemoteAudioOn - 1);
      });
      this.io.on('failed', () => {
        console.log('[OTHER_PARTICIPANT] test failed, quitting...');
        this.remoteFailed = true;
      });
      this.io.on('participant_count', count => {
        console.log('Number of participants on the meeting: ' + count);
        this.numRemoteJoined = count;
      });
      this.io.on('meeting_created', meetingId => {
        this.meetingCreated = true;
        this.meetingTitle = meetingId;
        this.url = this.getTransformedURL(this.originalURL, 'm', this.meetingTitle);
      });
      this.io.on('finished', () => {
        this.testFinish = true;
      });
    }
  }