How to use createRecord method in Playwright Internal

Best JavaScript code snippet using playwright-internal

study-test.js

Source:study-test.js Github

copy

Full Screen

...5 // Specify the other units that are required for this test.6 needs: ['model:government', 'model:promise', 'model:area', 'model:bill', 'model:phase', 'model:priority', 'model:justification'],7 loadData: function(store){8 Ember.run.begin();9 let gov = store.createRecord('government', {'name': 'Bachelet-2014-2018'});10 let estudio = store.createRecord('study',{"version":"marzo","year":"2016", "government": gov});11 let area_1 = store.createRecord('area',{'id': 'a1', 'name':'area 01'});12 let area_2 = store.createRecord('area',{'id': 'a2', 'name':'area 02'});13 let pl1 = store.createRecord('bill',{'id':'pl1', 'name':'name01','title':'title01', 'fullfilment':'100%' });14 store.createRecord('priority', {'name':'simple', 'count': 10, 'bill': pl1});15 store.createRecord('priority', {'name':'suma', 'count': 11, 'bill': pl1});16 store.createRecord('priority', {'name':'inmediata', 'count': 12, 'bill': pl1});17 let pl2 = store.createRecord('bill',{'id':'pl2', 'name':'name02', 'title':'title02', 'fullfilment':'40%'});18 store.createRecord('priority', {'name':'simple', 'count': 10, 'bill': pl2});19 store.createRecord('priority', {'name':'suma', 'count': 11, 'bill': pl2});20 store.createRecord('priority', {'name':'inmediata', 'count': 12, 'bill': pl2});21 let pl3 = store.createRecord('bill',{'id':'pl3', 'name':'name03', 'title':'title03', 'fullfilment':'100%'});22 store.createRecord('priority', {'name':'simple', 'count': 11, 'bill': pl3});23 store.createRecord('priority', {'name':'suma', 'count': 11, 'bill': pl3});24 store.createRecord('priority', {'name':'inmediata', 'count': 12, 'bill': pl3});25 let pl4 = store.createRecord('bill',{'id':'pl4', 'name':'name04', 'title':'title04', 'fullfilment':'0%'});26 store.createRecord('promise',{'content':'content01',27 'id':1,28 'number':'1',29 'title':'title01',30 'study': estudio,31 'bills': [pl1, pl3],32 'area':area_1,33 'coherenceLevel': 334 });//Promesa completada35 store.createRecord('promise',{'content':'content02',36 'id':2,37 'number':'2',38 'title':'title02',39 'study': estudio,40 'bills': [pl2,pl4],41 'coherenceLevel': 4,42 'area':area_1});//Promesa no completada43 store.createRecord('promise',{'content':'content03',44 'id':3,45 'number':'3',46 'title':'title03',47 'study': estudio,48 'bills': [pl3],'coherenceLevel': 4,49 'area':area_2});//promesa completada50 let estudio2 = store.createRecord('study',{"version":"marzo","year":"2017", "government": gov});51 let pl5 = store.createRecord('bill',{'id':'pl5', 'name':'name05','title':'title05', 'fullfilment':'0%'});52 let pl6 = store.createRecord('bill',{'id':'pl6', 'name':'name06','title':'title06', 'fullfilment':'0%'});53 store.createRecord('promise',{'content':'content04',54 'id':4,55 'number':'4',56 'title':'title04',57 'study': estudio2,58 'area':area_2,'coherenceLevel': 1,59 'bills':[pl5,pl6]60 });61 store.createRecord('promise',{'content':'content05',62 'id':5,63 'number':'5',64 'title':'title05',65 'study': estudio2,66 'bills': [pl5],'coherenceLevel': 1,67 'area':area_268 });69 store.createRecord('promise',{'content':'content06',70 'id':6,71 'number':'6',72 'title':'title06',73 'study': estudio2,74 'area':area_1});75 Ember.run.end();76 return {'estudio': estudio, 'estudio2': estudio2, 'areas': [area_1, area_2]};77 }78});79test('it exists', function(assert) {80 let model = this.subject();81 // let store = this.store();82 assert.ok(!!model);83});84test('it has attributes', function(assert){85 let estudio = this.subject({'version': 'marzo',86 'year': '2016',87 'filename': 'mishelle-bashelet_marzo-2017.csv',88 'type': 'Programa',89 'image': 'perrito.svg'90 });91 let estudio_json = estudio.toJSON();92 assert.equal(estudio_json.version, 'marzo');93 assert.equal(estudio_json.year, 2016);94 assert.equal(estudio_json.filename, 'mishelle-bashelet_marzo-2017.csv');95 assert.equal(estudio_json.in_landing, false);96 assert.equal(estudio_json.image, 'perrito.svg');97 assert.equal(estudio_json.type, 'Programa');98});99test("study has many promises", function(assert){100 let study = this.store().modelFor('study');101 let relationship = Ember.get(study, 'relationshipsByName').get('promises');102 assert.equal(relationship.key, 'promises');103 assert.equal(relationship.kind, 'hasMany');104});105test("study belongs to government", function(assert){106 let study = this.store().modelFor('study');107 let relationship = Ember.get(study, 'relationshipsByName').get('government');108 assert.equal(relationship.key, 'government');109 assert.equal(relationship.kind, 'belongsTo');110});111test("study has slug attribute", function(assert){112 Ember.run.begin();113 let gov = this.store().createRecord('government', {'name': 'Bachelet-2014-2018'});114 let estudio = this.subject({'version': 'marzo', 'year': '2016'});115 gov.get('studies').pushObject(estudio);116 assert.equal(estudio.get('slug'), 'bachelet-2014-2018_marzo-2016');117 Ember.run.end();118});119test("study has an attr presentanAvance", function(assert){120 let estudio = this.subject({'presentanAvance': 10 });121 assert.equal(estudio.get('presentanAvance'), 10);122});123test("study return nro of finalizadas", function(assert){124 Ember.run.begin();125 let gov = this.store().createRecord('government', {'name': 'Bachelet-2014-2018'});126 let estudio = this.store().createRecord('study',{"version":"marzo","year":"2016"});127 gov.get('studies').pushObject(estudio);128 let promesa_1=this.store().createRecord('promise',{'content':'content01', 'number':'1', 'title':'title01'});129 let promesa_2=this.store().createRecord('promise',{'content':'content02', 'number':'2', 'title':'title02'});130 let pl1 = this.store().createRecord('bill',{'name':'name01', 'title':'title01', 'fullfilment':'100%'});131 let pl2 = this.store().createRecord('bill',{'name':'name02', 'title':'title02', 'fullfilment':'0%'});132 promesa_1.get('bills').pushObject(pl1);133 promesa_2.get('bills').pushObject(pl2);134 estudio.get('promises').pushObject(promesa_1);135 estudio.get('promises').pushObject(promesa_2);136 assert.equal(estudio.get('finalizadas'), 1);137 Ember.run.end();138});139test("study return nro of en desarrollo", function(assert){140 Ember.run.begin();141 let gov = this.store().createRecord('government', {'name': 'Bachelet-2014-2018'});142 let estudio = this.store().createRecord('study',{"version":"marzo","year":"2016"});143 gov.get('studies').pushObject(estudio);144 let promesa_1=this.store().createRecord('promise',{'content':'content01', 'number':'1', 'title':'title01'});145 let promesa_2=this.store().createRecord('promise',{'content':'content02', 'number':'2', 'title':'title02'});146 let promesa_3=this.store().createRecord('promise',{'content':'content03', 'number':'3', 'title':'title03'});147 let pl1 = this.store().createRecord('bill',{'name':'name01', 'title':'title01', 'fullfilment':'100%'});148 let pl2 = this.store().createRecord('bill',{'name':'name02', 'title':'title02', 'fullfilment':'40%'});149 let pl3 = this.store().createRecord('bill',{'name':'name03', 'title':'title03', 'fullfilment':'70%'});150 promesa_1.get('bills').pushObject(pl1);151 promesa_2.get('bills').pushObject(pl2);152 promesa_3.get('bills').pushObject(pl3);153 estudio.get('promises').pushObject(promesa_1);154 estudio.get('promises').pushObject(promesa_2);155 estudio.get('promises').pushObject(promesa_3);156 assert.equal(estudio.get('enDesarrollo'), 2);157 Ember.run.end();158});159test('study return the capacity', function(assert){160 Ember.run.begin();161 let gov = this.store().createRecord('government', {'name': 'Bachelet-2014-2018'});162 let estudio = this.store().createRecord('study',{"version":"marzo","year":"2016"});163 let promesa_1=this.store().createRecord('promise',{'content':'content01', 'number':'1', 'title':'title01', 'coherenceLevel': 3});164 let promesa_2=this.store().createRecord('promise',{'content':'content02', 'number':'2', 'title':'title02', 'coherenceLevel': 2});165 let promesa_3=this.store().createRecord('promise',{'content':'content03', 'number':'3', 'title':'title03', 'coherenceLevel': 4});166 let pl1 = this.store().createRecord('bill',{'name':'name01', 'title':'title01', 'fullfilment':'100%'});167 let pl2 = this.store().createRecord('bill',{'name':'name02', 'title':'title02', 'fullfilment':'40%'});168 let pl3 = this.store().createRecord('bill',{'name':'name03', 'title':'title03', 'fullfilment':'100%'});169 gov.get('studies').pushObject(estudio);170 promesa_1.get('bills').pushObject(pl1);171 promesa_2.get('bills').pushObject(pl2);172 promesa_3.get('bills').pushObject(pl3);173 estudio.get('promises').pushObject(promesa_1);174 estudio.get('promises').pushObject(promesa_2);175 estudio.get('promises').pushObject(promesa_3);176 assert.equal(estudio.get('capacidad'), 1);177 Ember.run.end();178});179test('fullName', function(assert){180 Ember.run.begin();181 let gov = this.store().createRecord('government', {'name': 'Bachelet-2014-2018'});182 let estudio = this.store().createRecord('study',{"version":"marzo","year":"2016"});183 gov.get('studies').pushObject(estudio);184 Ember.run.end();185 assert.equal(estudio.get('fullName'), 'marzo 2016');186});187test('order', function(assert){188 Ember.run.begin();189 let gov = this.store().createRecord('government', {'name': 'Bachelet-2014-2018', 'start_year': 2014, 'end_year': 2018});190 let estudio = this.store().createRecord('study',{"version":"marzo","year":"2016"});191 gov.get('studies').pushObject(estudio);192 Ember.run.end();193 assert.equal(estudio.get('order'), 'segundo');194});195test("chartData", function(assert){196 Ember.run.begin();197 let gov = this.store().createRecord('government', {'name': 'Bachelet-2014-2018',198 'color1':'#FF6384',199 'color2':'#FF6385',200 'color3':'#FF6386',201 'color4':'#FF6387'202 });203 let estudio = this.store().createRecord('study',{"version":"marzo","year":"2016"});204 let promesa_1=this.store().createRecord('promise',{'content':'content01', 'number':'1', 'title':'title01', 'coherenceLevel': 3});205 let promesa_2=this.store().createRecord('promise',{'content':'content02', 'number':'2', 'title':'title02', 'coherenceLevel': 2});206 let promesa_3=this.store().createRecord('promise',{'content':'content03', 'number':'3', 'title':'title03', 'coherenceLevel': 4});207 let pl1 = this.store().createRecord('bill',{'name':'name01', 'title':'title01', 'fullfilment':'100%'});208 let pl2 = this.store().createRecord('bill',{'name':'name02', 'title':'title02', 'fullfilment':'40%'});209 let pl3 = this.store().createRecord('bill',{'name':'name03', 'title':'title03', 'fullfilment':'100%'});210 gov.get('studies').pushObject(estudio);211 promesa_1.get('bills').pushObject(pl1);212 promesa_2.get('bills').pushObject(pl2);213 promesa_3.get('bills').pushObject(pl3);214 estudio.get('promises').pushObject(promesa_1);215 estudio.get('promises').pushObject(promesa_2);216 estudio.get('promises').pushObject(promesa_3);217 Ember.run.end();218 /*219 let expected_dataChart = {220 labels: [221 "% avance", "% incompleto"222 ],223 datasets: [224 {225 data: [80, 20],226 backgroundColor: [227 "#FF6384",228 "#36A2EB",229 ],230 hoverBackgroundColor: [231 "#FF6384",232 "#36A2EB",233 ]234 }]235 };*/236 assert.ok(estudio.get('chartData').labels);237 assert.ok(estudio.get('chartData').datasets);238 assert.ok(estudio.get('chartData').datasets[0]);239 assert.ok(estudio.get('chartData').datasets[0].data);240});241test('get bills', function(assert){242 let estudio = this.loadData(this.store()).estudio;243 assert.ok(estudio.get('bills'), 'bills');244 assert.equal(estudio.get('bills').length, 4, 'length 4');245 assert.ok(estudio.get('bills').findBy('id', 'pl1'), 'pl1');246 assert.ok(estudio.get('bills').findBy('id', 'pl2'), 'pl2');247 assert.ok(estudio.get('bills').findBy('id', 'pl3'), 'pl3');248 assert.ok(estudio.get('bills').findBy('id', 'pl4'), 'pl4');249 assert.notOk(estudio.get('bills').findBy('id', 'pl5'), 'pl5');250});251test('getCapacity', function(assert){252 let estudio = this.loadData(this.store()).estudio;253 //there are two promises that are completed254 assert.equal(estudio.get('capacity'), 2);255});256test('calc urgencies', function(assert){257 let estudio = this.loadData(this.store()).estudio;258 assert.equal(estudio.get('billsCount'), 4);259 assert.equal(estudio.get('urgenciesCount'), 100);260});261test('show promises for a single study', function(assert){262 Ember.run.begin();263 let store = this.store();264 let gov = store.createRecord('government', {'name': 'Bachelet-2014-2018'});265 let estudio_1 = store.createRecord('study',{"version":"marzo","year":"2016"});266 let estudio_2 = store.createRecord('study',{"version":"mayo","year":"2016"});267 let promesa_1_1= store.createRecord('promise',{'content':'content01', 'number':'1', 'title':'title01', 'coherenceLevel': 3});268 let promesa_1_2= store.createRecord('promise',{'content':'content02', 'number':'2', 'title':'title02'});269 let promesa_1_3= store.createRecord('promise',{'content':'content03', 'number':'3', 'title':'title03'});270 let promesa_1_4= store.createRecord('promise',{'content':'content04', 'number':'4', 'title':'title04'});271 let promesa_2_1= store.createRecord('promise',{'content':'content01', 'number':'1', 'title':'title01', 'coherenceLevel': 3});272 let promesa_2_2= store.createRecord('promise',{'content':'content02', 'number':'2', 'title':'title02'});273 let pl1 = store.createRecord('bill',{'name':'name01', 'title':'title01', 'fullfilment':'100%'});274 let pl2 = store.createRecord('bill',{'name':'name01', 'title':'title01', 'fullfilment':'100%'});275 let area_1 = store.createRecord('area',{'id': 1, 'name':'area 01'});276 let area_2 = store.createRecord('area',{'id': 2, 'name':'area 02'});277 let area_3 = store.createRecord('area',{'id': 3, 'name':'area 03'});278 area_1.get('promises').pushObject(promesa_1_1);279 area_2.get('promises').pushObject(promesa_1_2);280 area_3.get('promises').pushObject(promesa_1_3);281 area_3.get('promises').pushObject(promesa_1_4);282 area_1.get('promises').pushObject(promesa_2_1);283 area_2.get('promises').pushObject(promesa_2_2);284 promesa_1_1.get('bills').pushObject(pl1);285 promesa_2_1.get('bills').pushObject(pl2);286 gov.get('studies').pushObject(estudio_1);287 gov.get('studies').pushObject(estudio_2);288 estudio_1.get('promises').pushObject(promesa_1_1);289 estudio_1.get('promises').pushObject(promesa_1_2);290 estudio_1.get('promises').pushObject(promesa_1_3);291 estudio_1.get('promises').pushObject(promesa_1_4);292 estudio_2.get('promises').pushObject(promesa_2_1);293 estudio_2.get('promises').pushObject(promesa_2_2);294 Ember.run.end();295 let areas_1_array = estudio_1.get('areas');296 assert.ok(areas_1_array.filterBy('id', 1),'kaka');297 assert.ok(areas_1_array.filterBy('id', 2),'keke');298 assert.ok(areas_1_array.filterBy('id', 3),'kiki');299 assert.equal(areas_1_array.length, 3);300 let areas_2_array = estudio_2.get('areas');301 assert.ok(areas_2_array.filterBy('id', 1),'lala');302 assert.ok(areas_2_array.filterBy('id', 2),'lele');303 assert.notOk(areas_2_array.filterBy('id', 3).length,0);304 assert.equal(areas_2_array.length, 2);305});306test('getPromisesByArea', function(assert){307 Ember.run.begin();308 let store = this.store();309 let gov = store.createRecord('government', {'name': 'Bachelet-2014-2018'});310 let estudio_1 = store.createRecord('study',{"version":"marzo","year":"2016", 'gov': gov});311 let estudio_2 = store.createRecord('study',{"version":"mayo","year":"2016"});312 let promesa_1_1= store.createRecord('promise',{'id':'p1','content':'content01', 'number':'1', 'title':'title01', 'study': estudio_1});313 let promesa_1_2 = store.createRecord('promise',{'id':'p2','content':'content01', 'number':'1', 'title':'title01', 'study': estudio_2});314 let area_1 = store.createRecord('area',{'id': 1, 'name':'area 01'});315 area_1.get('promises').pushObject(promesa_1_1);316 area_1.get('promises').pushObject(promesa_1_2);317 Ember.run.end();318 let promises_estudio1 = estudio_1.getPromisesByArea(area_1);319 assert.equal(promises_estudio1.length, 1);320 assert.equal(promises_estudio1[0].get('id'), 'p1');321 let promises_estudio2 = estudio_2.getPromisesByArea(area_1);322 assert.equal(promises_estudio2.length, 1);323 assert.equal(promises_estudio2[0].get('id'), 'p2');324});325test('getPromisesGroupedByArea', function(assert){326 let estudio = this.loadData(this.store()).estudio;327 let result = estudio.get('promisesGroupedByArea');328 assert.equal(result[0].area.get('id'), 'a1');...

Full Screen

Full Screen

BautagebuchMainController.js

Source:BautagebuchMainController.js Github

copy

Full Screen

...57 58 if (DigiWebApp.BautagebuchMengeneinheit.findSorted().length === 0) {59 // Es gibt noch keine Mengeneinheiten oder sind in DSO nicht gepflegt60 var i = 1;61 DigiWebApp.BautagebuchMengeneinheit.createRecord(62 { id: i, bezeichnung: "Stück", kuerzel: "Stk" }).saveSorted();63 i = i + 1;64 DigiWebApp.BautagebuchMengeneinheit.createRecord(65 { id: i, bezeichnung: "Packung", kuerzel: "Pkg" }).saveSorted();66 i = i + 1;67 DigiWebApp.BautagebuchMengeneinheit.createRecord(68 { id: i, bezeichnung: "Karton", kuerzel: "Ktn" }).saveSorted();69 i = i + 1;70 DigiWebApp.BautagebuchMengeneinheit.createRecord(71 { id: i, bezeichnung: "Palette", kuerzel: "Pal" }).saveSorted();72 i = i + 1;73 DigiWebApp.BautagebuchMengeneinheit.createRecord(74 { id: i, bezeichnung: "Gramm", kuerzel: "g" }).saveSorted();75 i = i + 1;76 DigiWebApp.BautagebuchMengeneinheit.createRecord(77 { id: i, bezeichnung: "Kilogramm", kuerzel: "kg" }).saveSorted();78 i = i + 1;79 DigiWebApp.BautagebuchMengeneinheit.createRecord(80 { id: i, bezeichnung: "Zentner", kuerzel: "Ztr" }).saveSorted();81 i = i + 1;82 DigiWebApp.BautagebuchMengeneinheit.createRecord(83 { id: i, bezeichnung: "Tonne", kuerzel: "t" }).saveSorted();84 i = i + 1;85 DigiWebApp.BautagebuchMengeneinheit.createRecord(86 { id: i, bezeichnung: "Millimeter", kuerzel: "mm" }).saveSorted();87 i = i + 1;88 DigiWebApp.BautagebuchMengeneinheit.createRecord(89 { id: i, bezeichnung: "Zentimeter", kuerzel: "cm" }).saveSorted();90 i = i + 1;91 DigiWebApp.BautagebuchMengeneinheit.createRecord(92 { id: i, bezeichnung: "Meter", kuerzel: "m" }).saveSorted();93 i = i + 1;94 DigiWebApp.BautagebuchMengeneinheit.createRecord(95 { id: i, bezeichnung: "Laufmeter", kuerzel: "lfm" }).saveSorted();96 i = i + 1;97 DigiWebApp.BautagebuchMengeneinheit.createRecord(98 { id: i, bezeichnung: "Kilometer", kuerzel: "km" }).saveSorted();99 i = i + 1;100 DigiWebApp.BautagebuchMengeneinheit.createRecord(101 { id: i, bezeichnung: "Quadratmeter", kuerzel: "qm" }).saveSorted();102 i = i + 1;103 DigiWebApp.BautagebuchMengeneinheit.createRecord(104 { id: i, bezeichnung: "Milliliter", kuerzel: "ml" }).saveSorted();105 i = i + 1;106 DigiWebApp.BautagebuchMengeneinheit.createRecord(107 { id: i, bezeichnung: "Deziliter", kuerzel: "dl" }).saveSorted();108 i = i + 1;109 DigiWebApp.BautagebuchMengeneinheit.createRecord(110 { id: i, bezeichnung: "Liter", kuerzel: "l" }).saveSorted();111 i = i + 1;112 DigiWebApp.BautagebuchMengeneinheit.createRecord(113 { id: i, bezeichnung: "Hektoliter", kuerzel: "hl" }).saveSorted();114 i = i + 1;115 DigiWebApp.BautagebuchMengeneinheit.createRecord(116 { id: i, bezeichnung: "Kubikmeter", kuerzel: "kbm" }).saveSorted();117 i = i + 1;118 }119 120 var itemSelected = NO;121 try {122 // Projektleiter123 var projektleiter = DigiWebApp.BautagebuchProjektleiter.find();124 if (projektleiter.length !== 0) {125 itemSelected = NO;126 projektleiter = _.sortBy(projektleiter, function(m){127 return m.get('nachname') + ", " + m.get('vorname');128 });129 var myOrder = -1;...

Full Screen

Full Screen

area-test.js

Source:area-test.js Github

copy

Full Screen

...6 loadData: function(){7 Ember.run.begin();8 // Having two areas9 let area1 = this.subject({'id': "1111111111", 'name': 'nombre1'});10 let area2 = this.store().createRecord('area', {'id': "2222222222", 'name': 'nombre2'});11 // First Government12 let gov1 = this.store().createRecord('government', {'name': 'Bachelet-2014-2018'});13 let study1 = this.store().createRecord('study', {'version': 'marzo', 'year': '2016'});14 gov1.get('studies').pushObject(study1);15 let promesa_1 = this.store().createRecord('promise',{'content':'content01',16 'number':'1',17 'title':'title01',18 'study': study1,'coherenceLevel': 4,19 'area': area1});20 let promesa_2 = this.store().createRecord('promise',{'content':'content02',21 'number':'2',22 'title':'title02',23 'study': study1,'coherenceLevel': 1,24 'area': area1});25 let bill_a = this.store().createRecord('bill',{'name':'name_a',26 'id':'ba',27 'title':'title01',28 'fullfilment':'100%'29 30 });31 let justification1 = this.store().createRecord('justification', {'promise': promesa_1, 'bill': bill_a});32 let bill_b = this.store().createRecord('bill',{'name':'name_b',33 'id':'bb',34 'title':'title02',35 'fullfilment':'0%'});36 this.store().createRecord('justification', {'promise': promesa_2, 'bill': bill_b});37 let promesa_11 = this.store().createRecord('promise',{'content':'content01',38 'number':'1',39 'title':'title01',40 'study': study1,41 'coherenceLevel': 1,42 'area': area2});43 let promesa_21 = this.store().createRecord('promise',{'content':'content02',44 'number':'2',45 'title':'title02',46 'coherenceLevel': 3,47 'study': study1,48 'area': area2});49 let bill1 = this.store().createRecord('bill',{'name':'name01',50 'id':'b1',51 'title':'title01',52 'fullfilment':'25%',53 });54 this.store().createRecord('justification', {'promise': promesa_11, 'bill': bill1});55 let bill2 = this.store().createRecord('bill',{'name':'name02',56 'id':'b2',57 'title':'title02',58 'fullfilment':'25%'});59 this.store().createRecord('justification', {'promise': promesa_21, 'bill': bill2});60 let gov2 = this.store().createRecord('government', {'name': 'Piñera-2011-2014'});61 let study2 = this.store().createRecord('study', {'version': 'marzo',62 'year': '2013',63 'government': gov264 });65 let promesa_3 = this.store().createRecord('promise',{'content':'content01',66 'number':'1',67 'title':'title01',68 'study': study2,69 'coherenceLevel': 4,70 'area': area1});71 let promesa_4 = this.store().createRecord('promise',{'content':'content02',72 'number':'2',73 'title':'title02',74 'coherenceLevel': 3,75 'study': study2,76 'area': area1});77 let bill3 = this.store().createRecord('bill',{'name':'name03',78 'id':'b3',79 'title':'title01',80 'fullfilment':'100%'});81 this.store().createRecord('justification', {'promise': promesa_3, 'bill': bill3});82 let bill4 = this.store().createRecord('bill',{'name':'name04',83 'id':'b4',84 'title':'title02',85 'fullfilment':'100%'});86 this.store().createRecord('justification', {'promise': promesa_3, 'bill': bill4});87 let bill5 = this.store().createRecord('bill',{'name':'name05',88 'id':'b5',89 'title':'title04',90 'fullfilment':'100%'});91 this.store().createRecord('justification', {'promise': promesa_4, 'bill': bill5});92 let bill6 = this.store().createRecord('bill',{'name':'name06',93 'id':'b6',94 'title':'title05',95 'fullfilment':'10%'});96 this.store().createRecord('justification', {'promise': promesa_4, 'bill': bill6});97 Ember.run.end();98 return {"area1": area1,99 "area2": area2,100 "study1": study1,101 "bill1": bill_a,102 "justification1": justification1,103 "study2": study2};104 }105});106test('it exists', function(assert) {107 let model = this.subject();108 // let store = this.store();109 assert.ok(!!model);110});111test('tiene nombre entre sus atributos', function(assert){112 let ar = this.subject({'name': 'nombre'});113 assert.equal(ar.toJSON().name, 'nombre');114 assert.ok(ar.toJSON().slug);115});116test("area has many promises", function(assert){117 let area = this.store().modelFor('area');118 let relationship = Ember.get(area, 'relationshipsByName').get('promises');119 assert.equal(relationship.key, 'promises');120 assert.equal(relationship.kind, 'hasMany');121});122test('area getFulfillment by study', function(assert){123 let data = this.loadData();124 assert.equal(data.area1.fullfilmentPerStudy(data.study1), 50);125 assert.equal(data.area2.fullfilmentPerStudy(data.study1), 25);126 assert.equal(data.area1.fullfilmentPerStudy(data.study2), 78);127 assert.equal(data.area2.fullfilmentPerStudy(data.study2), 0);128});129test('getCapacity', function(assert){130 let data = this.loadData();131 assert.equal(data.area1.capacityByStudy(data.study1), 1);132});133test('area getCoherenceLevelByStudy', function(assert){134 let data = this.loadData();135 assert.equal(data.area1.coherenceLevelByStudy(data.study1), 2.5, 'a');136 assert.equal(data.area2.coherenceLevelByStudy(data.study1), 2, 'b');137 assert.equal(data.area1.coherenceLevelByStudy(data.study2), 3.5, 'c');138 assert.equal(data.area2.coherenceLevelByStudy(data.study2), 1, 'd');139});140test('area getPoliticalWillByStudy', function(assert){141 let data = this.loadData();142 Ember.run.begin();143 data.bill1.unloadRecord();144 data.justification1.unloadRecord();145 Ember.run.end();146 assert.equal(data.area1.getPoliticalWillByStudy(data.study1), 1);147 assert.equal(data.area2.getPoliticalWillByStudy(data.study1), 2);148});149test('area getCompletedPromisesByStudy', function(assert){150 let data = this.loadData();151 assert.equal(data.area1.getCompletedPromisesByStudy(data.study1), 1);152 assert.equal(data.area2.getCompletedPromisesByStudy(data.study1), 0);153 assert.equal(data.area1.getCompletedPromisesByStudy(data.study2), 1);154 assert.equal(data.area2.getCompletedPromisesByStudy(data.study2), 0);155});156test("it calculates things of bills", function(assert){157 Ember.run.begin();158 let promesa_1 = this.store().createRecord('promise',{'content':'content01',159 'number':'1',160 'coherenceLevel': 4,161 'title':'title01'});162 let promesa_2 = this.store().createRecord('promise',{'content':'content02',163 'number':'2',164 'coherenceLevel': 1,165 'title':'title02'});166 let b1 = this.store().createRecord('bill',{'name':'name01',167 'title':'title01',168 'fullfilment':'100%',169 });170 this.store().createRecord('justification', {'promise': promesa_1,'bill': b1});171 let b2 = this.store().createRecord('bill',{'name':'name02',172 'title':'title02',173 'fullfilment':'0%',174 });175 this.store().createRecord('justification', {'promise': promesa_2,'bill': b2});176 Ember.run.end();177 let result_coherence = this.subject().getAverageFrom([promesa_1, promesa_2], 'coherenceLevel');178 assert.equal(result_coherence, 2.5);179 let result_fullfilment = this.subject().getAverageFrom([promesa_1, promesa_2], 'fullfilment');180 assert.equal(result_fullfilment, 50);...

Full Screen

Full Screen

category-test.js.es6

Source:category-test.js.es6 Github

copy

Full Screen

...5 const store = createStore();6 const slugFor = function(cat, val, text) {7 equal(Discourse.Category.slugFor(cat), val, text);8 };9 slugFor(store.createRecord('category', {slug: 'hello'}), "hello", "It calculates the proper slug for hello");10 slugFor(store.createRecord('category', {id: 123, slug: ''}), "123-category", "It returns id-category for empty strings");11 slugFor(store.createRecord('category', {id: 456}), "456-category", "It returns id-category for undefined slugs");12 slugFor(store.createRecord('category', {slug: '熱帶風暴畫眉'}), "熱帶風暴畫眉", "It can be non english characters");13 const parentCategory = store.createRecord('category', {id: 345, slug: 'darth'});14 slugFor(store.createRecord('category', {slug: 'luke', parentCategory: parentCategory}),15 "darth/luke",16 "it uses the parent slug before the child");17 slugFor(store.createRecord('category', {id: 555, parentCategory: parentCategory}),18 "darth/555-category",19 "it uses the parent slug before the child and then uses id");20 parentCategory.set('slug', null);21 slugFor(store.createRecord('category', {id: 555, parentCategory: parentCategory}),22 "345-category/555-category",23 "it uses the parent before the child and uses ids for both");24});25test('findBySlug', function() {26 expect(6);27 const store = createStore();28 const darth = store.createRecord('category', {id: 1, slug: 'darth'}),29 luke = store.createRecord('category', {id: 2, slug: 'luke', parentCategory: darth}),30 hurricane = store.createRecord('category', {id: 3, slug: '熱帶風暴畫眉'}),31 newsFeed = store.createRecord('category', {id: 4, slug: '뉴스피드', parentCategory: hurricane}),32 time = store.createRecord('category', {id: 5, slug: '时间', parentCategory: darth}),33 bah = store.createRecord('category', {id: 6, slug: 'bah', parentCategory: hurricane}),34 categoryList = [darth, luke, hurricane, newsFeed, time, bah];35 sandbox.stub(Discourse.Category, 'list').returns(categoryList);36 deepEqual(Discourse.Category.findBySlug('darth'), darth, 'we can find a category');37 deepEqual(Discourse.Category.findBySlug('luke', 'darth'), luke, 'we can find the other category with parent category');38 deepEqual(Discourse.Category.findBySlug('熱帶風暴畫眉'), hurricane, 'we can find a category with CJK slug');39 deepEqual(Discourse.Category.findBySlug('뉴스피드', '熱帶風暴畫眉'), newsFeed, 'we can find a category with CJK slug whose parent slug is also CJK');40 deepEqual(Discourse.Category.findBySlug('时间', 'darth'), time, 'we can find a category with CJK slug whose parent slug is english');41 deepEqual(Discourse.Category.findBySlug('bah', '熱帶風暴畫眉'), bah, 'we can find a category with english slug whose parent slug is CJK');42 sandbox.restore();43});44test('findSingleBySlug', function() {45 expect(6);46 const store = createStore();47 const darth = store.createRecord('category', {id: 1, slug: 'darth'}),48 luke = store.createRecord('category', {id: 2, slug: 'luke', parentCategory: darth}),49 hurricane = store.createRecord('category', {id: 3, slug: '熱帶風暴畫眉'}),50 newsFeed = store.createRecord('category', {id: 4, slug: '뉴스피드', parentCategory: hurricane}),51 time = store.createRecord('category', {id: 5, slug: '时间', parentCategory: darth}),52 bah = store.createRecord('category', {id: 6, slug: 'bah', parentCategory: hurricane}),53 categoryList = [darth, luke, hurricane, newsFeed, time, bah];54 sandbox.stub(Discourse.Category, 'list').returns(categoryList);55 deepEqual(Discourse.Category.findSingleBySlug('darth'), darth, 'we can find a category');56 deepEqual(Discourse.Category.findSingleBySlug('darth/luke'), luke, 'we can find the other category with parent category');57 deepEqual(Discourse.Category.findSingleBySlug('熱帶風暴畫眉'), hurricane, 'we can find a category with CJK slug');58 deepEqual(Discourse.Category.findSingleBySlug('熱帶風暴畫眉/뉴스피드'), newsFeed, 'we can find a category with CJK slug whose parent slug is also CJK');59 deepEqual(Discourse.Category.findSingleBySlug('darth/时间'), time, 'we can find a category with CJK slug whose parent slug is english');60 deepEqual(Discourse.Category.findSingleBySlug('熱帶風暴畫眉/bah'), bah, 'we can find a category with english slug whose parent slug is CJK');61});62test('findByIds', function() {63 const store = createStore();64 const categories = {65 1: store.createRecord('category', {id: 1}),66 2: store.createRecord('category', {id: 2})67 };68 sandbox.stub(Discourse.Category, 'idMap').returns(categories);69 deepEqual(Discourse.Category.findByIds([1,2,3]), _.values(categories));70});71test('postCountStats', function() {72 const store = createStore();73 const category1 = store.createRecord('category', {id: 1, slug: 'unloved', posts_year: 2, posts_month: 0, posts_week: 0, posts_day: 0}),74 category2 = store.createRecord('category', {id: 2, slug: 'hasbeen', posts_year: 50, posts_month: 4, posts_week: 0, posts_day: 0}),75 category3 = store.createRecord('category', {id: 3, slug: 'solastweek', posts_year: 250, posts_month: 200, posts_week: 50, posts_day: 0}),76 category4 = store.createRecord('category', {id: 4, slug: 'hotstuff', posts_year: 500, posts_month: 280, posts_week: 100, posts_day: 22}),77 category5 = store.createRecord('category', {id: 6, slug: 'empty', posts_year: 0, posts_month: 0, posts_week: 0, posts_day: 0});78 let result = category1.get('postCountStats');79 equal(result.length, 1, "should only show year");80 equal(result[0].value, 2);81 equal(result[0].unit, 'year');82 result = category2.get('postCountStats');83 equal(result.length, 2, "should show month and year");84 equal(result[0].value, 4);85 equal(result[0].unit, 'month');86 equal(result[1].value, 50);87 equal(result[1].unit, 'year');88 result = category3.get('postCountStats');89 equal(result.length, 2, "should show week and month");90 equal(result[0].value, 50);91 equal(result[0].unit, 'week');92 equal(result[1].value, 200);93 equal(result[1].unit, 'month');94 result = category4.get('postCountStats');95 equal(result.length, 2, "should show day and week");96 equal(result[0].value, 22);97 equal(result[0].unit, 'day');98 equal(result[1].value, 100);99 equal(result[1].unit, 'week');100 result = category5.get('postCountStats');101 equal(result.length, 0, "should show nothing");102});103test('search with category name', () => {104 const store = createStore(),105 category1 = store.createRecord('category', { id: 1, name: 'middle term', slug: 'different-slug' }),106 category2 = store.createRecord('category', { id: 2, name: 'middle term', slug: 'another-different-slug' });107 sandbox.stub(Category, "listByActivity").returns([category1, category2]);108 deepEqual(Category.search('term', { limit: 0 }), [], "returns an empty array when limit is 0");109 deepEqual(Category.search(''), [category1, category2], "orders by activity if no term is matched");110 deepEqual(Category.search('term'), [category1, category2], "orders by activity");111 category2.set('name', 'TeRm start');112 deepEqual(Category.search('tErM'), [category2, category1], "ignores case of category name and search term");113 category2.set('name', 'term start');114 deepEqual(Category.search('term'), [category2, category1], "orders matching begin with and then contains");115 sandbox.restore();116 const child_category1 = store.createRecord('category', { id: 3, name: 'term start', parent_category_id: category1.get('id') }),117 read_restricted_category = store.createRecord('category', { id: 4, name: 'some term', read_restricted: true });118 sandbox.stub(Category, "listByActivity").returns([read_restricted_category, category1, child_category1, category2]);119 deepEqual(Category.search(''),120 [category1, category2, read_restricted_category],121 "prioritize non read_restricted and does not include child categories when term is blank");122 deepEqual(Category.search('', { limit: 3 }),123 [category1, category2, read_restricted_category],124 "prioritize non read_restricted and does not include child categories categories when term is blank with limit");125 deepEqual(Category.search('term'),126 [child_category1, category2, category1, read_restricted_category],127 "prioritize non read_restricted");128 deepEqual(Category.search('term', { limit: 3 }),129 [child_category1, category2, read_restricted_category],130 "prioritize non read_restricted with limit");131 sandbox.restore();132});133test('search with category slug', () => {134 const store = createStore(),135 category1 = store.createRecord('category', { id: 1, name: 'middle term', slug: 'different-slug' }),136 category2 = store.createRecord('category', { id: 2, name: 'middle term', slug: 'another-different-slug' });137 sandbox.stub(Category, "listByActivity").returns([category1, category2]);138 deepEqual(Category.search('different-slug'), [category1, category2], "returns the right categories");139 deepEqual(Category.search('another-different'), [category2], "returns the right categories");140 category2.set('slug', 'ANOTher-DIFfereNT');141 deepEqual(Category.search('anOtHer-dIfFeREnt'), [category2], "ignores case of category slug and search term");...

Full Screen

Full Screen

network-throughput-test.js

Source:network-throughput-test.js Github

copy

Full Screen

...8const NetworkThroughput = require('../../../gather/computed/network-throughput');9const assert = require('assert');10describe('NetworkThroughput', () => {11 const compute = NetworkThroughput.getThroughput;12 function createRecord(responseReceivedTime, endTime, extras) {13 return Object.assign({14 responseReceivedTime,15 endTime,16 transferSize: 1000,17 finished: true,18 failed: false,19 statusCode: 200,20 url: 'https://google.com/logo.png',21 parsedURL: {isValid: true, scheme: 'https'}22 }, extras);23 }24 it('should return Infinity for no/missing records', () => {25 assert.equal(compute([]), Infinity);26 assert.equal(compute([createRecord(0, 0, {finished: false})]), Infinity);27 });28 it('should compute correctly for a basic waterfall', () => {29 const result = compute([30 createRecord(0, 1),31 createRecord(1, 2),32 createRecord(2, 6),33 ]);34 assert.equal(result, 500);35 });36 it('should compute correctly for concurrent requests', () => {37 const result = compute([38 createRecord(0, 1),39 createRecord(0.5, 1),40 ]);41 assert.equal(result, 2000);42 });43 it('should compute correctly for gaps', () => {44 const result = compute([45 createRecord(0, 1),46 createRecord(3, 4),47 ]);48 assert.equal(result, 1000);49 });50 it('should compute correctly for partially overlapping requests', () => {51 const result = compute([52 createRecord(0, 1),53 createRecord(0.5, 1.5),54 createRecord(1.25, 3),55 createRecord(1.4, 4),56 createRecord(5, 9)57 ]);58 assert.equal(result, 625);59 });60 it('should exclude failed records', () => {61 const extras = {failed: true};62 const result = compute([createRecord(0, 2), createRecord(3, 4, extras)]);63 assert.equal(result, 500);64 });65 it('should exclude cached records', () => {66 const extras = {statusCode: 304};67 const result = compute([createRecord(0, 2), createRecord(3, 4, extras)]);68 assert.equal(result, 500);69 });70 it('should exclude unfinished records', () => {71 const extras = {finished: false};72 const result = compute([createRecord(0, 2), createRecord(3, 4, extras)]);73 assert.equal(result, 500);74 });75 it('should exclude data URIs', () => {76 const extras = {parsedURL: {scheme: 'data'}};77 const result = compute([createRecord(0, 2), createRecord(3, 4, extras)]);78 assert.equal(result, 500);79 });...

Full Screen

Full Screen

patient-name-test.js

Source:patient-name-test.js Github

copy

Full Screen

...19 let subject;20 run(() => {21 let Test = DS.Model.extend(PatientName);22 this.register('model:test', Test);23 subject = this.store().createRecord('test', attrs);24 });25 return subject;26 },27 store() {28 return this.container.lookup('service:store');29 }30});31test('getPatientDisplayId friendlyId', function(assert) {32 let patient;33 run(() => {34 patient = this.store().createRecord('patient', {35 friendlyId: 'test',36 id: '123'37 });38 });39 assert.strictEqual(this.subject().getPatientDisplayId(patient), 'test');40});41test('getPatientDisplayId externalPatientId', function(assert) {42 let patient;43 run(() => {44 patient = this.store().createRecord('patient', {45 externalPatientId: '1234',46 id: '4321'47 });48 });49 assert.strictEqual(this.subject().getPatientDisplayId(patient), '1234');50});51test('getPatientDisplayId id', function(assert) {52 let patient;53 run(() => {54 patient = this.store().createRecord('patient', {55 id: '9876'56 });57 });58 assert.strictEqual(this.subject().getPatientDisplayId(patient), '9876');59});60test('getPatientDisplayName', function(assert) {61 let patient;62 run(() => {63 patient = this.store().createRecord('patient', {64 firstName: 'First',65 lastName: 'Last',66 middleName: 'Middle'67 });68 });69 assert.strictEqual(this.subject().getPatientDisplayName(patient), 'First Middle Last');70});71test('getPatientDisplayName first', function(assert) {72 let patient;73 run(() => {74 patient = this.store().createRecord('patient', {75 firstName: 'First'76 });77 });78 assert.strictEqual(this.subject().getPatientDisplayName(patient), 'First');79});80test('getPatientDisplayName first and last', function(assert) {81 let patient;82 run(() => {83 patient = this.store().createRecord('patient', {84 firstName: 'First',85 lastName: 'Last'86 });87 });88 assert.strictEqual(this.subject().getPatientDisplayName(patient), 'First Last');89});90test('getPatientDisplayName last', function(assert) {91 let patient;92 run(() => {93 patient = this.store().createRecord('patient', {94 lastName: 'Last'95 });96 });97 assert.strictEqual(this.subject().getPatientDisplayName(patient), 'Last');...

Full Screen

Full Screen

records.js

Source:records.js Github

copy

Full Screen

...12test.afterEach.always(cleanupDatabase)13test.serial('create record', async (t) => {14 const body = {15 query: `16 mutation createRecord($domainId: ID!, $input: CreateRecordInput!) {17 createRecord(domainId: $domainId, input: $input) {18 success19 payload {20 id21 }22 }23 }24 `,25 variables: {26 domainId: t.context.domain.id,27 input: {28 siteLocation: 'https://example.com/',29 siteReferrer: 'https://google.com/',30 },31 },32 }33 const { json } = await api(base, body, t.context.token.id)34 t.true(json.data.createRecord.success)35 t.is(typeof json.data.createRecord.payload.id, 'string')36 // Save record for the next test37 validRecord = json.data.createRecord.payload38})39test.serial('update record', async (t) => {40 const body = {41 query: `42 mutation updateRecord($id: ID!) {43 updateRecord(id: $id) {44 success45 }46 }47 `,48 variables: {49 id: validRecord.id,50 },51 }52 const { json } = await api(base, body, t.context.token.id)53 t.true(json.data.updateRecord.success)54})55test.serial('ignore record creation when logged in', async (t) => {56 const body = {57 query: `58 mutation createRecord($domainId: ID!, $input: CreateRecordInput!) {59 createRecord(domainId: $domainId, input: $input) {60 success61 payload {62 id63 }64 }65 }66 `,67 variables: {68 domainId: t.context.domain.id,69 input: { siteLocation: 'https://example.com/' },70 },71 }72 const { json } = await api(base, body, t.context.token.id, {73 Cookie: 'ackee_ignore=1',...

Full Screen

Full Screen

balance-sheet.js

Source:balance-sheet.js Github

copy

Full Screen

...5 @service store;6 createdStore = false;7 model() {8 if (!this.createdStore) {9 let cl = this.store.createRecord('page',{id:6, title:'Current Liabilities'});10 let ts = this.store.createRecord('page',{id:11, title:'Treasury Stock'});11 let ppe = this.store.createRecord('page',{id:3, title:'Property Plant and Equipment'});12 let tl = this.store.createRecord('page',{id:8, title:'Total Liabilities'});13 let ca = this.store.createRecord('page',{id:1, title:'Current Assets'});14 let cc = this.store.createRecord('page',{id:9, title:'Contributed Capital'});15 let int = this.store.createRecord('page',{id:4, title:'Intangibles'});16 let tlse = this.store.createRecord('page',{id:13, title:'Total Liabilities & Stockholders Equity'});17 let lti = this.store.createRecord('page',{id:2, title:'Long Term Investments'});18 let re = this.store.createRecord('page',{id:10, title:'Retained Earnings'});19 let ltd = this.store.createRecord('page',{id:7, title:'Long Term Debt'});20 let tse = this.store.createRecord('page',{id:12, title:'Total Stockholders Equity'});21 let ta = this.store.createRecord('page',{id:5, title:'Total Assets'});22 this.createdStore = true;23 return this.store.createRecord('book',{id:1, title:'Book Title',pages: [cl, ts, ppe, tl, ca, cc, int, tlse, lti, re, ltd, tse, ta]});24 }25 }26 @action27 exit() {28 this.store.unloadAll('book')29 this.store.unloadAll('page');30 this.createdStore = false;31 this.controller.set('sortFinishText', false);32 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const record = await page._client.send('Network.createRecord', { mimeType: 'application/json' });7 const data = await page._client.send('Network.readRecord', { stream: record.stream });8 await page._client.send('Network.deleteRecord', { stream: record.stream });9 const parsedData = JSON.parse(data.data);10 console.log(parsedData);11 await browser.close();12})();13The `page._client` is the underlying [CDP Session](

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.screenshot({ path: `example.png` });7 await browser.close();8})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const request = await page.route('**/api/endpoint', route => route.fulfill({7 body: JSON.stringify({8 }),9 }));10 const response = await page.waitForResponse(request);11 const body = await response.json();12 console.log(body);13 await browser.close();14})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.screenshot({ path: `example.png` });6 await browser.close();7})();8const { chromium } = require('playwright');9const { Page } = require('@playwright/test');10(async () => {11 const browser = await chromium.launch();12 const page = await browser.newPage();13 await page.screenshot({ path: `example.png` });14 await browser.close();15})();16const { chromium } = require('playwright');17const { Page } = require('@playwright/test');18(async () => {19 const browser = await chromium.launch();20 const page = await browser.newPage();21 await page.screenshot({ path: `example.png` });22 await browser.close();23})();24const { chromium } = require('playwright');25const { Page } = require('@playwright/test');26(async () => {27 const browser = await chromium.launch();28 const page = await browser.newPage();29 await page.screenshot({ path: `example.png` });30 await browser.close();31})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const page = await browser.newPage();5 await page.screenshot({ path: 'example.png' });6 await browser.close();7})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium, webkit, firefox } = require('playwright');2const { createRecord } = require('@playwright/test');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.screenshot({ path: 'example.png' });8 await browser.close();9})();10const { chromium, webkit, firefox } = require('playwright');11const { setConfig } = require('@playwright/test');12(async () => {13 setConfig({14 use: {15 },16 });17 const browser = await chromium.launch();18 const context = await browser.newContext();19 const page = await context.newPage();20 await page.screenshot({ path: 'example.png' });21 await browser.close();22})();23const { chromium, webkit, firefox } = require('playwright');24const { skip } = require('@playwright/test');25(async () => {26 const browser = await chromium.launch();27 const context = await browser.newContext();28 const page = await context.newPage();29 await page.screenshot({ path: 'example.png' });30 await browser.close();31})();32const { chromium, webkit, firefox } = require('playwright');33const { skip } = require('@playwright/test');34(async () => {35 const browser = await chromium.launch();36 const context = await browser.newContext();37 const page = await context.newPage();38 await page.screenshot({ path: 'example.png' });39 await browser.close();40})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2const path = require('path');3const fs = require('fs');4const videoPath = path.join(__dirname, 'test.mp4');5(async () => {6 const browser = await chromium.launch();7 const context = await browser.newContext();8 const page = await context.newPage();9 await page.tracing.start({ screenshots: true, snapshots: true });10 await page.tracing.stop({ path: 'trace.zip' });11 await browser.close();12})();13const { chromium } = require('playwright');14const path = require('path');15const fs = require('fs');16const videoPath = path.join(__dirname, 'test.mp4');17(async () => {18 const browser = await chromium.launch();19 const context = await browser.newContext();20 const page = await context.newPage();21 await page.tracing.start({ screenshots: true, snapshots: true });22 await page.tracing.stop({ path: 'trace.zip' });23 await browser.close();24})();25const { chromium } = require('playwright');26const path = require('path');27const fs = require('fs');28const videoPath = path.join(__dirname, 'test.mp4');29(async () => {30 const browser = await chromium.launch();31 const context = await browser.newContext();32 const page = await context.newPage();33 await page.tracing.start({ screenshots: true, snapshots: true });34 await page.tracing.stop({ path: 'trace.zip' });35 await browser.close();36})();37const { chromium } = require('playwright');38const path = require('path');39const fs = require('fs');40const videoPath = path.join(__dirname, 'test.mp4');41(async () => {42 const browser = await chromium.launch();43 const context = await browser.newContext();44 const page = await context.newPage();45 await page.tracing.start({ screenshots: true, snapshots: true });

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chromium } = require('playwright');2(async () => {3 const browser = await chromium.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.fill('[name="username"]', 'myusername');7 await page.fill('[name="password"]', 'mypassword');8 await page.click('[id="loginBtn"]');9 await page.waitForNavigation({ waitUntil: 'networkidle' });10 await page.click('text=Contacts');11 const [response] = await Promise.all([12 page.click('text=New contact'),13 ]);14 const responseBody = await response.json();15 console.log(responseBody);16 await browser.close();17})();

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal 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