Best JavaScript code snippet using cypress
lineup.spec.js
Source:lineup.spec.js
...27 expect(Lineup.prototype.salary_cap).toBe(0);28 expect(Lineup.prototype.entries).toEqual([]);29 });30 it("You should be able to add entries to the lineup", function () {31 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");32 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");33 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");34 var lineup = new Lineup(65000);35 expect(lineup.getNumberOfEntries()).toBe(0);36 lineup.addEntry(entry1);37 lineup.addEntry(entry2);38 lineup.addEntry(entry3);39 expect(lineup.getSalaryCap()).toBe(65000);40 expect(lineup.getNumberOfEntries()).toBe(3);41 });42 it("You should be able to remove all entries from the lineup", function () {43 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");44 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");45 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");46 var lineup = new Lineup(65000);47 expect(lineup.getNumberOfEntries()).toBe(0);48 lineup.addEntry(entry1);49 lineup.addEntry(entry2);50 lineup.addEntry(entry3);51 expect(lineup.getSalaryCap()).toBe(65000);52 expect(lineup.getNumberOfEntries()).toBe(3);53 lineup.clearEntries();54 expect(lineup.getNumberOfEntries()).toBe(0);55 });56 it("You should be able to check sum of salaries", function () {57 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");58 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");59 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");60 var player1 = createPlayer({61 id: "XAB1",62 name: "Micheal A",63 salary: 6000,64 opp: "XAB2",65 fppg: "XAB3",66 position: "SF"67 });68 var player2 = createPlayer({69 id: "YBB1",70 name: "Micheal B",71 salary: 2000,72 opp: "YBB2",73 fppg: "YBB3",74 position: "SM"75 });76 var player3 = createPlayer({77 id: "ZCB1",78 name: "Micheal C",79 salary: 15000,80 opp: "ZCB2",81 fppg: "ZCB3",82 position: "SG"83 });84 entry1.addPlayer(player1);85 entry2.addPlayer(player2);86 entry3.addPlayer(player3);87 var lineup = new Lineup(65000);88 lineup.addEntry(entry1);89 lineup.addEntry(entry2);90 lineup.addEntry(entry3);91 expect(lineup.consumedSalary()).toBe(23000);92 });93 it("You should be able to check if you can add player safely so you don't exceed the limit", function () {94 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");95 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");96 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");97 var entry4 = createEntry("POS4", "SX", "UNIQUE_ID_4");98 var entry5 = createEntry("POS5", "SQ", "UNIQUE_ID_5");99 var player1 = createPlayer({100 id: "XAB1",101 name: "Micheal A",102 salary: 5000,103 opp: "XAB2",104 fppg: "XAB3",105 position: "SF"106 });107 var player2 = createPlayer({108 id: "YBB1",109 name: "Micheal B",110 salary: 6000,111 opp: "YBB2",112 fppg: "YBB3",113 position: "SM"114 });115 var player3 = createPlayer({116 id: "ZCB1",117 name: "Micheal C",118 salary: 7000,119 opp: "ZCB2",120 fppg: "ZCB3",121 position: "SG"122 });123 var player4 = createPlayer({124 id: "HCB1",125 name: "Micheal Q",126 salary: 7000,127 opp: "HCB2",128 fppg: "HCB3",129 position: "SA"130 });131 var player5 = createPlayer({132 id: "VCB1",133 name: "Silver Goldman",134 salary: 999999,135 opp: "VCB2",136 fppg: "VCB3",137 position: "SQ"138 });139 entry1.addPlayer(player1);140 entry2.addPlayer(player2);141 entry3.addPlayer(player3);142 entry4.addPlayer(player4);143 entry5.addPlayer(player5);144 var lineup = new Lineup(65000);145 lineup.addEntry(entry1);146 lineup.addEntry(entry2);147 lineup.addEntry(entry3);148 expect(lineup.canAddPlayer(player4)).toBe(true);149 lineup.addEntry(entry4);150 expect(lineup.canAddPlayer(player5)).toBe(false);151 });152 it("You should be able to remove all players from the lineup", function () {153 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");154 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");155 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");156 var player1 = createPlayer({157 id: "XAB1",158 name: "Micheal A",159 salary: 6000,160 opp: "XAB2",161 fppg: "XAB3",162 position: "SF"163 });164 var player2 = createPlayer({165 id: "YBB1",166 name: "Micheal B",167 salary: 2000,168 opp: "YBB2",169 fppg: "YBB3",170 position: "SM"171 });172 var player3 = createPlayer({173 id: "ZCB1",174 name: "Micheal C",175 salary: 15000,176 opp: "ZCB2",177 fppg: "ZCB3",178 position: "SG"179 });180 entry1.addPlayer(player1);181 entry2.addPlayer(player2);182 entry3.addPlayer(player3);183 var lineup = new Lineup(65000);184 lineup.addEntry(entry1);185 lineup.addEntry(entry2);186 lineup.addEntry(entry3);187 expect(lineup.consumedSalary()).toBe(23000);188 lineup.clear();189 expect(lineup.consumedSalary()).toBe(0);190 expect(lineup.getNumberOfEntries()).toBe(3);191 });192 it("You should be able to count how much money you've still got", function () {193 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");194 var player1 = createPlayer({195 id: "XAB1",196 name: "Micheal A",197 salary: 6000,198 opp: "XAB2",199 fppg: "XAB3",200 position: "SF"201 });202 entry1.addPlayer(player1);203 var lineup = new Lineup(65000);204 lineup.addEntry(entry1);205 expect(lineup.getSalaryCap()).toBe(65000);206 expect(lineup.consumedSalary()).toBe(6000);207 expect(lineup.amountLeft()).toBe(59000);208 });209 it("The setSalaryCap should set salary_cap to 0 if passed value is incorrect", function () {210 var lineup = new Lineup(100000);211 expect(lineup.salary_cap).toBe(100000);212 lineup.setSalaryCap(10000);213 expect(lineup.salary_cap).toBe(10000);214 lineup.setSalaryCap(-2000);215 expect(lineup.salary_cap).toBe(0);216 lineup.setSalaryCap(10000);217 expect(lineup.salary_cap).toBe(10000);218 lineup.setSalaryCap(NaN);219 expect(lineup.salary_cap).toBe(0);220 });221 it("You should be able to find out how many spots are still empty", function () {222 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");223 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");224 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");225 var lineup = new Lineup(100000);226 lineup.addEntry(entry1);227 lineup.addEntry(entry2);228 lineup.addEntry(entry3);229 expect(lineup.spotsLeft()).toBe(3);230 var player1 = createPlayer({231 id: "XAB1",232 name: "Micheal A",233 salary: 6000,234 opp: "XAB2",235 fppg: "XAB3",236 position: "SF"237 });238 entry1.addPlayer(player1);239 expect(lineup.spotsLeft()).toBe(2);240 var player2 = createPlayer({241 id: "YBB1",242 name: "Micheal B",243 salary: 2000,244 opp: "YBB2",245 fppg: "YBB3",246 position: "SM"247 });248 entry2.addPlayer(player2);249 expect(lineup.spotsLeft()).toBe(1);250 var player3 = createPlayer({251 id: "ZCB1",252 name: "Micheal C",253 salary: 15000,254 opp: "ZCB2",255 fppg: "ZCB3",256 position: "SG"257 });258 entry3.addPlayer(player3);259 expect(lineup.spotsLeft()).toBe(0);260 lineup.clear();261 expect(lineup.spotsLeft()).toBe(3);262 });263 it("You should be able to count all players in the lineup", function () {264 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");265 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");266 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");267 var lineup = new Lineup(100000);268 lineup.addEntry(entry1);269 lineup.addEntry(entry2);270 lineup.addEntry(entry3);271 expect(lineup.spotsLeft()).toBe(3);272 var player1 = createPlayer({273 id: "XAB1",274 name: "Micheal A",275 salary: 6000,276 opp: "XAB2",277 fppg: "XAB3",278 position: "SF"279 });280 entry1.addPlayer(player1);281 expect(lineup.spotsTaken()).toBe(1);282 var player2 = createPlayer({283 id: "YBB1",284 name: "Micheal B",285 salary: 2000,286 opp: "YBB2",287 fppg: "YBB3",288 position: "SM"289 });290 entry2.addPlayer(player2);291 expect(lineup.spotsTaken()).toBe(2);292 var player3 = createPlayer({293 id: "ZCB1",294 name: "Micheal C",295 salary: 15000,296 opp: "ZCB2",297 fppg: "ZCB3",298 position: "SG"299 });300 entry3.addPlayer(player3);301 expect(lineup.spotsTaken()).toBe(3);302 lineup.clear();303 expect(lineup.spotsTaken()).toBe(0);304 });305 it("You should be able to find out what's the average remaining salary in the lineup", function () {306 307 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");308 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");309 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");310 var player1 = createPlayer({311 id: "XAB1",312 name: "Micheal A",313 salary: 6000,314 opp: "XAB2",315 fppg: "XAB3",316 position: "SF"317 });318 var player2 = createPlayer({319 id: "YBB1",320 name: "Micheal B",321 salary: 2000,322 opp: "YBB2",323 fppg: "YBB3",324 position: "SM"325 });326 var player3 = createPlayer({327 id: "ZCB1",328 name: "Micheal C",329 salary: 13000,330 opp: "ZCB2",331 fppg: "ZCB3",332 position: "SG"333 });334 entry1.addPlayer(player1);335 entry2.addPlayer(player2);336 entry3.addPlayer(player3);337 var lineup = new Lineup(65000);338 lineup.addEntry(entry1);339 lineup.addEntry(entry2);340 lineup.addEntry(entry3);341 expect(lineup.averagePlayerSalary()).toBe(7000);342 expect(lineup.averageRemainingPlayerSalary()).toBe(0);343 });344 it("You should be able to find out what's the minimum salary in the lineup", function () {345 346 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");347 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");348 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");349 var player1 = createPlayer({350 id: "XAB1",351 name: "Micheal A",352 salary: 2000,353 opp: "XAB2",354 fppg: "XAB3",355 position: "SF"356 });357 var player3 = createPlayer({358 id: "ZCB1",359 name: "Micheal C",360 salary: 13000,361 opp: "ZCB2",362 fppg: "ZCB3",363 position: "SG"364 });365 entry1.addPlayer(player1);366 entry3.addPlayer(player3);367 var lineup = new Lineup(65000);368 lineup.addEntry(entry1);369 lineup.addEntry(entry2);370 lineup.addEntry(entry3);371 expect(lineup.getMinPlayerSalary()).toBe(2000);372 });373 it("You should be able to find out what's the maximum salary in the lineup", function () {374 375 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");376 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");377 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");378 var player1 = createPlayer({379 id: "XAB1",380 name: "Micheal A",381 salary: 6000,382 opp: "XAB2",383 fppg: "XAB3",384 position: "SF"385 });386 var player2 = createPlayer({387 id: "YBB1",388 name: "Micheal B",389 salary: 2000,390 opp: "YBB2",391 fppg: "YBB3",392 position: "SM"393 });394 entry1.addPlayer(player1);395 entry2.addPlayer(player2);396 var lineup = new Lineup(65000);397 lineup.addEntry(entry1);398 lineup.addEntry(entry2);399 lineup.addEntry(entry3);400 expect(lineup.getMaxPlayerSalary()).toBe(6000);401 });402 it("You should be able to get list of all salaries of players", function () {403 var entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");404 var entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");405 var entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");406 var player1 = createPlayer({407 id: "XAB1",408 name: "Micheal A",409 salary: 6000,410 opp: "XAB2",411 fppg: "XAB3",412 position: "SF"413 });414 var player2 = createPlayer({415 id: "YBB1",416 name: "Micheal B",417 salary: 2000,418 opp: "YBB2",419 fppg: "YBB3",420 position: "SM"421 });422 entry1.addPlayer(player1);423 entry2.addPlayer(player2);424 var lineup = new Lineup(65000);425 lineup.addEntry(entry1);426 lineup.addEntry(entry2);427 lineup.addEntry(entry3);428 var salaries = lineup.getAllSalaries();429 expect(salaries[0]).toBe(6000);430 expect(salaries[1]).toBe(2000);431 expect(salaries[2]).toBe(undefined);432 });433 });434 describe("Tests for sorting Entries in a Lineup", function () {435 var entry1, entry2, entry3, player1, player2, player3, lineup;436 // set up the sorting tests437 beforeEach(function() {438 entry1 = createEntry("POS1", "SF", "UNIQUE_ID_1");439 entry2 = createEntry("POS2", "SM", "UNIQUE_ID_2");440 entry3 = createEntry("POS3", "SG", "UNIQUE_ID_3");441 player1 = createPlayer({442 id: "XAB1",443 name: "Micheal Waa",444 salary: 6000,445 opp: "XAB2",446 fppg: "XAB3",447 position: "SF"448 });449 player2 = createPlayer({450 id: "YBB1",451 name: "Micheal Gaa",452 salary: 2000,453 opp: "YBB2",454 fppg: "YBB3",...
test.js
Source:test.js
...36 var toolbox = toolboxFactory(),37 $container = $(fixtureContainer);38 QUnit.expect(8);39 toolbox.init();40 toolbox.createEntry({control: 'entry1'});41 toolbox.createEntry({control: 'entry2'});42 toolbox.createEntry({control: 'entry3'});43 toolbox.render($container);44 QUnit.equal($container.find('.tools-box-list').length, 1, 'toolbox has been rendered');45 QUnit.equal($container.find('[data-control="entry1"]').length, 1, 'entry1 has been rendered');46 QUnit.equal($container.find('[data-control="entry2"]').length, 1, 'entry2 has been rendered');47 QUnit.equal($container.find('[data-control="entry3"]').length, 1, 'entry3 has been rendered');48 toolbox.destroy();49 QUnit.equal($container.find('.tools-box-list').length, 0, 'toolbox has been destroyed');50 QUnit.equal($container.find('[data-control="entry1"]').length, 0, 'entry1 has been destroyed');51 QUnit.equal($container.find('[data-control="entry2"]').length, 0, 'entry2 has been destroyed');52 QUnit.equal($container.find('[data-control="entry3"]').length, 0, 'entry3 has been destroyed');53 });54 QUnit.module('Item creation and rendering');55 QUnit.test('.createText()', function() {56 var toolbox = toolboxFactory(),57 $container = $(fixtureContainer),58 $result;59 QUnit.expect(3);60 toolbox.init();61 toolbox.createText({62 control: 'sample-text',63 className: 'sample-class',64 text: 'Sample text!'65 });66 toolbox.render($container);67 $result = $container.find('[data-control="sample-text"]');68 QUnit.equal($result.length, 1, 'text item has been rendered');69 QUnit.equal($result.text().trim(), 'Sample text!', 'text item has the correct text');70 QUnit.ok($result.hasClass('sample-class'), 'text item has the correct class');71 });72 QUnit.test('.createEntry()', function() {73 var toolbox = toolboxFactory(),74 $container = $(fixtureContainer),75 $result;76 QUnit.expect(5);77 toolbox.init();78 toolbox.createEntry({79 control: 'sample-entry',80 title: 'Sample title!',81 icon: 'result-ok',82 className: 'sample-class',83 text: 'Sample entry!'84 });85 toolbox.render($container);86 $result = $container.find('[data-control="sample-entry"]');87 QUnit.equal($result.length, 1, 'entry item has been rendered');88 QUnit.equal($result.text().trim(), 'Sample entry!', 'entry item has the correct text');89 QUnit.equal($result.attr('title'), 'Sample title!', 'title attribute has the correct content');90 QUnit.ok($result.hasClass('sample-class'), 'text item has the correct class');91 $result = $container.find('.icon-result-ok');92 QUnit.equal($result.length, 1, 'entry has an icon');93 });94 QUnit.test('.createMenu()', function() {95 var toolbox = toolboxFactory(),96 $container = $(fixtureContainer),97 items = {},98 $result;99 QUnit.expect(11);100 toolbox.init();101 items.menu = toolbox.createMenu({102 control: 'sample-menu',103 title: 'Sample Menu!',104 icon: 'result-ok',105 className: 'sample-class',106 text: 'Sample Menu!'107 });108 items.menu_1 = toolbox.createEntry({control: 'menu-entry1'}); items.menu_1.setMenuId('sample-menu');109 items.menu_2 = toolbox.createEntry({control: 'menu-entry2'}); items.menu_2.setMenuId('sample-menu');110 items.menu_3 = toolbox.createEntry({control: 'menu-entry3'}); items.menu_3.setMenuId('sample-menu');111 toolbox.render($container);112 // check button113 $result = $container.find('[data-control="sample-menu"]');114 QUnit.equal($result.length, 1, 'menu item has been rendered');115 QUnit.equal($result.text().trim(), 'Sample Menu!', 'menu item has the correct text');116 QUnit.equal($result.attr('title'), 'Sample Menu!', 'title attribute has the correct content');117 QUnit.ok($result.hasClass('sample-class'), 'menu item has the correct class');118 $result = $container.find('.icon-result-ok');119 QUnit.equal($result.length, 1, 'entry has an icon');120 // check menu content121 $result = $container.find('[data-control="sample-menu-menu"]');122 QUnit.equal($result.length, 1, 'menu content has been rendered');123 QUnit.ok(hider.isHidden($result), 'menu is hidden by default');124 $result = $container.find('[data-control="sample-menu-list"] li');125 QUnit.equal($result.length, 3, 'menu contains 3 items');126 QUnit.equal($result.eq(0).data('control'), 'menu-entry1', 'menu entry1 has been rendered in 1st position');127 QUnit.equal($result.eq(1).data('control'), 'menu-entry2', 'menu entry2 has been rendered in 2nd position');128 QUnit.equal($result.eq(2).data('control'), 'menu-entry3', 'menu entry3 has been rendered in 3rd position');129 });130 QUnit.module('Default renderer');131 QUnit.test('render entries in registration order', function() {132 var toolbox = toolboxFactory(),133 $container = $(fixtureContainer),134 items = {},135 $result;136 QUnit.expect(6);137 toolbox.init();138 items.entry1 = toolbox.createEntry({control: 'entry1'});139 items.entry2 = toolbox.createEntry({control: 'entry2'});140 items.entry3 = toolbox.createEntry({control: 'entry3'});141 items.entry4 = toolbox.createEntry({control: 'entry4'});142 items.entry5 = toolbox.createEntry({control: 'entry5'});143 toolbox.render($container);144 $result = $container.find('li');145 QUnit.equal($result.length, 5, 'menu contains the right number of entries');146 QUnit.equal($result.eq(0).data('control'), 'entry1', 'entry1 has been rendered in 1st position');147 QUnit.equal($result.eq(1).data('control'), 'entry2', 'entry2 has been rendered in 2nd position');148 QUnit.equal($result.eq(2).data('control'), 'entry3', 'entry3 has been rendered in 3rd position');149 QUnit.equal($result.eq(3).data('control'), 'entry4', 'entry4 has been rendered in 4th position');150 QUnit.equal($result.eq(4).data('control'), 'entry5', 'entry5 has been rendered in 5th position');151 });152 QUnit.test('handle menu entries and orphan menu entries', function() {153 var toolbox = toolboxFactory(),154 $container = $(fixtureContainer),155 items = {},156 $result;157 QUnit.expect(14);158 toolbox.init();159 items.entry1 = toolbox.createMenu({control: 'menu1'});160 items.entry2 = toolbox.createEntry({control: 'entry2'}); items.entry2.setMenuId('idontexist');161 items.entry3 = toolbox.createEntry({control: 'entry3'}); items.entry3.setMenuId('menu1');162 items.entry4 = toolbox.createMenu({control: 'menu2'});163 items.entry5 = toolbox.createEntry({control: 'entry5'}); items.entry5.setMenuId('idontexist');164 items.entry6 = toolbox.createEntry({control: 'entry6'}); items.entry6.setMenuId('menu2');165 items.entry7 = toolbox.createEntry({control: 'entry7'}); items.entry7.setMenuId('menu1');166 items.entry8 = toolbox.createMenu({control: 'menu3'});167 items.entry9 = toolbox.createEntry({control: 'entry9'}); items.entry9.setMenuId('menu2');168 items.entry10 = toolbox.createEntry({control: 'entry10'}); items.entry10.setMenuId('menu1');169 items.entry11 = toolbox.createEntry({control: 'entry11'}); items.entry11.setMenuId('idontexist');170 toolbox.render($container);171 $result = $container.find('.tools-box-list > li');172 QUnit.equal($result.length, 3, 'menu contains the right number of entries');173 QUnit.equal($result.eq(0).data('control'), 'menu1', 'menu1 has been rendered in 1st position');174 QUnit.equal($result.eq(1).data('control'), 'menu2', 'menu2 has been rendered in 2nd position');175 QUnit.equal($result.eq(2).data('control'), 'menu3', 'menu3 has been rendered in 3rd position');176 $result = $container.find('[data-control="menu1-list"] li');177 QUnit.equal($result.length, 3, 'the menu "menu1" contains the right number of entries');178 QUnit.equal($result.eq(0).data('control'), 'entry3', 'entry3 has been rendered in 1st position of menu "menu1"');179 QUnit.equal($result.eq(1).data('control'), 'entry7', 'entry4 has been rendered in 2nd position of menu "menu1"');180 QUnit.equal($result.eq(2).data('control'), 'entry10', 'entry10 has been rendered in 3rd position of menu "menu1"');181 $result = $container.find('[data-control="menu2"] li');182 QUnit.equal($result.length, 2, 'the menu "menu2" contains the right number of entries');183 QUnit.equal($result.eq(0).data('control'), 'entry6', 'entry6 has been rendered in 1st position of menu "menu2"');184 QUnit.equal($result.eq(1).data('control'), 'entry9', 'entry9 has been rendered in 2nd position of menu "menu2"');185 // orphan entries186 QUnit.equal($container.find('[data-control="entry2"]').length, 0, 'orphan entry2 has not been rendered');187 QUnit.equal($container.find('[data-control="entry5"]').length, 0, 'orphan entry5 has not been rendered');188 QUnit.equal($container.find('[data-control="entry11"]').length, 0, 'orphan entry11 has not been rendered');189 });190 QUnit.module('Menus interactions');191 QUnit.test('Interacting with a pre-rendered menu does not cause errors', function () {192 var toolbox = toolboxFactory(),193 $container = $(fixtureContainer),194 menu;195 QUnit.expect(5);196 toolbox.init();197 menu = toolbox.createMenu();198 _.each(Object.getOwnPropertyNames(menu), function (prop) {199 if (typeof menu[prop] === 'function') {200 menu[prop].call(menu);201 }202 });203 QUnit.ok(true, 'methods');204 QUnit.ok(menu.trigger('enable'), 'enable');205 QUnit.ok(menu.trigger('disable'), 'disable');206 QUnit.ok(menu.trigger('hide'), 'hide');207 QUnit.ok(menu.trigger('destroy'), 'destroying');208 toolbox.render($container);209 toolbox.enable();210 menu.enable();211 });212 QUnit.test('Opening a menu close opened menus', function() {213 var toolbox = toolboxFactory(),214 $container = $(fixtureContainer),215 items = {},216 $toggle1, $toggle2, $toggle3,217 $menu1, $menu2, $menu3;218 QUnit.expect(15);219 toolbox.init();220 items.menu1 = toolbox.createMenu({control: 'menu1'});221 items.menu1_1 = toolbox.createEntry({control: 'menu1-entry1'}); items.menu1_1.setMenuId('menu1');222 items.menu1_2 = toolbox.createEntry({control: 'menu1-entry2'}); items.menu1_2.setMenuId('menu1');223 items.menu1_3 = toolbox.createEntry({control: 'menu1-entry3'}); items.menu1_3.setMenuId('menu1');224 items.menu2 = toolbox.createMenu({control: 'menu2'});225 items.menu2_1 = toolbox.createEntry({control: 'menu2-entry1'}); items.menu2_1.setMenuId('menu2');226 items.menu2_2 = toolbox.createEntry({control: 'menu2-entry2'}); items.menu2_2.setMenuId('menu2');227 items.menu2_3 = toolbox.createEntry({control: 'menu2-entry3'}); items.menu2_3.setMenuId('menu2');228 items.menu3 = toolbox.createMenu({control: 'menu3'});229 items.menu3_1 = toolbox.createEntry({control: 'menu3-entry1'}); items.menu3_1.setMenuId('menu3');230 items.menu3_2 = toolbox.createEntry({control: 'menu3-entry2'}); items.menu3_2.setMenuId('menu3');231 items.menu3_3 = toolbox.createEntry({control: 'menu3-entry3'}); items.menu3_3.setMenuId('menu3');232 toolbox.render($container);233 toolbox.enable();234 _.invoke(items, 'enable'); // enable all items. This is usually the plugin responsability235 $toggle1 = $container.find('[data-control="menu1"]');236 $toggle2 = $container.find('[data-control="menu2"]');237 $toggle3 = $container.find('[data-control="menu3"]');238 $menu1 = $container.find('[data-control="menu1-menu"]');239 $menu2 = $container.find('[data-control="menu2-menu"]');240 $menu3 = $container.find('[data-control="menu3-menu"]');241 QUnit.ok(hider.isHidden($menu1), 'menu1 is hidden');242 QUnit.ok(hider.isHidden($menu2), 'menu2 is hidden');243 QUnit.ok(hider.isHidden($menu3), 'menu3 is hidden');244 $toggle1.click();245 QUnit.ok(! hider.isHidden($menu1), 'menu1 is visible');246 QUnit.ok(hider.isHidden($menu2), 'menu2 is hidden');247 QUnit.ok(hider.isHidden($menu3), 'menu3 is hidden');248 $toggle2.click();249 QUnit.ok(hider.isHidden($menu1), 'menu1 is hidden');250 QUnit.ok(! hider.isHidden($menu2), 'menu2 is visible');251 QUnit.ok(hider.isHidden($menu3), 'menu3 is hidden');252 $toggle3.click();253 QUnit.ok(hider.isHidden($menu1), 'menu1 is hidden');254 QUnit.ok(hider.isHidden($menu2), 'menu2 is hidden');255 QUnit.ok(! hider.isHidden($menu3), 'menu3 is visible');256 $toggle3.click();257 QUnit.ok(hider.isHidden($menu1), 'menu1 is hidden');258 QUnit.ok(hider.isHidden($menu2), 'menu2 is hidden');259 QUnit.ok(hider.isHidden($menu3), 'menu3 is hidden');260 });261 QUnit.test('Clicking outside of an opened menu closes it', function() {262 var toolbox = toolboxFactory(),263 $container = $(fixtureContainer),264 items = {},265 $toggle,266 $menu;267 QUnit.expect(3);268 toolbox.init();269 items.menu = toolbox.createMenu({control: 'menu'});270 items.menu_1 = toolbox.createEntry({control: 'menu-entry1'}); items.menu_1.setMenuId('menu');271 items.menu_2 = toolbox.createEntry({control: 'menu-entry2'}); items.menu_2.setMenuId('menu');272 items.menu_3 = toolbox.createEntry({control: 'menu-entry3'}); items.menu_3.setMenuId('menu');273 toolbox.render($container);274 toolbox.enable();275 _.invoke(items, 'enable'); // enable all items. This is usually the plugin responsability276 $toggle = $container.find('[data-control="menu"]');277 $menu = $container.find('[data-control="menu-menu"]');278 QUnit.ok(hider.isHidden($menu), 'menu is hidden');279 $toggle.click();280 QUnit.ok(! hider.isHidden($menu), 'menu is visible');281 $('#qunit').click();282 QUnit.ok(hider.isHidden($menu), 'menu is hidden');283 });284 QUnit.test('Clicking a menu entry closes the menu', function() {285 var toolbox = toolboxFactory(),286 $container = $(fixtureContainer),287 items = {},288 $toggle,289 $menu,290 $entry;291 QUnit.expect(7);292 toolbox.init();293 items.menu = toolbox.createMenu({control: 'menu'});294 items.menu_1 = toolbox.createEntry({control: 'menu-entry1'}); items.menu_1.setMenuId('menu');295 items.menu_2 = toolbox.createEntry({control: 'menu-entry2'}); items.menu_2.setMenuId('menu');296 items.menu_3 = toolbox.createEntry({control: 'menu-entry3'}); items.menu_3.setMenuId('menu');297 toolbox.render($container);298 toolbox.enable();299 _.invoke(items, 'enable'); // enable all items. This is usually the plugin responsability300 $toggle = $container.find('[data-control="menu"]');301 $menu = $container.find('[data-control="menu-menu"]');302 QUnit.ok(hider.isHidden($menu), 'menu is hidden by default');303 // open, then close with click on entry1304 $toggle.click();305 QUnit.ok(! hider.isHidden($menu), 'menu is visible');306 $entry = $menu.find('[data-control="menu-entry1"]');307 $entry.click();308 QUnit.ok(hider.isHidden($menu), 'menu has hidden following a click on entry1');309 // open, then close with click on entry2310 $toggle.click();311 QUnit.ok(! hider.isHidden($menu), 'menu is visible');312 $entry = $menu.find('[data-control="menu-entry2"]');313 $entry.click();314 QUnit.ok(hider.isHidden($menu), 'menu has hidden following a click on entry2');315 // open, then close with click on entry3316 $toggle.click();317 QUnit.ok(! hider.isHidden($menu), 'menu is visible');318 $entry = $menu.find('[data-control="menu-entry3"]');319 $entry.click();320 QUnit.ok(hider.isHidden($menu), 'menu has hidden following a click on entry3');321 });322 QUnit.module('Menu button');323 QUnit.test('button opened/closed state', function() {324 var toolbox = toolboxFactory(),325 $container = $(fixtureContainer),326 items = {},327 $result;328 QUnit.expect(9);329 toolbox.init();330 items.menu = toolbox.createMenu({ control: 'sample-menu' });331 items.menu_1 = toolbox.createEntry({control: 'menu-entry1'}); items.menu_1.setMenuId('sample-menu');332 items.menu_2 = toolbox.createEntry({control: 'menu-entry2'}); items.menu_2.setMenuId('sample-menu');333 items.menu_3 = toolbox.createEntry({control: 'menu-entry3'}); items.menu_3.setMenuId('sample-menu');334 toolbox.render($container);335 _.invoke(items, 'enable'); // enable all items. This is usually the plugin responsability336 // check button337 $result = $container.find('[data-control="sample-menu"]');338 QUnit.equal($result.find('.icon-up').length, 1, 'closed menu has the correct state icon');339 QUnit.equal($result.find('.icon-down').length, 0, 'closed menu has the correct state icon');340 QUnit.ok(! $result.hasClass('active'), 'closed menu button is turned off');341 $result.click();342 QUnit.equal($result.find('.icon-up').length, 0, 'opened menu has the correct state icon');343 QUnit.equal($result.find('.icon-down').length, 1, 'opened menu has the correct state icon');344 QUnit.ok($result.hasClass('active'), 'opened menu button is turned on');345 $result.click();346 QUnit.equal($result.find('.icon-up').length, 1, 'closed menu has the correct state icon');347 QUnit.equal($result.find('.icon-down').length, 0, 'closed menu has the correct state icon');...
create-manifest.test.js
Source:create-manifest.test.js
...9 vars: {},10 version: new Semver('1.2.3')11 };12 t.context.createEntry = (entry = t.context.entry || {}) => {13 return createEntry(entry, t.context.options);14 };15 t.context.createExport = (name = 'a', entries = [t.context.createEntry()]) => {16 return createExport(name, entries, t.context.options);17 };18 t.context.createManifest = (exps = [t.context.createExport()]) => {19 return sut(exps, t.context.options);20 };21});22test('returns empty manifest with empty exports', t => {23 t.deepEqual(t.context.createManifest([]), { exports: {} });24});25test('exports unique vars', t => {26 const baseUrl = t.context.options.vars.baseUrl = 'http://test.com';27 t.deepEqual(t.context.createManifest([]), { vars: { baseUrl }, exports: {} });28});29test('exports statics', t => {30 const dep = 'lodash';31 t.context.entry = t.context.createEntry({ statics: [dep] });32 t.deepEqual(t.context.createManifest(), {33 exports: {34 repo: {35 d: [36 ['a', [{ v: [0], s: [1] }]],37 dep38 ],39 v: [[1, 2, 3]]40 }41 }42 });43});44test('exports relative statics', t => {45 const a = t.context.createExport('a', [t.context.createEntry({ statics: ['~/b'] })]);46 const b = t.context.createExport('b', [t.context.createEntry()]);47 t.deepEqual(t.context.createManifest([a, b]), {48 exports: {49 repo: {50 d: [51 ['a', [{ v: [0], s: [1] }]],52 ['b', [{ v: [0] }]]53 ],54 v: [[1, 2, 3]]55 }56 }57 });58});59test('exports dynamics', t => {60 const dep = 'lodash';61 t.context.entry = t.context.createEntry({ dynamics: [dep] });62 t.deepEqual(t.context.createManifest(), {63 exports: {64 repo: {65 d: [66 ['a', [{ v: [0], d: [1] }]],67 dep68 ],69 v: [[1, 2, 3]]70 }71 }72 });73});74test('exports relative dynamics', t => {75 const a = t.context.createExport('a', [t.context.createEntry({ dynamics: ['~/b'] })]);76 const b = t.context.createExport('b', [t.context.createEntry()]);77 t.deepEqual(t.context.createManifest([a, b]), {78 exports: {79 repo: {80 d: [81 ['a', [{ v: [0], d: [1] }]],82 ['b', [{ v: [0] }]]83 ],84 v: [[1, 2, 3]]85 }86 }87 });88});89test('throws if relative entry is not defined', t => {90 t.context.entry = t.context.createEntry({ statics: ['~/404'] });91 t.throws(() => t.context.createManifest(), { message: /missing/ });92});93test('exports file', t => {94 const file = 'test.js';95 t.context.entry = t.context.createEntry({ file });96 t.deepEqual(t.context.createManifest(), {97 exports: {98 repo: {99 d: [100 ['a', [{ v: [0], f: file }]]101 ],102 v: [[1, 2, 3]]103 }104 }105 });106});107test('exports url', t => {108 const url = 'http://full.com/url.js';109 t.context.entry = t.context.createEntry({ url });110 t.deepEqual(t.context.createManifest(), {111 exports: {112 repo: {113 d: [114 ['a', [{ v: [0], u: url }]]115 ],116 v: [[1, 2, 3]]117 }118 }119 });120});121test('exports versions of unique entries', t => {122 const entryV1 = t.context.createEntry({ version: new Semver('1.0.0'), file: '1.js' });123 const entryV2 = t.context.createEntry({ version: new Semver('2.0.0'), file: '2.js' });124 t.deepEqual(t.context.createManifest([t.context.createExport('a', [entryV2, entryV1])]), {125 exports: {126 repo: {127 d: [128 ['a', [{ v: [1], f: '2.js' }, { v: [0], f: '1.js' }]]129 ],130 v: [[1], [2]]131 }132 }133 });134});135test('combines versions of same entries', t => {136 const entryV1 = t.context.createEntry({ version: new Semver('1.0.0'), file: 'same.js' });137 const entryV2 = t.context.createEntry({ version: new Semver('2.0.0'), file: 'same.js' });138 t.deepEqual(t.context.createManifest([t.context.createExport('a', [entryV2, entryV1])]), {139 exports: {140 repo: {141 d: [142 ['a', [{ v: [1, 0], f: 'same.js' }]]143 ],144 v: [[1], [2]]145 }146 }147 });...
webpack-utils.test.js
Source:webpack-utils.test.js
...3import {getPageEntries, createEntry} from 'next/dist/build/webpack/utils'4const buildId = 'development'5describe('createEntry', () => {6 it('Should turn a path into a page entry', () => {7 const entry = createEntry('pages/index.js')8 expect(entry.name).toBe(normalize(`static/pages/index.js`))9 expect(entry.files[0]).toBe('./pages/index.js')10 })11 it('Should have a custom name', () => {12 const entry = createEntry('pages/index.js', {name: 'something-else.js'})13 expect(entry.name).toBe(normalize(`static/something-else.js`))14 expect(entry.files[0]).toBe('./pages/index.js')15 })16 it('Should allow custom extension like .ts to be turned into .js', () => {17 const entry = createEntry('pages/index.ts', {pageExtensions: ['js', 'ts'].join('|')})18 expect(entry.name).toBe(normalize('static/pages/index.js'))19 expect(entry.files[0]).toBe('./pages/index.ts')20 })21 it('Should allow custom extension like .jsx to be turned into .js', () => {22 const entry = createEntry('pages/index.jsx', {pageExtensions: ['jsx', 'js'].join('|')})23 expect(entry.name).toBe(normalize('static/pages/index.js'))24 expect(entry.files[0]).toBe('./pages/index.jsx')25 })26 it('Should allow custom extension like .tsx to be turned into .js', () => {27 const entry = createEntry('pages/index.tsx', {pageExtensions: ['tsx', 'ts'].join('|')})28 expect(entry.name).toBe(normalize('static/pages/index.js'))29 expect(entry.files[0]).toBe('./pages/index.tsx')30 })31 it('Should allow custom extension like .tsx to be turned into .js with another order', () => {32 const entry = createEntry('pages/index.tsx', {pageExtensions: ['ts', 'tsx'].join('|')})33 expect(entry.name).toBe(normalize('static/pages/index.js'))34 expect(entry.files[0]).toBe('./pages/index.tsx')35 })36 it('Should turn pages/blog/index.js into pages/blog.js', () => {37 const entry = createEntry('pages/blog/index.js')38 expect(entry.name).toBe(normalize('static/pages/blog.js'))39 expect(entry.files[0]).toBe('./pages/blog/index.js')40 })41 it('Should add buildId when provided', () => {42 const entry = createEntry('pages/blog/index.js', {buildId})43 expect(entry.name).toBe(normalize(`static/${buildId}/pages/blog.js`))44 expect(entry.files[0]).toBe('./pages/blog/index.js')45 })46})47describe('getPageEntries', () => {48 const nextPagesDir = join(__dirname, '..', '..', 'dist', 'pages')49 it('Should return paths', () => {50 const pagePaths = ['pages/index.js']51 const pageEntries = getPageEntries(pagePaths, {nextPagesDir})52 expect(pageEntries[normalize('static/pages/index.js')][0]).toBe('./pages/index.js')53 })54 it('Should include default _error', () => {55 const pagePaths = ['pages/index.js']56 const pageEntries = getPageEntries(pagePaths, {nextPagesDir})...
data.js
Source:data.js
...18 }19}20export default [21 createSection('2021', [22 createEntry('Security Engineer @ Atlassian', "2021/2022 Summer Program", [23 'Security',24 'Computing'25 ]),26 createEntry('First in CSE x SecSoc CTF Competition', null, [27 'Security',28 'Computing'29 ]),30 createEntry(31 'CommBank Cyber Prize',32 null,33 ['Security'],34 'Received an award in recognition for SECedu course excellence '35 ),36 createEntry(37 'Broadcast Engineer @ UNSW Sydney',38 null,39 ['Audio/Visual'],40 'Livestreaming of university course lectures'41 ),42 createEntry('IMAG Camera Operator @ KCC KYCK', null, ['Audio/Visual'])43 ]),44 createSection('2020', [45 createEntry(46 'First in COMP6[84]43 Course',47 null,48 ['Security', 'Computing'],49 'Web Application Security and Testing'50 ),51 createEntry('First in CSE x SecSoc CTF Competition', null, [52 'Security',53 'Computing'54 ]),55 createEntry(56 'Two Hands Lifted',57 '2020 - present',58 ['Audio/Visual'],59 'Wedding Videography and Livestreaming'60 )61 ]),62 createSection('2019', [63 createEntry('Volunteer @ Sculpture by the Sea', '2015, 2019', []),64 createEntry(65 'Computer Science Tutor @ UNSW Sydney',66 '2019 - present',67 ['Computing', 'Security'],68 'Courses tutored in 2021:\nCOMP6[84]41 - [Extended] Security Engineering and Cyber Security\nCOMP6[84]43 - [Extended] Web Application Security Testing\nCOMP6447 - System and Software Security Assessment'69 ),70 createEntry(71 'Workshop Content Writer @ CSE CompClub 2019 Summer',72 null,73 ['Security', 'Computing'],74 'Created workshop content about information security and security engineering.'75 ),76 createEntry('Ryndeum', '2019 - present', ['Computing'], 'Software Solutions')77 ]),78 createSection('2018', [79 createEntry('Mentor @ CSE CompClub 2018 Winter', null, [80 'Security',81 'Computing'82 ]),83 createEntry('Event Technician @ UNSW Hospitality', '2018 - 2020', [84 'Audio/Visual',85 'Computing'86 ]),87 createEntry(88 'Started Electrical Engineering / Computer Science at UNSW Sydney',89 null,90 ['Computing']91 )92 ]),93 createSection('2017', [94 createEntry(95 'Graduated from Sydney Technical High School',96 '2012 - 2017',97 ['Computing', 'Audio/Visual'],98 [99 'School Prefect',100 'First in Information Processes & Technology',101 'First in Software Design & Development',102 'First in Electronics',103 'Deputy Principalsâ Prize for Senior Contribution to School Life',104 'Sound and Lighting Crew Director'105 ]106 ),107 createEntry('AV Technician @ RICE Movement', '2017 - present', [108 'Audio/Visual'109 ])110 ])...
index.js
Source:index.js
...26 })27 )28 }29 for (let index = 0; index < numberOfBatchEntries; index += 1) {30 batchData[index] = createEntry(count + index)31 }32 return Promise.resolve(batchData)33}34const runBatch = ({35 batchNumber = 0,36 count = 0,37 createBatch,38 createEntry,39 deattach,40 execute,41 maxCount,42 maxNumberOfBatches,43 nItemsLastBatch,44 numberOfEntries,...
song.js
Source:song.js
1function createEntry(name, idx){2 this.name = name;3 this.idx = idx;4}5var akordNum = new Array();6akordNum[8] = new createEntry('C', 0);7akordNum[0] = new createEntry('C#', 1);8akordNum[9] = new createEntry('D', 2); 9akordNum[1] = new createEntry('D#', 3);10akordNum[2] = new createEntry('Es', 3);11akordNum[10] = new createEntry('E', 4); 12akordNum[11] = new createEntry('F', 5); 13akordNum[3] = new createEntry('F#', 6);14akordNum[12] = new createEntry('G', 7);15akordNum[4] = new createEntry('G#', 8);16akordNum[5] = new createEntry('As', 8);17akordNum[13] = new createEntry('A', 9);18akordNum[6] = new createEntry('B', 10);19akordNum[7] = new createEntry('A#', 10);20akordNum[14] = new createEntry('H', 11);21 22function findAkordByIdx( idx ){23 for (var i=0; i<akordNum.length; i++){24 if (akordNum[i].idx == idx){25 return akordNum[i].name;26 }27 }28 return "ERR";29}30 31 32function findEntryByAkord( akord ){33 var pref1 = akord.substr(0,1); 34 var pref2 = akord.substr(0,2);...
create.test.js
Source:create.test.js
...6}7const message = '8am-11am fixed bugs #tickbin'8test('createEntry requires a db', t => {9 function createWithoutDb () {10 return createEntry(null, message)11 }12 t.plan(1)13 t.throws(createWithoutDb, /provide a couchdb/, 'createEntry requires a db')14})15test('createEntry requires a message', t => {16 function createWithoutMessage () {17 return createEntry(fakeDb, null)18 }19 t.plan(1)20 t.throws(21 createWithoutMessage,22 /provide a message/,23 'createEntry requires a message'24 )25})26test('createEntry should return a promise', t => {27 const sandbox = sinon.createSandbox()28 const stubPut = sandbox.stub(fakeDb, 'put').resolves()29 let res = createEntry(fakeDb, message)30 t.plan(1)31 t.ok(typeof res.then === 'function', 'createEntry return a promise')32 res.then(() => sandbox.restore())33})34test('createEntry calls db.put', t => {35 const sandbox = sinon.createSandbox()36 const stubPut = sandbox.stub(fakeDb, 'put').resolves()37 createEntry(fakeDb, message).then(() => {38 t.plan(1)39 t.ok(stubPut.calledOnce, 'called db.put once')40 })41 .then(() => sandbox.restore())42})43test('createEntry resolves to created doc', t => {44 const sandbox = sinon.createSandbox()45 const stubPut = sandbox.stub(fakeDb, 'put').resolves()46 createEntry(fakeDb, message).then(doc => {47 t.plan(1)48 t.equal(doc.original, message, 'createEntry resolved to created doc')49 })50 .then(() => sandbox.restore())51})52test('message should have a duration', t => {53 createEntry(fakeDb, 'fixed bugs #tickbin')54 .then(() => t.fail('createEntry promise should reject'))55 .catch(() => {56 t.pass('createEntry promise was rejected')57 t.end()58 })...
Using AI Code Generation
1Cypress.Commands.add('createEntry', (title, body, tag) => {2 cy.get('#create-entry').click()3 cy.get('#title').type(title)4 cy.get('#body').type(body)5 cy.get('#tag').type(tag)6 cy.get('#submit').click()7})8Cypress.Commands.add('createEntry', (title, body, tag) => {9 cy.get('#create-entry').click()10 cy.get('#title').type(title)11 cy.get('#body').type(body)12 cy.get('#tag').type(tag)13 cy.get('#submit').click()14})15Cypress.Commands.add('createEntry', (title, body, tag) => {16 cy.get('#create-entry').click()17 cy.get('#title').type(title)18 cy.get('#body').type(body)19 cy.get('#tag').type(tag)20 cy.get('#submit').click()21})22Cypress.Commands.add('createEntry', (title, body, tag) => {23 cy.get('#create-entry').click()24 cy.get('#title').type(title)25 cy.get('#body').type(body)26 cy.get('#tag').type(tag)27 cy.get('#submit').click()28})29Cypress.Commands.add('createEntry', (title, body, tag) => {30 cy.get('#create-entry').click()31 cy.get('#title').type(title)32 cy.get('#body').type(body)33 cy.get('#tag').type(tag)34 cy.get('#submit').click()35})
Using AI Code Generation
1Cypress.Commands.add('createEntry', (options = {}) => {2 const { title = 'my title', body = 'my body', tags = [], published = true, slug = '' } = options;3 cy.request({4 body: {5 {6 mobiledoc: JSON.stringify({7 {8 },9 }),10 },11 },12 }).then((response) => {13 const { id } = response.body.posts[0];14 cy.wrap(id);15 });16});
Using AI Code Generation
1import { createEntry } from 'cypress-vue-unit-test';2import MyComponent from './MyComponent.vue';3describe('MyComponent', () => {4 it('renders', () => {5 createEntry(MyComponent);6 cy.contains('My Component');7 });8});9### `createEntry(Component, options)`10- [Basic example](
Using AI Code Generation
1describe('Create Entry', () => {2 it('Create Entry', () => {3 cy.createEntry({4 })5 })6})7describe('Delete Entry', () => {8 it('Delete Entry', () => {9 cy.deleteEntry({10 })11 })12})13describe('Delete Entries', () => {14 it('Delete Entries', () => {15 cy.deleteEntries()16 })17})18describe('Delete Collection', () => {19 it('Delete Collection', () => {20 cy.deleteCollection({21 })22 })23})24describe('Delete Collections', () => {25 it('Delete Collections', () => {26 cy.deleteCollections()27 })28})29describe('Create Collection', () => {30 it('Create Collection', () => {31 cy.createCollection({32 })33 })34})35describe('Edit Collection', () => {36 it('Edit Collection', () => {37 cy.editCollection({38 })39 })40})41describe('Create Field', ()
Using AI Code Generation
1describe('My First Test', function() {2 it('Does not do much!', function() {3 expect(true).to.equal(true)4 })5})6describe('My First Test', function() {7 it('Visits the Kitchen Sink', function() {8 cy.pause()9 cy.contains('type').click()10 cy.url().should('include', '/commands/actions')11 cy.get('.action-email')12 .type('
Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.
You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.
Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.
Get 100 minutes of automation test minutes FREE!!