How to use pc1 method in wpt

Best JavaScript code snippet using wpt

PlanningCalendar.spec.js

Source:PlanningCalendar.spec.js Github

copy

Full Screen

1/*global describe,it,element,by,takeScreenshot,expect*/2describe("sap.m.PlanningCalendar", function() {3 "use strict";4 /*5 1. 26836 */7 it("should render the whole page", function() {8 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("hours_page");9 });10 /*11 2. 268312 */13 it("should render page under 1024px width", function() {14 element(by.id("select_width-label")).click();15 element(by.id("select_width_item_3")).click();16 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("hours_page_under_1024px_width");17 });18 /*19 3. 267520 */21 it("should render page between 600 px and 1024px width", function() {22 element(by.id("select_width-label")).click();23 element(by.id("select_width_item_2")).click();24 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("hours_page_between_6001024px_width");25 });26 /*27 4. 267528 */29 it("should render page under 600px width", function() {30 element(by.id("select_width-label")).click();31 element(by.id("select_width_item_1")).click();32 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("hours_page_under_600px_width");33 });34 /*35 5. 267736 */37 it("should render the whole days page", function() {38 element(by.id("PC1-IntType")).click();39 element(by.id("PC1-1")).click();40 element(by.id("select_width-label")).click();41 element(by.id("select_width_item_0")).click();42 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("days_page");43 });44 /*45 6. 267746 */47 it("should render days page under 1024px width", function() {48 element(by.id("select_width-label")).click();49 element(by.id("select_width_item_3")).click();50 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("days_page_under_1024px_width");51 });52 /*53 7. 267854 */55 it("should render days page between 600 px and 1024px width", function() {56 element(by.id("select_width-label")).click();57 element(by.id("select_width_item_2")).click();58 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("days_page_between_6001024px_width");59 });60 /*61 8. 267862 */63 it("should render days page under 600px width", function() {64 element(by.id("select_width-label")).click();65 element(by.id("select_width_item_1")).click();66 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("days_page_under_600px_width");67 });68 /*69 9. 268670 */71 it("should render the whole months page", function() {72 element(by.id("PC1-IntType")).click();73 element(by.id("PC1-2")).click();74 element(by.id("select_width-label")).click();75 element(by.id("select_width_item_0")).click();76 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("months_page");77 });78 /*79 10. 268680 */81 it("should render months page under 1024px width", function() {82 element(by.id("select_width-label")).click();83 element(by.id("select_width_item_3")).click();84 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("months_page_under_1024px_width");85 });86 /*87 11. 268788 */89 it("should render months page between 600 px and 1024px width", function() {90 element(by.id("select_width-label")).click();91 element(by.id("select_width_item_2")).click();92 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("months_page_between_6001024px_width");93 });94 /*95 12. 268896 */97 it("should render months page under 600px width", function() {98 element(by.id("select_width-label")).click();99 element(by.id("select_width_item_1")).click();100 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("months_page_under_600px_width");101 });102 /*103 13. 2695104 */105 it("should render the whole 1week page", function() {106 element(by.id("PC1-IntType")).click();107 element(by.id("PC1-3")).click();108 element(by.id("select_width-label")).click();109 element(by.id("select_width_item_0")).click();110 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("1week_page");111 });112 /*113 14. 2695114 */115 it("should render 1week page under 1024px width", function() {116 element(by.id("select_width-label")).click();117 element(by.id("select_width_item_3")).click();118 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("1week_page_under_1024px_width");119 });120 /*121 15. 2696122 */123 it("should render 1week page between 600 px and 1024px width", function() {124 element(by.id("select_width-label")).click();125 element(by.id("select_width_item_2")).click();126 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("1week_page_between_6001024px_width");127 });128 /*129 16. 2696130 */131 it("should render 1week page under 600px width", function() {132 element(by.id("select_width-label")).click();133 element(by.id("select_width_item_1")).click();134 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("1week_page_under_600px_width");135 });136 /*137 17. 2702138 */139 it("should render the whole 1month page", function() {140 element(by.id("PC1-IntType")).click();141 element(by.id("PC1-4")).click();142 element(by.id("select_width-label")).click();143 element(by.id("select_width_item_0")).click();144 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("1month_page");145 });146 /*147 18. 2702148 */149 it("should render 1month page under 1024px width", function() {150 element(by.id("select_width-label")).click();151 element(by.id("select_width_item_3")).click();152 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("1month_page_under_1024px_width");153 });154 /*155 19. 2703156 */157 it("should render 1month page between 600 px and 1024px width", function() {158 element(by.id("select_width-label")).click();159 element(by.id("select_width_item_2")).click();160 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("1month_page_between_6001024px_width");161 });162 /*163 20. 2703164 */165 it("should render 1month page under 600px width", function() {166 element(by.id("select_width-label")).click();167 element(by.id("select_width_item_1")).click();168 expect(takeScreenshot(element(by.id("page1-cont")))).toLookAs("1month_page_under_600px_width");169 });170 /*171 Back and next button functionality172 */173 /*174 21. 2670175 */176 it("should check that back/next button is working properly on hours view", function() {177 element(by.id("select_width-label")).click();178 element(by.id("select_width_item_0")).click();179 element(by.id("PC1-IntType")).click();180 element(by.id("PC1-0")).click();181 element(by.id("PC1-TimeInt--Head-prev")).click();182 expect(takeScreenshot(element(by.id("PC1-TimeInt--TimesRow")))).toLookAs("back_button_hours_view");183 element(by.id("PC1-TimeInt--Head-next")).click();184 expect(takeScreenshot(element(by.id("PC1-TimeInt--TimesRow")))).toLookAs("next_button_hours_view");185 });186 /*187 22. 2680188 */189 it("should check that back/next button is working properly on days view", function() {190 element(by.id("PC1-IntType")).click();191 element(by.id("PC1-1")).click();192 element(by.id("PC1-DateInt--Head-prev")).click();193 expect(takeScreenshot(element(by.id("PC1-DateInt--Month0")))).toLookAs("back_button_days_view");194 element(by.id("PC1-DateInt--Head-next")).click();195 expect(takeScreenshot(element(by.id("PC1-DateInt--Month0")))).toLookAs("next_button_days_view");196 });197 /*198 23. 2689199 */200 it("should check that back/next button is working properly on months view", function() {201 element(by.id("PC1-IntType")).click();202 element(by.id("PC1-2")).click();203 element(by.id("PC1-MonthInt--Head-prev")).click();204 expect(takeScreenshot(element(by.id("PC1-MonthInt--MonthsRow")))).toLookAs("back_button_months_view");205 element(by.id("PC1-MonthInt--Head-next")).click();206 expect(takeScreenshot(element(by.id("PC1-MonthInt--MonthsRow")))).toLookAs("next_button_months_view");207 });208 /*209 24. 2697210 */211 it("should check that back/next button is working properly on 1week view", function() {212 element(by.id("PC1-IntType")).click();213 element(by.id("PC1-3")).click();214 element(by.id("PC1-WeekInt--Head-prev")).click();215 expect(takeScreenshot(element(by.id("PC1-WeekInt--Month0")))).toLookAs("back_button_1week_view");216 element(by.id("PC1-WeekInt--Head-next")).click();217 expect(takeScreenshot(element(by.id("PC1-WeekInt--Month0")))).toLookAs("next_button_1week_view");218 });219 /*220 25. 2704221 */222 it("should check that back/next button is working properly on 1month view", function() {223 element(by.id("PC1-IntType")).click();224 element(by.id("PC1-4")).click();225 element(by.id("PC1-OneMonthInt--Head-prev")).click();226 expect(takeScreenshot(element(by.id("PC1-OneMonthInt--Month0")))).toLookAs("back_button_1month_view");227 element(by.id("PC1-OneMonthInt--Head-next")).click();228 expect(takeScreenshot(element(by.id("PC1-OneMonthInt--Month0")))).toLookAs("next_button_1month_view");229 });230 /*231 ----------------------------------------------------------------- Calendar control ---------------------------------------------------------------------------------232 ||233 \/234 */235 /*236 26. Popups on hours,days,months,1week,1month on 100% screensize237 */238 it("should check that date,month,year picker work properly on hours view", function() {239 element(by.id("PC1-IntType")).click();240 element(by.id("PC1-0")).click();241 element(by.id("PC1-TimeInt--Head-B1")).click();242 expect(takeScreenshot(element(by.id("PC1-TimeInt--Cal")))).toLookAs("datepicker_hours_view");243 element(by.id("PC1-TimeInt--Cal--Head-B1")).click();244 expect(takeScreenshot(element(by.id("PC1-TimeInt--Cal")))).toLookAs("monthpicker_hours_view");245 element(by.id("PC1-TimeInt--Cal--Head-B2")).click();246 expect(takeScreenshot(element(by.id("PC1-TimeInt--Cal")))).toLookAs("yearpicker_hours_view");247 element(by.id("inputFocusHelper")).click(); //clean up - make sure no popups are opened248 });249 it("should check that date,month,year picker work properly on days view", function() {250 element(by.id("PC1-IntType")).click();251 element(by.id("PC1-1")).click();252 element(by.id("PC1-DateInt--Head-B1")).click();253 expect(takeScreenshot(element(by.id("PC1-DateInt--Cal")))).toLookAs("datepicker_days_view");254 element(by.id("PC1-DateInt--Cal--Head-B1")).click();255 expect(takeScreenshot(element(by.id("PC1-DateInt--Cal")))).toLookAs("monthpicker_days_view");256 element(by.id("PC1-DateInt--Cal--Head-B2")).click();257 expect(takeScreenshot(element(by.id("PC1-DateInt--Cal")))).toLookAs("yearpicker_days_view");258 element(by.id("inputFocusHelper")).click(); //clean up - make sure no popups are opened259 });260 it("should check infotoolbar for months view that is rendering properly", function() {261 element(by.id("PC1-IntType")).click();262 element(by.id("PC1-2")).click();263 element(by.id("PC1-MonthInt--Head-B2")).click();264 expect(takeScreenshot(element(by.id("PC1-MonthInt--Cal")))).toLookAs("yearpicker_months_view");265 element(by.id("inputFocusHelper")).click(); //clean up - make sure no popups are opened266 });267 it("should check infotoolbar for 1week view that is rendering properly", function() {268 element(by.id("PC1-IntType")).click();269 element(by.id("PC1-3")).click();270 element(by.id("PC1-WeekInt--Head-B1")).click();271 expect(takeScreenshot(element(by.id("PC1-WeekInt--Cal")))).toLookAs("datepicker_1week_view");272 element(by.id("PC1-WeekInt--Cal--Head-B1")).click();273 expect(takeScreenshot(element(by.id("PC1-WeekInt--Cal")))).toLookAs("monthpicker_1week_view");274 element(by.id("PC1-WeekInt--Cal--Head-B2")).click();275 expect(takeScreenshot(element(by.id("PC1-WeekInt--Cal")))).toLookAs("yearpicker_1week_view");276 element(by.id("inputFocusHelper")).click(); //clean up - make sure no popups are opened277 });278 it("should check infotoolbar for 1month view that is rendering properly", function () {279 element(by.id("PC1-IntType")).click();280 element(by.id("PC1-4")).click();281 element(by.id("PC1-OneMonthInt--Head-B1")).click();282 expect(takeScreenshot(element(by.id("PC1-OneMonthInt--Cal")))).toLookAs("monthpicker_1month_view");283 element(by.id("PC1-OneMonthInt--Cal--Head-B2")).click();284 expect(takeScreenshot(element(by.id("PC1-OneMonthInt--Cal")))).toLookAs("yearpicker_1month_view");285 element(by.id("inputFocusHelper")).click(); //clean up - make sure no popups are opened286 });287 /*288 27. Popups on hours,days,months,1week,1month on < 600px screensize289 */290 it("should check that date,month,year picker work properly on hours view", function() {291 element(by.id("PC1-IntType")).click();292 element(by.id("PC1-0")).click();293 element(by.id("select_width-label")).click();294 element(by.id("select_width_item_1")).click();295 element(by.id("PC1-TimeInt--Head-B1")).click();296 expect(takeScreenshot(element(by.id("PC1-TimeInt--Cal")))).toLookAs("dayview_on_hoursview");297 element(by.id("PC1-TimeInt--Cal--Head-B1")).click();298 expect(takeScreenshot(element(by.id("PC1-TimeInt--Cal")))).toLookAs("monthview_on_hoursview");299 element(by.id("PC1-TimeInt--Cal--Head-B2")).click();300 expect(takeScreenshot(element(by.id("PC1-TimeInt--Cal")))).toLookAs("yearview_on_hoursview");301 element(by.id("inputFocusHelper")).click(); //clean up - make sure no popups are opened302 });303 it("should check that month and year view work properly on days view", function () {304 element(by.id("PC1-IntType")).click();305 element(by.id("PC1-1")).click();306 element(by.id("PC1-DateInt--Head-B1")).click();307 expect(takeScreenshot(element(by.id("PC1-DateInt--Cal")))).toLookAs("dayview_on_days_view");308 element(by.id("PC1-DateInt--Cal--Head-B1")).click();309 expect(takeScreenshot(element(by.id("PC1-DateInt--Cal")))).toLookAs("monthview_on_days_view");310 element(by.id("PC1-DateInt--Cal--Head-B2")).click();311 expect(takeScreenshot(element(by.id("PC1-DateInt--Cal")))).toLookAs("yearview_on_days_view");312 element(by.id("inputFocusHelper")).click(); //clean up - make sure no popups are opened313 });314 it("should check yearview on months view that is rendering properly", function () {315 element(by.id("PC1-IntType")).click();316 element(by.id("PC1-2")).click();317 element(by.id("PC1-MonthInt--Head-B2")).click();318 expect(takeScreenshot(element(by.id("PC1-MonthInt--Cal")))).toLookAs("yearView_on_monthview");319 element(by.id("inputFocusHelper")).click(); //clean up - make sure no popups are opened320 });321 it("should check infotoolbar for 1week view that is rendering properly", function() {322 element(by.id("PC1-IntType")).click();323 element(by.id("PC1-3")).click();324 element(by.id("PC1-WeekInt--Head-B1")).click();325 expect(takeScreenshot(element(by.id("PC1-WeekInt--Cal")))).toLookAs("dayview_1week_view");326 element(by.id("PC1-WeekInt--Cal--Head-B1")).click();327 expect(takeScreenshot(element(by.id("PC1-WeekInt--Cal")))).toLookAs("monthview_on_1week_view");328 element(by.id("PC1-WeekInt--Cal--Head-B2")).click();329 expect(takeScreenshot(element(by.id("PC1-WeekInt--Cal")))).toLookAs("yearview_on_1week_view");330 element(by.id("inputFocusHelper")).click(); //clean up - make sure no popups are opened331 });332 it("should check infotoolbar for 1month view that is rendering properly", function () {333 element(by.id("PC1-IntType")).click();334 element(by.id("PC1-4")).click();335 element(by.id("PC1-OneMonthInt--Head-B1")).click();336 expect(takeScreenshot(element(by.id("PC1-OneMonthInt--Cal")))).toLookAs("monthview_on_1month_view");337 element(by.id("PC1-OneMonthInt--Cal--Head-B2")).click();338 expect(takeScreenshot(element(by.id("PC1-OneMonthInt--Cal")))).toLookAs("yearview_on_1month_view");339 element(by.id("inputFocusHelper")).click(); //clean up - make sure no popups are opened340 });341 /*342 /\343 ||344 ----------------------------------------------------------------- Calendar control ---------------------------------------------------------------------------------345 */346 /*347 Today button's functionality348 */349 /*350 28. 2676351 */352 it("should render hour's today button under 600px width", function() {353 element(by.id("PC1-IntType")).click();354 element(by.id("PC1-0")).click();355 element(by.id("page1-cont")).click();356 element(by.id("PC1-Today")).click();357 expect(takeScreenshot(element(by.id("PC1-Today")))).toLookAs("hours_today_button");358 });359 /*360 29. 2685361 */362 it("should render days' today button under 600px width", function() {363 element(by.id("PC1-IntType")).click();364 element(by.id("PC1-1")).click();365 element(by.id("page1-cont")).click();366 element(by.id("PC1-Today")).click();367 expect(takeScreenshot(element(by.id("PC1-Today")))).toLookAs("days_today_button");368 });369 /*370 30. 2693371 */372 it("should render months today button under 600px width", function() {373 element(by.id("PC1-IntType")).click();374 element(by.id("PC1-2")).click();375 element(by.id("page1-cont")).click();376 element(by.id("PC1-Today")).click();377 expect(takeScreenshot(element(by.id("PC1-Today")))).toLookAs("months_today_button");378 });379 /*380 31. 2701381 */382 it("should render 1week today button under 600px width", function() {383 element(by.id("PC1-IntType")).click();384 element(by.id("PC1-3")).click();385 element(by.id("page1-cont")).click();386 element(by.id("PC1-Today")).click();387 expect(takeScreenshot(element(by.id("PC1-Today")))).toLookAs("1week_today_button");388 });389 /*390 32. 2708391 */392 it("should render 1month today button under 600px width", function() {393 element(by.id("PC1-IntType")).click();394 element(by.id("PC1-4")).click();395 element(by.id("page1-cont")).click();396 element(by.id("PC1-Today")).click();397 expect(takeScreenshot(element(by.id("PC1-Today")))).toLookAs("1month_today_button");398 });...

Full Screen

Full Screen

connection.js

Source:connection.js Github

copy

Full Screen

1/*2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.3 *4 * Use of this source code is governed by a BSD-style license5 * that can be found in the LICENSE file in the root of the source6 * tree.7 */8 /* eslint-env node */9'use strict';10describe('establishes a connection', () => {11 let pc1;12 let pc2;13 function noop() {}14 function throwError(err) {15 console.error(err.toString());16 throw err;17 }18 function negotiate(pc, otherPc) {19 return pc.createOffer()20 .then(function(offer) {21 return pc.setLocalDescription(offer);22 }).then(function() {23 return otherPc.setRemoteDescription(pc.localDescription);24 }).then(function() {25 return otherPc.createAnswer();26 }).then(function(answer) {27 return otherPc.setLocalDescription(answer);28 }).then(function() {29 return pc.setRemoteDescription(otherPc.localDescription);30 });31 }32 beforeEach(() => {33 pc1 = new RTCPeerConnection(null);34 pc2 = new RTCPeerConnection(null);35 pc1.onicecandidate = event => pc2.addIceCandidate(event.candidate);36 pc2.onicecandidate = event => pc1.addIceCandidate(event.candidate);37 });38 afterEach(() => {39 pc1.close();40 pc2.close();41 });42 it('with legacy callbacks', (done) => {43 pc1.onicecandidate = function(event) {44 pc2.addIceCandidate(event.candidate, noop, throwError);45 };46 pc2.onicecandidate = function(event) {47 pc1.addIceCandidate(event.candidate, noop, throwError);48 };49 pc1.oniceconnectionstatechange = function() {50 if (pc1.iceConnectionState === 'connected' ||51 pc1.iceConnectionState === 'completed') {52 done();53 }54 };55 var constraints = {video: true};56 navigator.mediaDevices.getUserMedia(constraints)57 .then(function(stream) {58 pc1.addStream(stream);59 pc1.createOffer(60 function(offer) {61 pc1.setLocalDescription(offer,62 function() {63 pc2.setRemoteDescription(offer,64 function() {65 pc2.createAnswer(66 function(answer) {67 pc2.setLocalDescription(answer,68 function() {69 pc1.setRemoteDescription(answer, noop, throwError);70 },71 throwError72 );73 },74 throwError75 );76 },77 throwError78 );79 },80 throwError81 );82 },83 throwError84 );85 });86 });87 it('with promises', (done) => {88 pc1.oniceconnectionstatechange = function() {89 if (pc1.iceConnectionState === 'connected' ||90 pc1.iceConnectionState === 'completed') {91 done();92 }93 };94 var constraints = {video: true};95 navigator.mediaDevices.getUserMedia(constraints)96 .then(function(stream) {97 pc1.addStream(stream);98 return negotiate(pc1, pc2);99 })100 .catch(throwError);101 });102 it('with streams in both directions', (done) => {103 pc1.oniceconnectionstatechange = function() {104 if (pc1.iceConnectionState === 'connected' ||105 pc1.iceConnectionState === 'completed') {106 done();107 }108 };109 var constraints = {video: true};110 navigator.mediaDevices.getUserMedia(constraints)111 .then(function(stream) {112 pc1.addStream(stream);113 pc2.addStream(stream);114 return negotiate(pc1, pc2);115 })116 .catch(throwError);117 });118 describe('with addTrack', () => {119 it('and all tracks of a stream', (done) => {120 pc1.oniceconnectionstatechange = function() {121 if (pc1.iceConnectionState === 'connected' ||122 pc1.iceConnectionState === 'completed') {123 done();124 }125 };126 pc2.onaddstream = function(event) {127 expect(event).to.have.property('stream');128 expect(event.stream.getAudioTracks()).to.have.length(1);129 expect(event.stream.getVideoTracks()).to.have.length(1);130 };131 var constraints = {audio: true, video: true};132 navigator.mediaDevices.getUserMedia(constraints)133 .then(function(stream) {134 stream.getTracks().forEach(function(track) {135 pc1.addTrack(track, stream);136 });137 return negotiate(pc1, pc2);138 })139 .catch(throwError);140 });141 it('but only the audio track of an av stream', (done) => {142 pc1.oniceconnectionstatechange = function() {143 if (pc1.iceConnectionState === 'connected' ||144 pc1.iceConnectionState === 'completed') {145 done();146 }147 };148 pc2.onaddstream = function(event) {149 expect(event).to.have.property('stream');150 expect(event.stream.getAudioTracks()).to.have.length(1);151 expect(event.stream.getVideoTracks()).to.have.length(0);152 };153 var constraints = {audio: true, video: true};154 navigator.mediaDevices.getUserMedia(constraints)155 .then(function(stream) {156 stream.getAudioTracks().forEach(function(track) {157 pc1.addTrack(track, stream);158 });159 return negotiate(pc1, pc2);160 })161 .catch(throwError);162 });163 it('as two streams', (done) => {164 let streams = [];165 pc1.oniceconnectionstatechange = function() {166 if (pc1.iceConnectionState === 'connected' ||167 pc1.iceConnectionState === 'completed') {168 expect(streams).to.have.length(2);169 done();170 }171 };172 pc2.onaddstream = function(event) {173 expect(event).to.have.property('stream');174 expect(event.stream.getTracks()).to.have.length(1);175 streams.push(event.stream);176 };177 var constraints = {audio: true, video: true};178 navigator.mediaDevices.getUserMedia(constraints)179 .then(function(stream) {180 var audioStream = new MediaStream(stream.getAudioTracks());181 var videoStream = new MediaStream(stream.getVideoTracks());182 audioStream.getTracks().forEach(function(track) {183 pc1.addTrack(track, audioStream);184 });185 videoStream.getTracks().forEach(function(track) {186 pc1.addTrack(track, videoStream);187 });188 return negotiate(pc1, pc2);189 })190 .catch(throwError);191 });192 });193 it('with no explicit end-of-candidates', function(done) {194 pc1.oniceconnectionstatechange = function() {195 if (pc1.iceConnectionState === 'connected' ||196 pc1.iceConnectionState === 'completed') {197 done();198 }199 };200 pc1.onicecandidate = (event) => {201 if (event.candidate) {202 pc2.addIceCandidate(event.candidate, noop, throwError);203 }204 };205 pc2.onicecandidate = (event) => {206 if (event.candidate) {207 pc1.addIceCandidate(event.candidate, noop, throwError);208 }209 };210 var constraints = {video: true};211 navigator.mediaDevices.getUserMedia(constraints)212 .then(function(stream) {213 stream.getTracks().forEach(function(track) {214 pc1.addTrack(track, stream);215 });216 return negotiate(pc1, pc2);217 })218 .catch(throwError);219 });220 describe('with datachannel', function() {221 it('establishes a connection', (done) => {222 pc1.oniceconnectionstatechange = function() {223 if (pc1.iceConnectionState === 'connected' ||224 pc1.iceConnectionState === 'completed') {225 done();226 }227 };228 pc1.createDataChannel('foo');229 negotiate(pc1, pc2)230 .catch(throwError);231 });232 });233 it('and calls the video loadedmetadata', (done) => {234 pc2.addEventListener('addstream', function(e) {235 var v = document.createElement('video');236 v.autoplay = true;237 v.addEventListener('loadedmetadata', function() {238 done();239 });240 v.srcObject = e.stream;241 });242 var constraints = {video: true};243 navigator.mediaDevices.getUserMedia(constraints)244 .then(function(stream) {245 stream.getTracks().forEach(function(track) {246 pc1.addTrack(track, stream);247 });248 return negotiate(pc1, pc2);249 })250 .catch(throwError);251 });252 it('and triggers the connectionstatechange event', (done) => {253 pc1.onconnectionstatechange = function() {254 if (pc1.connectionState === 'connected') {255 done();256 }257 };258 var constraints = {video: true};259 navigator.mediaDevices.getUserMedia(constraints)260 .then(function(stream) {261 pc1.addStream(stream);262 return negotiate(pc1, pc2);263 })264 .catch(throwError);265 });...

Full Screen

Full Screen

events.js

Source:events.js Github

copy

Full Screen

1const iceConfig = {2 iceServers: [3 { urls: 'stun:stun.l.google.com:19302' }4 ]5}6var pc1 = new RTCPeerConnection(iceConfig)7var pc2 = new RTCPeerConnection(iceConfig)8pc1.pcname = "pc1"9pc2.pcname = "pc2"10function eventSnitcher (event) {11 console.warn(`=== ${event.target.pcname}: ${event.type} ===`)12}13// events of RTCPeerConnection14pc1.onconnectionstatechange = eventSnitcher15pc1.ondatachannel = eventSnitcher16pc1.onicecandidate = eventSnitcher17pc1.oniceconnectionstatechange = eventSnitcher18pc1.onicegatheringstatechange = eventSnitcher19pc1.onidentityresult = eventSnitcher20pc1.onidpassertionerror = eventSnitcher21pc1.onidpvalidationerror = eventSnitcher22pc1.onnegotiationneeded = eventSnitcher23pc1.onpeeridentity = eventSnitcher24pc1.onremovestream = eventSnitcher25pc1.onsignalingstatechange = eventSnitcher26pc1.ontrack = eventSnitcher27pc2.onconnectionstatechange = eventSnitcher28pc2.ondatachannel = eventSnitcher29pc2.onicecandidate = eventSnitcher30pc2.oniceconnectionstatechange = eventSnitcher31pc2.onicegatheringstatechange = eventSnitcher32pc2.onidentityresult = eventSnitcher33pc2.onidpassertionerror = eventSnitcher34pc2.onidpvalidationerror = eventSnitcher35pc2.onnegotiationneeded = eventSnitcher36pc2.onpeeridentity = eventSnitcher37pc2.onremovestream = eventSnitcher38pc2.onsignalingstatechange = eventSnitcher39pc2.ontrack = eventSnitcher40navigator.mediaDevices.getUserMedia({video: false, audio: true})...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3wpt.runTest(url, function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});7var wpt = require('webpagetest');8var wpt = new WebPageTest('www.webpagetest.org');9wpt.runTest(url, { location: 'Dulles_IE9' }, function(err, data) {10 if (err) return console.error(err);11 console.log(data);12});13var wpt = require('webpagetest');14var wpt = new WebPageTest('www.webpagetest.org');15wpt.runTest(url, { location: 'Dulles_IE9' }, function(err, data) {16 if (err) return console.error(err);17 console.log(data);18});19var wpt = require('webpagetest');20var wpt = new WebPageTest('www.webpagetest.org');21wpt.runTest(url, { location: 'Dulles_IE9' }, function(err, data) {22 if (err) return console.error(err);23 console.log(data);24});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var test = wpt('www.webpagetest.org');3}, function(err, data) {4 if (err) return console.error(err);5 console.log(data);6});7var wpt = require('webpagetest');8var test = wpt('www.webpagetest.org');9}, function(err, data) {10 if (err) return console.error(err);11 console.log(data);12});13var wpt = require('webpagetest');14var test = wpt('www.webpagetest.org');15}, function(err, data) {16 if (err) return console.error(err);17 console.log(data);18});19var wpt = require('webpagetest');20var test = wpt('www.webpagetest.org');21}, function(err, data) {22 if (err) return console.error(err);23 console.log(data);24});25var wpt = require('webpagetest');26var test = wpt('www.webpagetest.org');

Full Screen

Using AI Code Generation

copy

Full Screen

1var pc1 = require('wpt').pc1;2 if (err) {3 console.log(err);4 } else {5 console.log(data);6 }7});8var pc2 = require('wpt').pc2;9 if (err) {10 console.log(err);11 } else {12 console.log(data);13 }14});15var pc3 = require('wpt').pc3;16 if (err) {17 console.log(err);18 } else {19 console.log(data);20 }21});22var pc4 = require('wpt').pc4;23 if (err) {24 console.log(err);25 } else {26 console.log(data);27 }28});29var pc5 = require('wpt').pc5;30 if (err) {31 console.log(err);32 } else {33 console.log(data);34 }35});36var pc6 = require('wpt').pc6;37 if (err) {38 console.log(err);39 } else {40 console.log(data);41 }42});43var pc7 = require('wpt').pc7;44 if (err) {45 console.log(err);46 } else {47 console.log(data);48 }49});50var pc8 = require('wpt').pc8;51 if (err) {52 console.log(err);53 } else {54 console.log(data);55 }56});57var pc9 = require('wpt').pc

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var pc1 = wpt('www.webpagetest.org');3 console.log(data);4});5var wpt = require('webpagetest');6var pc2 = wpt('www.webpagetest.org');7 console.log(data);8});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptc = require('wptc');2var pc1 = wptc.pc1;3 if (err) {4 console.log(err);5 } else {6 console.log(result);7 }8});9var wptc = require('wptc');10var pc2 = wptc.pc2;11 if (err) {12 console.log(err);13 } else {14 console.log(result);15 }16});17var wptc = require('wptc');18var pc3 = wptc.pc3;19 if (err) {20 console.log(err);21 } else {22 console.log(result);23 }24});25var wptc = require('wptc');26var pc4 = wptc.pc4;27 if (err) {28 console.log(err);29 } else {30 console.log(result);31 }32});33var wptc = require('wptc');34var pc5 = wptc.pc5;35 if (err) {36 console.log(err);37 } else {38 console.log(result);39 }40});41var wptc = require('wptc');42var pc6 = wptc.pc6;43 if (err) {44 console.log(err);45 } else {46 console.log(result);47 }48});49var wptc = require('wptc');50var pc7 = wptc.pc7;51 if (err) {52 console.log(err);53 } else {54 console.log(result);55 }56});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new Wpt();3var pc1 = wpt.pc1();4var wpt = require('wpt');5var wpt = new Wpt();6var pc2 = wpt.pc2();7var wpt = require('wpt');8var wpt = new Wpt();9var pc3 = wpt.pc3();10var wpt = require('wpt');11var wpt = new Wpt();12var pc4 = wpt.pc4();13var wpt = require('wpt');14var wpt = new Wpt();15var pc5 = wpt.pc5();16var wpt = require('wpt');17var wpt = new Wpt();18var pc6 = wpt.pc6();19var wpt = require('wpt');20var wpt = new Wpt();21var pc7 = wpt.pc7();22var wpt = require('wpt');23var wpt = new Wpt();24var pc8 = wpt.pc8();25var wpt = require('wpt');26var wpt = new Wpt();27var pc9 = wpt.pc9();28var wpt = require('wpt');29var wpt = new Wpt();30var pc10 = wpt.pc10();31var wpt = require('wpt');32var wpt = new Wpt();33var pc11 = wpt.pc11();34var wpt = require('wpt');35var wpt = new Wpt();36var pc12 = wpt.pc12();37var wpt = require('wpt');38var wpt = new Wpt();39var pc13 = wpt.pc13();

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var test = new wpt('www.webpagetest.org', 'A.1f2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p');3 if (err) {4 console.log('Error: ' + err);5 } else {6 console.log('Test submitted. View your test at: ' + data.data.userUrl);7 }8});9var wpt = require('webpagetest');10var test = new wpt('www.webpagetest.org', 'A.1f2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p');11 if (err) {12 console.log('Error: ' + err);13 } else {14 console.log('Test submitted. View your test at: ' + data.data.userUrl);15 }16});17var wpt = require('webpagetest');18var test = new wpt('www.webpagetest.org', 'A.1f2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p');19 if (err) {20 console.log('Error: ' + err);21 } else {22 console.log('Test submitted. View your test at: ' + data.data.userUrl);23 }24});25var wpt = require('webpagetest');26var test = new wpt('www.webpagetest.org', 'A.1f2b3c4d5e6f7g8h9i0j1k2l3m4n5o6

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful