How to use contains method in Cypress

Best JavaScript code snippet using cypress

crystal.js

Source:crystal.js Github

copy

Full Screen

1/*2Language: Crystal3Author: TSUYUSATO Kitsune <make.just.on@gmail.com>4*/5function(hljs) {6 var NUM_SUFFIX = '(_[uif](8|16|32|64))?';7 var CRYSTAL_IDENT_RE = '[a-zA-Z_]\\w*[!?=]?';8 var RE_STARTER = '!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|' +9 '>>|>|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~';10 var CRYSTAL_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\][=?]?';11 var CRYSTAL_KEYWORDS = {12 keyword:13 'abstract alias as as? asm begin break case class def do else elsif end ensure enum extend for fun if ' +14 'include instance_sizeof is_a? lib macro module next nil? of out pointerof private protected rescue responds_to? ' +15 'return require select self sizeof struct super then type typeof union uninitialized unless until when while with yield ' +16 '__DIR__ __END_LINE__ __FILE__ __LINE__',17 literal: 'false nil true'18 };19 var SUBST = {20 className: 'subst',21 begin: '#{', end: '}',22 keywords: CRYSTAL_KEYWORDS23 };24 var EXPANSION = {25 className: 'template-variable',26 variants: [27 {begin: '\\{\\{', end: '\\}\\}'},28 {begin: '\\{%', end: '%\\}'}29 ],30 keywords: CRYSTAL_KEYWORDS31 };32 function recursiveParen(begin, end) {33 var34 contains = [{begin: begin, end: end}];35 contains[0].contains = contains;36 return contains;37 }38 var STRING = {39 className: 'string',40 contains: [hljs.BACKSLASH_ESCAPE, SUBST],41 variants: [42 {begin: /'/, end: /'/},43 {begin: /"/, end: /"/},44 {begin: /`/, end: /`/},45 {begin: '%w?\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},46 {begin: '%w?\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},47 {begin: '%w?{', end: '}', contains: recursiveParen('{', '}')},48 {begin: '%w?<', end: '>', contains: recursiveParen('<', '>')},49 {begin: '%w?/', end: '/'},50 {begin: '%w?%', end: '%'},51 {begin: '%w?-', end: '-'},52 {begin: '%w?\\|', end: '\\|'},53 {begin: /<<-\w+$/, end: /^\s*\w+$/},54 ],55 relevance: 0,56 };57 var Q_STRING = {58 className: 'string',59 variants: [60 {begin: '%q\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},61 {begin: '%q\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},62 {begin: '%q{', end: '}', contains: recursiveParen('{', '}')},63 {begin: '%q<', end: '>', contains: recursiveParen('<', '>')},64 {begin: '%q/', end: '/'},65 {begin: '%q%', end: '%'},66 {begin: '%q-', end: '-'},67 {begin: '%q\\|', end: '\\|'},68 {begin: /<<-'\w+'$/, end: /^\s*\w+$/},69 ],70 relevance: 0,71 };72 var REGEXP = {73 begin: '(' + RE_STARTER + ')\\s*',74 contains: [75 {76 className: 'regexp',77 contains: [hljs.BACKSLASH_ESCAPE, SUBST],78 variants: [79 {begin: '//[a-z]*', relevance: 0},80 {begin: '/', end: '/[a-z]*'},81 {begin: '%r\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},82 {begin: '%r\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},83 {begin: '%r{', end: '}', contains: recursiveParen('{', '}')},84 {begin: '%r<', end: '>', contains: recursiveParen('<', '>')},85 {begin: '%r/', end: '/'},86 {begin: '%r%', end: '%'},87 {begin: '%r-', end: '-'},88 {begin: '%r\\|', end: '\\|'},89 ]90 }91 ],92 relevance: 093 };94 var REGEXP2 = {95 className: 'regexp',96 contains: [hljs.BACKSLASH_ESCAPE, SUBST],97 variants: [98 {begin: '%r\\(', end: '\\)', contains: recursiveParen('\\(', '\\)')},99 {begin: '%r\\[', end: '\\]', contains: recursiveParen('\\[', '\\]')},100 {begin: '%r{', end: '}', contains: recursiveParen('{', '}')},101 {begin: '%r<', end: '>', contains: recursiveParen('<', '>')},102 {begin: '%r/', end: '/'},103 {begin: '%r%', end: '%'},104 {begin: '%r-', end: '-'},105 {begin: '%r\\|', end: '\\|'},106 ],107 relevance: 0108 };109 var ATTRIBUTE = {110 className: 'meta',111 begin: '@\\[', end: '\\]',112 contains: [113 hljs.inherit(hljs.QUOTE_STRING_MODE, {className: 'meta-string'})114 ]115 };116 var CRYSTAL_DEFAULT_CONTAINS = [117 EXPANSION,118 STRING,119 Q_STRING,120 REGEXP,121 REGEXP2,122 ATTRIBUTE,123 hljs.HASH_COMMENT_MODE,124 {125 className: 'class',126 beginKeywords: 'class module struct', end: '$|;',127 illegal: /=/,128 contains: [129 hljs.HASH_COMMENT_MODE,130 hljs.inherit(hljs.TITLE_MODE, {begin: '[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?'}),131 {begin: '<'} // relevance booster for inheritance132 ]133 },134 {135 className: 'class',136 beginKeywords: 'lib enum union', end: '$|;',137 illegal: /=/,138 contains: [139 hljs.HASH_COMMENT_MODE,140 hljs.inherit(hljs.TITLE_MODE, {begin: '[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?'}),141 ],142 relevance: 10143 },144 {145 className: 'function',146 beginKeywords: 'def', end: /\B\b/,147 contains: [148 hljs.inherit(hljs.TITLE_MODE, {149 begin: CRYSTAL_METHOD_RE,150 endsParent: true151 })152 ]153 },154 {155 className: 'function',156 beginKeywords: 'fun macro', end: /\B\b/,157 contains: [158 hljs.inherit(hljs.TITLE_MODE, {159 begin: CRYSTAL_METHOD_RE,160 endsParent: true161 })162 ],163 relevance: 5164 },165 {166 className: 'symbol',167 begin: hljs.UNDERSCORE_IDENT_RE + '(\\!|\\?)?:',168 relevance: 0169 },170 {171 className: 'symbol',172 begin: ':',173 contains: [STRING, {begin: CRYSTAL_METHOD_RE}],174 relevance: 0175 },176 {177 className: 'number',178 variants: [179 { begin: '\\b0b([01_]*[01])' + NUM_SUFFIX },180 { begin: '\\b0o([0-7_]*[0-7])' + NUM_SUFFIX },181 { begin: '\\b0x([A-Fa-f0-9_]*[A-Fa-f0-9])' + NUM_SUFFIX },182 { begin: '\\b(([0-9][0-9_]*[0-9]|[0-9])(\\.[0-9_]*[0-9])?([eE][+-]?[0-9_]*[0-9])?)' + NUM_SUFFIX}183 ],184 relevance: 0185 }186 ];187 SUBST.contains = CRYSTAL_DEFAULT_CONTAINS;188 EXPANSION.contains = CRYSTAL_DEFAULT_CONTAINS.slice(1); // without EXPANSION189 return {190 aliases: ['cr'],191 lexemes: CRYSTAL_IDENT_RE,192 keywords: CRYSTAL_KEYWORDS,193 contains: CRYSTAL_DEFAULT_CONTAINS194 };...

Full Screen

Full Screen

ScrapeData.js

Source:ScrapeData.js Github

copy

Full Screen

...24 var phone = {};25 phone.id = agent.url.split(/\//).pop();26 phone.name = body.find('h2').text().trim();27 phone.description = body.find('.description').text().trim();28 phone.availability = c1.find('table:nth-child(1) th:contains("Availability")+td').text().trim().split(/\s*\n\s*/),29 phone.battery = {30 type: c1.find('table:nth-child(2) th:contains("Type")+td').text(),31 talkTime: c1.find('table:nth-child(2) th:contains("Talk time")+td').text(),32 standbyTime: c1.find('table:nth-child(2) th:contains("Standby time")+td').text()33 };34 phone.storage = {35 ram: c1.find('table:nth-child(3) th:contains("RAM")+td').text(),36 flash: c1.find('table:nth-child(3) th:contains("Internal storage")+td').text()37 };38 phone.connectivity = {39 cell: c1.find('table:nth-child(4) th:contains("Network support")+td').text(),40 wifi: c1.find('table:nth-child(4) th:contains("WiFi")+td').text(),41 bluetooth: c1.find('table:nth-child(4) th:contains("Bluetooth")+td').text(),42 infrared: boolean(c1.find('table:nth-child(4) th:contains("Infrared")+td img').attr('src')),43 gps: boolean(c1.find('table:nth-child(4) th:contains("GPS")+td img').attr('src'))44 };45 phone.android = {46 os: c2.find('table:nth-child(1) th:contains("OS Version")+td').text(),47 ui: c2.find('table:nth-child(1) th:contains("UI")+td').text()48 };49 phone.sizeAndWeight = {50 dimensions: c2.find('table:nth-child(2) th:contains("Dimensions")+td').text().trim().split(/\s*\n\s*/),51 weight: c2.find('table:nth-child(2) th:contains("Weight")+td').text().trim()52 };53 phone.display = {54 screenSize: c2.find('table:nth-child(3) th:contains("Screen size")+td').text(),55 screenResolution: c2.find('table:nth-child(3) th:contains("Screen resolution")+td').text(),56 touchScreen: boolean(c2.find('table:nth-child(3) th:contains("Touch screen")+td img').attr('src'))57 };58 phone.hardware = {59 fmRadio: boolean(c2.find('table:nth-child(4) th:contains("FM Radio")+td img').attr('src')),60 physicalKeyboard: c2.find('table:nth-child(4) th:contains("Physical keyboard")+td img').attr('src'),61 accelerometer: boolean(c2.find('table:nth-child(4) th:contains("Accelerometer")+td img').attr('src')),62 cpu: c2.find('table:nth-child(4) th:contains("CPU")+td').text(),63 usb: c2.find('table:nth-child(4) th:contains("USB")+td').text(),64 audioJack: c2.find('table:nth-child(4) th:contains("Audio / headphone jack")+td').text()65 };66 phone.camera= {67 primary: c2.find('table:nth-child(5) th:contains("Primary")+td').text(),68 features: c2.find('table:nth-child(5) th:contains("Features")+td').text().trim().split(/\s*\n\s*/)69 };70 phone.additionalFeatures = c2.find('table:nth-child(6) td').text();71 phone.images = [];72 body.find('#thumbs img').each(function(){73 var imgUrl = 'http://www.google.com' + jquery(this).attr('src');74 phone.images.push({75 small: imgUrl,76 large: imgUrl.replace(/\/small$/, '/large')77 });78 });79 fs.writeSync(fs.openSync(baseDir + phone.id + '.json', 'w'), JSON.stringify(phone));80 } else {81 var age = 0;82 body.find('ul.phonelist li.list').each(function(a){...

Full Screen

Full Screen

ruby.js

Source:ruby.js Github

copy

Full Screen

1/*2Language: Ruby3Author: Anton Kovalyov <anton@kovalyov.net>4Contributors: Peter Leonov <gojpeg@yandex.ru>, Vasily Polovnyov <vast@whiteants.net>, Loren Segal <lsegal@soen.ca>, Pascal Hurni <phi@ruby-reactive.org>, Cedric Sohrauer <sohrauer@googlemail.com>5Category: common6*/7function(hljs) {8 var RUBY_METHOD_RE = '[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?';9 var RUBY_KEYWORDS =10 'and false then defined module in return redo if BEGIN retry end for true self when ' +11 'next until do begin unless END rescue nil else break undef not super class case ' +12 'require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor';13 var YARDOCTAG = {14 className: 'doctag',15 begin: '@[A-Za-z]+'16 };17 var IRB_OBJECT = {18 className: 'value',19 begin: '#<', end: '>'20 };21 var COMMENT_MODES = [22 hljs.COMMENT(23 '#',24 '$',25 {26 contains: [YARDOCTAG]27 }28 ),29 hljs.COMMENT(30 '^\\=begin',31 '^\\=end',32 {33 contains: [YARDOCTAG],34 relevance: 1035 }36 ),37 hljs.COMMENT('^__END__', '\\n$')38 ];39 var SUBST = {40 className: 'subst',41 begin: '#\\{', end: '}',42 keywords: RUBY_KEYWORDS43 };44 var STRING = {45 className: 'string',46 contains: [hljs.BACKSLASH_ESCAPE, SUBST],47 variants: [48 {begin: /'/, end: /'/},49 {begin: /"/, end: /"/},50 {begin: /`/, end: /`/},51 {begin: '%[qQwWx]?\\(', end: '\\)'},52 {begin: '%[qQwWx]?\\[', end: '\\]'},53 {begin: '%[qQwWx]?{', end: '}'},54 {begin: '%[qQwWx]?<', end: '>'},55 {begin: '%[qQwWx]?/', end: '/'},56 {begin: '%[qQwWx]?%', end: '%'},57 {begin: '%[qQwWx]?-', end: '-'},58 {begin: '%[qQwWx]?\\|', end: '\\|'},59 {60 // \B in the beginning suppresses recognition of ?-sequences where ?61 // is the last character of a preceding identifier, as in: `func?4`62 begin: /\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/63 }64 ]65 };66 var PARAMS = {67 className: 'params',68 begin: '\\(', end: '\\)',69 keywords: RUBY_KEYWORDS70 };71 var RUBY_DEFAULT_CONTAINS = [72 STRING,73 IRB_OBJECT,74 {75 className: 'class',76 beginKeywords: 'class module', end: '$|;',77 illegal: /=/,78 contains: [79 hljs.inherit(hljs.TITLE_MODE, {begin: '[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?'}),80 {81 className: 'inheritance',82 begin: '<\\s*',83 contains: [{84 className: 'parent',85 begin: '(' + hljs.IDENT_RE + '::)?' + hljs.IDENT_RE86 }]87 }88 ].concat(COMMENT_MODES)89 },90 {91 className: 'function',92 beginKeywords: 'def', end: '$|;',93 contains: [94 hljs.inherit(hljs.TITLE_MODE, {begin: RUBY_METHOD_RE}),95 PARAMS96 ].concat(COMMENT_MODES)97 },98 {99 className: 'constant',100 begin: '(::)?(\\b[A-Z]\\w*(::)?)+',101 relevance: 0102 },103 {104 className: 'symbol',105 begin: hljs.UNDERSCORE_IDENT_RE + '(\\!|\\?)?:',106 relevance: 0107 },108 {109 className: 'symbol',110 begin: ':',111 contains: [STRING, {begin: RUBY_METHOD_RE}],112 relevance: 0113 },114 {115 className: 'number',116 begin: '(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b',117 relevance: 0118 },119 {120 className: 'variable',121 begin: '(\\$\\W)|((\\$|\\@\\@?)(\\w+))'122 },123 { // regexp container124 begin: '(' + hljs.RE_STARTERS_RE + ')\\s*',125 contains: [126 IRB_OBJECT,127 {128 className: 'regexp',129 contains: [hljs.BACKSLASH_ESCAPE, SUBST],130 illegal: /\n/,131 variants: [132 {begin: '/', end: '/[a-z]*'},133 {begin: '%r{', end: '}[a-z]*'},134 {begin: '%r\\(', end: '\\)[a-z]*'},135 {begin: '%r!', end: '![a-z]*'},136 {begin: '%r\\[', end: '\\][a-z]*'}137 ]138 }139 ].concat(COMMENT_MODES),140 relevance: 0141 }142 ].concat(COMMENT_MODES);143 SUBST.contains = RUBY_DEFAULT_CONTAINS;144 PARAMS.contains = RUBY_DEFAULT_CONTAINS;145 var SIMPLE_PROMPT = "[>?]>";146 var DEFAULT_PROMPT = "[\\w#]+\\(\\w+\\):\\d+:\\d+>";147 var RVM_PROMPT = "(\\w+-)?\\d+\\.\\d+\\.\\d(p\\d+)?[^>]+>";148 var IRB_DEFAULT = [149 {150 begin: /^\s*=>/,151 className: 'status',152 starts: {153 end: '$', contains: RUBY_DEFAULT_CONTAINS154 }155 },156 {157 className: 'prompt',158 begin: '^('+SIMPLE_PROMPT+"|"+DEFAULT_PROMPT+'|'+RVM_PROMPT+')',159 starts: {160 end: '$', contains: RUBY_DEFAULT_CONTAINS161 }162 }163 ];164 return {165 aliases: ['rb', 'gemspec', 'podspec', 'thor', 'irb'],166 keywords: RUBY_KEYWORDS,167 contains: COMMENT_MODES.concat(IRB_DEFAULT).concat(RUBY_DEFAULT_CONTAINS)168 };...

Full Screen

Full Screen

website.tour.event_sale.js

Source:website.tour.event_sale.js Github

copy

Full Screen

...9},10 [11 {12 content: "Go to the `Events` page",13 trigger: 'a[href*="/event"]:contains("Conference on Business Apps"):first',14 },15 {16 content: "Select 1 unit of `Standard` ticket type",17 extra_trigger: '#wrap:not(:has(a[href*="/event"]:contains("Conference on Business Apps")))',18 trigger: 'select:eq(0)',19 run: 'text 1',20 },21 {22 content: "Select 2 units of `VIP` ticket type",23 extra_trigger: 'select:eq(0):has(option:contains(1):propSelected)',24 trigger: 'select:eq(1)',25 run: 'text 2',26 },27 {28 content: "Click on `Order Now` button",29 extra_trigger: 'select:eq(1):has(option:contains(2):propSelected)',30 trigger: '.btn-primary:contains("Register Now")',31 },32 {33 content: "Fill attendees details",34 trigger: 'form[id="attendee_registration"] .btn:contains("Continue")',35 run: function () {36 $("input[name='1-name']").val("Att1");37 $("input[name='1-phone']").val("111 111");38 $("input[name='1-email']").val("att1@example.com");39 $("input[name='2-name']").val("Att2");40 $("input[name='2-phone']").val("222 222");41 $("input[name='2-email']").val("att2@example.com");42 $("input[name='3-name']").val("Att3");43 $("input[name='3-phone']").val("333 333");44 $("input[name='3-email']").val("att3@example.com");45 },46 },47 {48 content: "Validate attendees details",49 extra_trigger: "input[name='1-name'], input[name='2-name'], input[name='3-name']",50 trigger: 'button:contains("Continue")',51 },52 {53 content: "Check that the cart contains exactly 3 triggers",54 trigger: 'a:has(.my_cart_quantity:containsExact(3))',55 run: function () {}, // it's a check56 },57 {58 content: "go to cart",59 trigger: 'a:contains(Return to Cart)',60 },61 {62 content: "Modify the cart to add 1 unit of `VIP` ticket type",63 extra_trigger: "#cart_products:contains(Standard):contains(VIP)",64 trigger: "#cart_products tr:contains(VIP) .fa-plus",65 },66 {67 content: "Now click on `Process Checkout`",68 extra_trigger: 'a:has(.my_cart_quantity):contains(4)',69 trigger: '.btn-primary:contains("Process Checkout")'70 },71 {72 content: "Complete the checkout",73 trigger: 'a[href="/shop/confirm_order"]:contains("Confirm")',74 },75 {76 content: "Check that the subtotal is 5,500.00 USD", // this test will fail if the currency of the main company is not USD77 trigger: '#order_total_untaxed .oe_currency_value:contains("5,500.00")',78 run: function () {}, // it's a check79 },80 {81 content: "Select `Wire Transfer` payment method",82 trigger: '#payment_method label:contains("Wire Transfer")',83 },84 {85 content: "Pay",86 //Either there are multiple payment methods, and one is checked, either there is only one, and therefore there are no radio inputs87 extra_trigger: '#payment_method label:contains("Wire Transfer") input:checked,#payment_method:not(:has("input:radio:visible"))',88 trigger: 'button[id="o_payment_form_pay"]:visible',89 },90 {91 content: "Last step",92 trigger: '.oe_website_sale:contains("Thank you for your order")',93 timeout: 30000,94 }95 ]96);...

Full Screen

Full Screen

tree.js

Source:tree.js Github

copy

Full Screen

1module.exports = {2 'tree': function (browser) {3 browser4 .url('http://localhost:8080/examples/tree/')5 .waitForElementVisible('li', 1000)6 .assert.count('.item', 12)7 .assert.count('.add', 4)8 .assert.count('.item > ul', 4)9 .assert.notVisible('#demo li ul')10 .assert.containsText('#demo li div span', '[+]')11 // expand root12 .click('.bold')13 .assert.visible('#demo ul')14 .assert.evaluate(function () {15 return document.querySelector('#demo li ul').children.length === 416 })17 .assert.containsText('#demo li div span', '[-]')18 .assert.containsText('#demo > .item > ul > .item:nth-child(1)', 'hello')19 .assert.containsText('#demo > .item > ul > .item:nth-child(2)', 'wat')20 .assert.containsText('#demo > .item > ul > .item:nth-child(3)', 'child folder')21 .assert.containsText('#demo > .item > ul > .item:nth-child(3)', '[+]')22 // add items to root23 .click('#demo > .item > ul > .add')24 .assert.evaluate(function () {25 return document.querySelector('#demo li ul').children.length === 526 })27 .assert.containsText('#demo > .item > ul > .item:nth-child(1)', 'hello')28 .assert.containsText('#demo > .item > ul > .item:nth-child(2)', 'wat')29 .assert.containsText('#demo > .item > ul > .item:nth-child(3)', 'child folder')30 .assert.containsText('#demo > .item > ul > .item:nth-child(3)', '[+]')31 .assert.containsText('#demo > .item > ul > .item:nth-child(4)', 'new stuff')32 // add another item33 .click('#demo > .item > ul > .add')34 .assert.evaluate(function () {35 return document.querySelector('#demo li ul').children.length === 636 })37 .assert.containsText('#demo > .item > ul > .item:nth-child(1)', 'hello')38 .assert.containsText('#demo > .item > ul > .item:nth-child(2)', 'wat')39 .assert.containsText('#demo > .item > ul > .item:nth-child(3)', 'child folder')40 .assert.containsText('#demo > .item > ul > .item:nth-child(3)', '[+]')41 .assert.containsText('#demo > .item > ul > .item:nth-child(4)', 'new stuff')42 .assert.containsText('#demo > .item > ul > .item:nth-child(5)', 'new stuff')43 .click('#demo ul .bold')44 .assert.visible('#demo ul ul')45 .assert.containsText('#demo ul > .item:nth-child(3)', '[-]')46 .assert.evaluate(function () {47 return document.querySelector('#demo ul ul').children.length === 548 })49 .click('.bold')50 .assert.notVisible('#demo ul')51 .assert.containsText('#demo li div span', '[+]')52 .click('.bold')53 .assert.visible('#demo ul')54 .assert.containsText('#demo li div span', '[-]')55 .dblClick('#demo ul > .item div')56 .assert.count('.item', 15)57 .assert.count('.item > ul', 5)58 .assert.containsText('#demo ul > .item:nth-child(1)', '[-]')59 .assert.evaluate(function () {60 var firstItem = document.querySelector('#demo ul > .item:nth-child(1)')61 var ul = firstItem.querySelector('ul')62 return ul.children.length === 263 })64 .end()65 }...

Full Screen

Full Screen

select2.js

Source:select2.js Github

copy

Full Screen

1/* globals vm */2module.exports = {3 'select2': function (browser) {4 browser5 .url('http://localhost:8080/examples/select2/')6 .waitForElementVisible('.select2', 1000)7 .assert.elementPresent('select')8 .assert.containsText('p', 'Selected: 0')9 .assert.containsText('span.select2', 'Select one')10 .moveToElement('span.select2', 5, 5).mouseButtonClick()11 .assert.count('.select2-results__option', 3)12 .assert.containsText('.select2-results__option:nth-child(1)', 'Select one')13 .assert.containsText('.select2-results__option:nth-child(2)', 'Hello')14 .assert.containsText('.select2-results__option:nth-child(3)', 'World')15 .assert.attributePresent('.select2-results__option:nth-child(1)', 'aria-disabled')16 .click('.select2-results__option:nth-child(2)')17 .assert.count('.select2-results__option', 0)18 .assert.containsText('p', 'Selected: 1')19 .assert.containsText('span.select2', 'Hello')20 // test dynamic options21 .execute(function () {22 vm.options.push({ id: 3, text: 'Vue' })23 })24 .moveToElement('span.select2', 5, 5).mouseButtonClick()25 .assert.count('.select2-results__option', 4)26 .assert.containsText('.select2-results__option:nth-child(1)', 'Select one')27 .assert.containsText('.select2-results__option:nth-child(2)', 'Hello')28 .assert.containsText('.select2-results__option:nth-child(3)', 'World')29 .assert.containsText('.select2-results__option:nth-child(4)', 'Vue')30 .click('.select2-results__option:nth-child(4)')31 .assert.count('.select2-results__option', 0)32 .assert.containsText('p', 'Selected: 3')33 .assert.containsText('span.select2', 'Vue')34 .execute(function () {35 vm.selected = 236 })37 .assert.containsText('p', 'Selected: 2')38 .assert.containsText('span.select2', 'World')39 .end()40 }...

Full Screen

Full Screen

deDupe.recursive.spec.js

Source:deDupe.recursive.spec.js Github

copy

Full Screen

1var deDupe = require("../../../lib/algorithms/2-linkedLists/deDupe.recursive.js");2var LinkedList = require("../../../lib/dataStructures/linkedList.js");3describe('When using the recursive deDupe() on a linked list of integers', function () {4 var containsDupes;5 var noDupes;6 beforeEach(function() {7 containsDupes = new LinkedList();8 containsDupes.add(1);9 containsDupes.add(2);10 containsDupes.add(1);11 containsDupes.add(3);12 containsDupes.add(4);13 containsDupes.add(4);14 containsDupes.add(4);15 containsDupes.add(5);16 containsDupes.add(6);17 containsDupes.add(6);18 containsDupes.add(6);19 noDupes = new LinkedList();20 noDupes.add(1);21 noDupes.add(2);22 noDupes.add(3);23 noDupes.add(4);24 noDupes.add(5);25 noDupes.add(6);26 });27 it('any duplicate elements will be removed from the linked list.', function () {28 var result = deDupe(containsDupes.start);29 expect(JSON.stringify(result)).toEqual(JSON.stringify(noDupes.start));30 });31 it('if there are no dups, nothing will happen', function () {32 var result = deDupe(noDupes.start);33 expect(JSON.stringify(result)).toEqual(JSON.stringify(noDupes.start));34 });...

Full Screen

Full Screen

deDupe.spec.js

Source:deDupe.spec.js Github

copy

Full Screen

1var deDupe = require("../../../lib/algorithms/2-linkedLists/deDupe.js");2var LinkedList = require("../../../lib/dataStructures/linkedList.js");3describe('When using deDupe() on a linked list of integers', function () {4 var containsDupes;5 var noDupes;6 beforeEach(function() {7 containsDupes = new LinkedList();8 containsDupes.add(1);9 containsDupes.add(2);10 containsDupes.add(1);11 containsDupes.add(3);12 containsDupes.add(4);13 containsDupes.add(4);14 containsDupes.add(4);15 containsDupes.add(5);16 containsDupes.add(6);17 containsDupes.add(6);18 containsDupes.add(6);19 noDupes = new LinkedList();20 noDupes.add(1);21 noDupes.add(2);22 noDupes.add(3);23 noDupes.add(4);24 noDupes.add(5);25 noDupes.add(6);26 });27 it('any duplicate elements will be removed from the linked list.', function () {28 var result = deDupe(containsDupes.start);29 expect(JSON.stringify(result)).toEqual(JSON.stringify(noDupes.start));30 });31 it('if there are no dups, nothing will happen', function () {32 var result = deDupe(noDupes.start);33 expect(JSON.stringify(result)).toEqual(JSON.stringify(noDupes.start));34 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1it('should contain a text', () => {2 cy.contains('Hello World')3})4it('should contain a text', () => {5 cy.get('h1').should('contain', 'Hello World')6})7it('should contain a text', () => {8 cy.get('h1').should('have.text', 'Hello World')9})10it('should contain a text', () => {11 cy.get('h1').should('have.text', 'Hello World')12})13it('should contain a text', () => {14 cy.get('h1').should('have.text', 'Hello World')15})16it('should contain a text', () => {17 cy.get('h1').should('have.text', 'Hello World')18})19it('should contain a text', () => {20 cy.get('h1').should('have.text', 'Hello World')21})22it('should contain a text', () => {23 cy.get('h1').should('have.text', 'Hello World')24})25it('should contain a text', () => {26 cy.get('h1').should('have.text', 'Hello World')27})28it('should contain a text', () => {29 cy.get('h1').should('have.text', 'Hello World')30})31it('should contain a text', () => {32 cy.get('h1').should('have.text', 'Hello World')33})34it('should contain a text', () => {35 cy.get('h1').should('have.text', 'Hello World')36})37it('should contain a text', () => {38 cy.get('h1').should('have.text', 'Hello World')39})40it('should contain a text', () => {41 cy.get('h1').should('have.text', '

Full Screen

Using AI Code Generation

copy

Full Screen

1it('Test contains method', function(){2 cy.get('#contact-us').contains('Contact Us')3})4it('Test contains method', function(){5 cy.get('#contact-us').contains('Contact Us').click()6})7it('Test contains method', function(){8 cy.get('#contact-us').contains('Contact Us').click()9 cy.get('[name="first_name"]').type('Anil')10})11it('Test contains method', function(){12 cy.get('#contact-us').contains('Contact Us').click()13 cy.get('[name="first_name"]').type('Anil')14 cy.get('[name="last_name"]').type('Kumar')15})16it('Test contains method', function(){17 cy.get('#contact-us').contains('Contact Us').click()18 cy.get('[name="first_name"]').type('Anil')19 cy.get('[name="last_name"]').type('Kumar')20 cy.get('[name="email"]').type('

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('input').contains('Submit')2cy.get('input').then(($input) => {3 expect($input).to.contain('Submit')4})5cy.get('input').contains('Submit')6cy.get('input').then(($input) => {7 expect($input).to.contain('Submit')8})9cy.get('input').contains('Submit')10cy.get('input').then(($input) => {11 expect($input).to.contain('Submit')12})13cy.get('input').contains('Submit')14cy.get('input').then(($input) => {15 expect($input).to.contain('Submit')16})17cy.get('input').contains('Submit')18cy.get('input').then(($input) => {19 expect($input).to.contain('Submit')20})21cy.get('input').contains('Submit')22cy.get('input').then(($input) => {23 expect($input).to.contain('Submit')24})25cy.get('input').contains('Submit')26cy.get('input').then(($input) => {27 expect($input).to.contain('Submit')28})29cy.get('input').contains('Submit')30cy.get('input').then(($input) => {31 expect($input).to.contain('Submit')32})33cy.get('input').contains('Submit')34cy.get('input').then(($input) => {35 expect($input).to.contain('Submit')36})

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('input').contains('Sign in')2cy.get('input').then($input => {3 if($input.contains('Sign in')) {4 }5})6cy.get('input').then($input => {7 if(_.contains($input, 'Sign in')) {8 }9})10cy.get('input').includes('Sign in')11cy.get('input').then($input => {12 if($input.includes('Sign in')) {13 }14})15cy.get('input').then($input => {16 if(_.includes($input, 'Sign in')) {17 }18})19cy.get('input').invoke('val')20cy.get('input').then($input => {21 $input.invoke('val')22})23cy.get('input').then($input => {24 _.invoke($input, 'val')25})26cy.get('input').is(':visible')27cy.get('input').then($input => {28 $input.is(':visible')29})30cy.get('input').then($input => {31 _.is($input, ':visible')32})33cy.get('input').isEmpty()34cy.get('input').then($input => {35 $input.isEmpty()36})37cy.get('input').then($input => {38 _.isEmpty($input)39})40cy.get('input').isMatch({name: 'John'})41cy.get('input').then($input => {42 $input.isMatch({name: 'John'})43})

Full Screen

Using AI Code Generation

copy

Full Screen

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('Does not do much!', function() {8 cy.contains('type').click()9 })10})11describe('My First Test', function() {12 it('Does not do much!', function() {13 cy.contains('type').click()14 cy.url().should('include', '/commands/actions')15 })16})17describe('My First Test', function() {18 it('Does not do much!', function() {19 cy.contains('type').click()20 cy.url().should('include', '/commands/actions')21 cy.get('.action-email')22 .type('

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('h1').contains('Hello World');2cy.get('h1').should('contain', 'Hello World');3cy.get('h1').should('have.text', 'Hello World');4cy.get('h1').contains('Hello World');5cy.get('h1').should('contain', 'Hello World');6cy.get('h1').should('have.text', 'Hello World');7cy.get('h1').contains('Hello World');8cy.get('h1').should('contain', 'Hello World');9cy.get('h1').should('have.text', 'Hello World');10cy.get('h1').contains('Hello World');11cy.get('h1').should('contain', 'Hello World');12cy.get('h1').should('have.text', 'Hello World');13cy.get('h1').contains('Hello World');14cy.get('h1

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.contains('name of element').click();2cy.contains('name of element').type('text to be typed');3cy.contains('name of element').should('have.text', 'text to be checked');4cy.contains('name of element').should('be.visible');5cy.contains('name of element').should('be.visible').and('have.text', 'text to be checked');6cy.contains('name of element').should('be.visible').and('have.text', 'text to be checked').click();7cy.contains('name of element').should('be.visible').and('have.text', 'text to be checked').type('text to be typed');8cy.contains('name of element').should('be.visible').and('have.text', 'text to be checked').click().type('text to be typed');9cy.contains('name of element').should('be.visible').and('have.text', 'text to be checked').click().type('text to be typed').click();10cy.contains('name of element').should('be.visible').and('have.text', 'text to be checked').click().type('text to be typed').click().type('text to be typed');11cy.contains('name of element').should('be.visible').and('have.text', 'text to be checked').click().type('text to be typed').click().type('text to be typed').click();12cy.contains('name of element').should('be.visible').and('have.text', 'text to be checked').click().type('text to be typed').click().type('text to be typed').click().type('text to be typed');13cy.contains('

Full Screen

Cypress Tutorial

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.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

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.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress 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