Best JavaScript code snippet using playwright-internal
RefSpec.js
Source:RefSpec.js
...3const { expect } = require('chai');4describe('Ref', () => {5 describe('#isRef', () => {6 it('should handle invalid refs', () => {7 expect(Ref.isRef(6786876)).to.equal(false);8 expect(Ref.isRef({})).to.equal(false);9 expect(Ref.isRef(false)).to.equal(false);10 expect(Ref.isRef('yar')).to.equal(false);11 expect(Ref.isRef(null)).to.equal(false);12 expect(Ref.isRef()).to.equal(false);13 expect(Ref.isRef('/defect')).to.equal(false);14 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/1.32/defect/abc.js')).to.equal(false);15 expect(Ref.isRef('')).to.equal(false);16 });17 it('should handle basic refs', () => {18 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/1.17/builddefinition/81177657')).to.equal(true);19 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/1.17/builddefinition/81177657.js')).to.equal(true);20 expect(Ref.isRef('/builddefinition/81177657.js')).to.equal(true);21 expect(Ref.isRef('/builddefinition/81177657')).to.equal(true);22 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/builddefinition/3493b049-3ea7-4c9a-bf78-069487936c13')).to.equal(true);23 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/builddefinition/3493b0493ea74c9abf78069487936c13')).to.equal(true);24 expect(Ref.isRef('/builddefinition/3493b049-3ea7-4c9a-bf78-069487936c13')).to.equal(true);25 expect(Ref.isRef('/builddefinition/3493b0493ea74c9abf78069487936c13')).to.equal(true);26 });27 it('should handle permission refs', () => {28 expect(Ref.isRef('/projectpermission/1234u5678p1')).to.equal(true);29 expect(Ref.isRef('/projectpermission/1234u5678p1.js')).to.equal(true);30 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/projectpermission/1234u5678p1.js')).to.equal(true);31 expect(Ref.isRef('/workspacepermission/1234u5678w1')).to.equal(true);32 expect(Ref.isRef('/workspacepermission/1234u5678w1.js')).to.equal(true);33 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/workspacepermission/1234u5678w1.js')).to.equal(true);34 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/workspacepermission/1637adf8-0830-4a48-9420-fb5bdb8575d6u3497d043-3ea7-4c2c-bf78-069847936c13w1')).to.equal(true);35 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/workspacepermission/1637adf808304a489420fb5bdb8575d6u3497d0433ea74c2cbf78069847936c13w1')).to.equal(true);36 expect(Ref.isRef('/workspacepermission/1637adf8-0830-4a48-9420-fb5bdb8575d6u3497d043-3ea7-4c2c-bf78-069847936c13w1')).to.equal(true);37 expect(Ref.isRef('/workspacepermission/1637adf808304a489420fb5bdb8575d6u3497d0433ea74c2cbf78069847936c13w1')).to.equal(true);38 });39 it('should handle built-in refs', () => {40 expect(Ref.isRef('/typedefinition/-1234.js')).to.equal(true);41 expect(Ref.isRef('/typedefinition/-1234')).to.equal(true);42 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/-1234')).to.equal(true);43 expect(Ref.isRef('/typedefinition/-1234/attributes')).to.equal(true);44 });45 it('should handle objects', () => {46 expect(Ref.isRef({ _ref: '/defect/12345' })).to.equal(true);47 expect(Ref.isRef({ _ref: 'https://rally1.rallydev.com/slm/webservice/v2.0/defect/12345' })).to.equal(true);48 expect(Ref.isRef({ _ref: 'https://rally1.rallydev.com/slm/webservice/v3.0/defect/3493b049-3ea7-4c9a-bf78-069487936c13' })).to.equal(true);49 expect(Ref.isRef({ _ref: 'https://rally1.rallydev.com/slm/webservice/v3.0/defect/3493b0493ea74c9abf78069487936c13' })).to.equal(true);50 expect(Ref.isRef({ _ref: '/defect/3493b049-3ea7-4c9a-bf78-069487936c13' })).to.equal(true);51 expect(Ref.isRef({ _ref: '/defect/3493b0493ea74c9abf78069487936c13' })).to.equal(true);52 });53 it('should handle dynatype refs', () => {54 expect(Ref.isRef('/portfolioitem/feature/1234')).to.equal(true);55 expect(Ref.isRef('/portfolioitem/feature/1234.js')).to.equal(true);56 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/1.32/portfolioitem/feature/1234')).to.equal(true);57 expect(Ref.isRef('http://rally1.rallydev.com/slm/webservice/1.32/portfolioitem/feature/1234.js')).to.equal(true);58 expect(Ref.isRef('/portfolioitem/feature/1234/children.js')).to.equal(true);59 expect(Ref.isRef('/portfolioitem/feature/1234/children')).to.equal(true);60 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/feature/1234/children')).to.equal(true);61 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/portfolioitem/feature/3493b049-3ea7-4c9a-bf78-069487936c13/children')).to.equal(true);62 expect(Ref.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/portfolioitem/feature/3493b0493ea74c9abf78069487936c13/children')).to.equal(true);63 expect(Ref.isRef('/portfolioitem/feature/3493b049-3ea7-4c9a-bf78-069487936c13/children')).to.equal(true);64 expect(Ref.isRef('/portfolioitem/feature/3493b0493ea74c9abf78069487936c13/children')).to.equal(true);65 });66 });67 describe('#getRelative', () => {68 it('should handle non-refs', () => {69 expect(!Ref.getRelative('blah'));70 expect(!Ref.getRelative(''));71 expect(!Ref.getRelative(null));72 expect(!Ref.getRelative({}));73 expect(!Ref.getRelative({ _ref: null }));74 });75 it('should handle basic refs', () => {76 expect(Ref.getRelative('/defect/1234')).to.equal('/defect/1234');77 expect(Ref.getRelative('/defect/1234.js')).to.equal('/defect/1234');78 expect(Ref.getRelative('https://rally1.rallydev.com/slm/webservice/1.32/defect/1234')).to.equal('/defect/1234');...
ref.spec.js
Source:ref.spec.js
...3const refUtils = rally.util.ref;4describe('Ref', () => {5 describe('#isRef', () => {6 it('should handle invalid refs', () => {7 refUtils.isRef(6786876).should.eql(false);8 refUtils.isRef({}).should.eql(false);9 refUtils.isRef(false).should.eql(false);10 refUtils.isRef('yar').should.eql(false);11 refUtils.isRef(null).should.eql(false);12 refUtils.isRef().should.eql(false);13 refUtils.isRef('/defect').should.eql(false);14 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/1.32/defect/abc.js').should.eql(false);15 refUtils.isRef('').should.eql(false);16 });17 it('should handle basic refs', () => {18 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/1.17/builddefinition/81177657').should.eql(true);19 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/1.17/builddefinition/81177657.js').should.eql(true);20 refUtils.isRef('/builddefinition/81177657.js').should.eql(true);21 refUtils.isRef('/builddefinition/81177657').should.eql(true);22 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/builddefinition/3493b049-3ea7-4c9a-bf78-069487936c13').should.eql(true);23 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/builddefinition/3493b0493ea74c9abf78069487936c13').should.eql(true);24 refUtils.isRef('/builddefinition/3493b049-3ea7-4c9a-bf78-069487936c13').should.eql(true);25 refUtils.isRef('/builddefinition/3493b0493ea74c9abf78069487936c13').should.eql(true);26 });27 it('should handle permission refs', () => {28 refUtils.isRef('/projectpermission/1234u5678p1').should.eql(true);29 refUtils.isRef('/projectpermission/1234u5678p1.js').should.eql(true);30 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/projectpermission/1234u5678p1.js').should.eql(true);31 refUtils.isRef('/workspacepermission/1234u5678w1').should.eql(true);32 refUtils.isRef('/workspacepermission/1234u5678w1.js').should.eql(true);33 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/workspacepermission/1234u5678w1.js').should.eql(true);34 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/workspacepermission/1637adf8-0830-4a48-9420-fb5bdb8575d6u3497d043-3ea7-4c2c-bf78-069847936c13w1').should.eql(true);35 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/workspacepermission/1637adf808304a489420fb5bdb8575d6u3497d0433ea74c2cbf78069847936c13w1').should.eql(true);36 refUtils.isRef('/workspacepermission/1637adf8-0830-4a48-9420-fb5bdb8575d6u3497d043-3ea7-4c2c-bf78-069847936c13w1').should.eql(true);37 refUtils.isRef('/workspacepermission/1637adf808304a489420fb5bdb8575d6u3497d0433ea74c2cbf78069847936c13w1').should.eql(true);38 });39 it('should handle built-in refs', () => {40 refUtils.isRef('/typedefinition/-1234.js').should.eql(true);41 refUtils.isRef('/typedefinition/-1234').should.eql(true);42 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/-1234').should.eql(true);43 refUtils.isRef('/typedefinition/-1234/attributes').should.eql(true);44 });45 it('should handle objects', () => {46 refUtils.isRef({_ref: '/defect/12345'}).should.eql(true);47 refUtils.isRef({_ref: 'https://rally1.rallydev.com/slm/webservice/v2.0/defect/12345'}).should.eql(true);48 refUtils.isRef({_ref: 'https://rally1.rallydev.com/slm/webservice/v3.0/defect/3493b049-3ea7-4c9a-bf78-069487936c13'}).should.eql(true);49 refUtils.isRef({_ref: 'https://rally1.rallydev.com/slm/webservice/v3.0/defect/3493b0493ea74c9abf78069487936c13'}).should.eql(true);50 refUtils.isRef({_ref: '/defect/3493b049-3ea7-4c9a-bf78-069487936c13'}).should.eql(true);51 refUtils.isRef({_ref: '/defect/3493b0493ea74c9abf78069487936c13'}).should.eql(true);52 });53 it('should handle dynatype refs', () => {54 refUtils.isRef('/portfolioitem/feature/1234').should.eql(true);55 refUtils.isRef('/portfolioitem/feature/1234.js').should.eql(true);56 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/1.32/portfolioitem/feature/1234').should.eql(true);57 refUtils.isRef('http://rally1.rallydev.com/slm/webservice/1.32/portfolioitem/feature/1234.js').should.eql(true);58 refUtils.isRef('/portfolioitem/feature/1234/children.js').should.eql(true);59 refUtils.isRef('/portfolioitem/feature/1234/children').should.eql(true);60 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v2.0/portfolioitem/feature/1234/children').should.eql(true);61 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/portfolioitem/feature/3493b049-3ea7-4c9a-bf78-069487936c13/children').should.eql(true);62 refUtils.isRef('https://rally1.rallydev.com/slm/webservice/v3.0/portfolioitem/feature/3493b0493ea74c9abf78069487936c13/children').should.eql(true);63 refUtils.isRef('/portfolioitem/feature/3493b049-3ea7-4c9a-bf78-069487936c13/children').should.eql(true);64 refUtils.isRef('/portfolioitem/feature/3493b0493ea74c9abf78069487936c13/children').should.eql(true);65 });66 });67 describe('#getRelative', () => {68 it('should handle non-refs', () => {69 should.not.exist(refUtils.getRelative('blah'));70 should.not.exist(refUtils.getRelative(''));71 should.not.exist(refUtils.getRelative(null));72 should.not.exist(refUtils.getRelative({}));73 should.not.exist(refUtils.getRelative({_ref: null}));74 });75 it('should handle basic refs', () => {76 refUtils.getRelative('/defect/1234').should.eql('/defect/1234');77 refUtils.getRelative('/defect/1234.js').should.eql('/defect/1234');78 refUtils.getRelative('https://rally1.rallydev.com/slm/webservice/1.32/defect/1234').should.eql('/defect/1234');...
index.js
Source:index.js
...74 }75 return result;76 }77 multiple(base) {78 const isRef = Ref.isRef(base);79 if (!isRef) {80 Hoek.assert(typeof base === 'number' && isFinite(base), 'multiple must be a number');81 Hoek.assert(base > 0, 'multiple must be greater than 0');82 }83 return this._test('multiple', base, function (value, state, options) {84 const divisor = isRef ? base(state.reference || state.parent, options) : base;85 if (isRef && (typeof divisor !== 'number' || !isFinite(divisor))) {86 return this.createError('number.ref', { ref: base.key }, state, options);87 }88 if (value % divisor === 0) {89 return value;90 }91 return this.createError('number.multiple', { multiple: base, value }, state, options);92 });93 }94 integer() {95 return this._test('integer', undefined, function (value, state, options) {96 return Math.trunc(value) - value === 0 ? value : this.createError('number.integer', { value }, state, options);97 });98 }99 unsafe(enabled = true) {100 Hoek.assert(typeof enabled === 'boolean', 'enabled must be a boolean');101 if (this._flags.unsafe === enabled) {102 return this;103 }104 const obj = this.clone();105 obj._flags.unsafe = enabled;106 return obj;107 }108 negative() {109 return this._test('negative', undefined, function (value, state, options) {110 if (value < 0) {111 return value;112 }113 return this.createError('number.negative', { value }, state, options);114 });115 }116 positive() {117 return this._test('positive', undefined, function (value, state, options) {118 if (value > 0) {119 return value;120 }121 return this.createError('number.positive', { value }, state, options);122 });123 }124 precision(limit) {125 Hoek.assert(Number.isSafeInteger(limit), 'limit must be an integer');126 Hoek.assert(!('precision' in this._flags), 'precision already set');127 const obj = this._test('precision', limit, function (value, state, options) {128 const places = value.toString().match(internals.precisionRx);129 const decimals = Math.max((places[1] ? places[1].length : 0) - (places[2] ? parseInt(places[2], 10) : 0), 0);130 if (decimals <= limit) {131 return value;132 }133 return this.createError('number.precision', { limit, value }, state, options);134 });135 obj._flags.precision = limit;136 return obj;137 }138 port() {139 return this._test('port', undefined, function (value, state, options) {140 if (!Number.isSafeInteger(value) || value < 0 || value > 65535) {141 return this.createError('number.port', { value }, state, options);142 }143 return value;144 });145 }146};147internals.compare = function (type, compare) {148 return function (limit) {149 const isRef = Ref.isRef(limit);150 const isNumber = typeof limit === 'number' && !isNaN(limit);151 Hoek.assert(isNumber || isRef, 'limit must be a number or reference');152 return this._test(type, limit, function (value, state, options) {153 let compareTo;154 if (isRef) {155 compareTo = limit(state.reference || state.parent, options);156 if (!(typeof compareTo === 'number' && !isNaN(compareTo))) {157 return this.createError('number.ref', { ref: limit.key }, state, options);158 }159 }160 else {161 compareTo = limit;162 }163 if (compare(value, compareTo)) {...
historyMapper.js
Source:historyMapper.js
1module.exports = {2 LEAD: {3 collectionName: 'Opportunities',4 map: {5 isOpportunitie: {6 name : 'Is Opportunitie',7 isRef: false8 },9 'createdBy.date': {10 name : 'Creation Date',11 isRef: false12 },13 'expectedRevenue.value': {14 name : 'Amount',15 isRef: false16 },17 expectedClosing: {18 name : 'Close Date',19 isRef: false20 },21 salesPerson: {22 name : 'Person',23 isRef : true,24 collection: 'Employees',25 project : {$concat: ['$tmp.name.first', ' ', '$tmp.name.last']}26 },27 workflow: {28 name : 'workflow',29 isRef : true,30 collection: 'workflows',31 project : '$tmp.name'32 }33 }34 },35 OPPORTUNITIE: {36 collectionName: 'Opportunities',37 map: {38 isOpportunitie: {39 name : 'Is Opportunitie',40 isRef: false41 },42 'expectedRevenue.value': {43 name : 'Amount',44 isRef: false45 },46 expectedClosing: {47 name : 'Close Date',48 isRef: false49 },50 salesPerson: {51 name : 'Assigned To',52 isRef : true,53 collection: 'Employees',54 project : {$concat: ['$tmp.name.first', ' ', '$tmp.name.last']}55 },56 workflow: {57 name : 'workflow',58 isRef : true,59 collection: 'workflows',60 project : '$tmp.name'61 },62 'createdBy.date': {63 name : 'Creation Date',64 isRef: false65 }66 }67 },68 INVOICE: {69 collectionName: 'Invoice',70 map: {71 approved: {72 name : 'Approved',73 isRef: false74 },75 workflow: {76 name : 'Status',77 isRef : true,78 collection: 'workflows',79 project : '$tmp.name'80 },81 dueDate: {82 name : 'Due Date',83 isRef: false84 },85 invoiceDate: {86 name : 'Invoice Date',87 isRef: false88 },89 'createdBy.date': {90 name : 'Creation Date',91 isRef: false92 }93 }94 },95 ORDER: {96 collectionName: 'ORDER',97 map: {98 'status.fulfillStatus': {99 name : 'Fulfilled',100 isRef: false101 },102 orderDate: {103 name : 'Order Date',104 isRef: false105 },106 expectedDate: {107 name : 'Payment Due Date',108 isRef: false109 },110 workflow: {111 name : 'Status',112 isRef : true,113 collection: 'workflows',114 project : '$tmp.name'115 },116 'createdBy.date': {117 name : 'Creation Date',118 isRef: false119 }120 }121 },122 MANUFACTURINGORDER: {123 collectionName: 'manufacturingOrder',124 map: {125 'status.fulfillStatus': {126 name : 'Fulfilled',127 isRef: false128 },129 orderDate: {130 name : 'Order Date',131 isRef: false132 },133 expectedDate: {134 name : 'Payment Due Date',135 isRef: false136 },137 workflow: {138 name : 'Status',139 isRef : true,140 collection: 'workflows',141 project : '$tmp.name'142 },143 'createdBy.date': {144 name : 'Creation Date',145 isRef: false146 }147 }148 },149 PERSON: {150 collectionName: 'Persons',151 map: {152 skype: {153 name : 'Skype',154 isRef: false155 },156 'createdBy.date': {157 name : 'Creation Date',158 isRef: false159 },160 email: {161 name : 'Email',162 isRef: false163 },164 'social.LI': {165 name : 'LinkedIn',166 isRef: false167 },168 'social.FB': {169 name : 'Facebook',170 isRef: false171 },172 dateBirth: {173 name : 'Date of Birth',174 isRef: false175 },176 'name.first': {177 name : 'First Name',178 isRef: false179 },180 'name.last': {181 name : 'Last Name',182 isRef: false183 },184 jobPosition: {185 name : 'Job Position',186 isRef: false187 },188 'address.country': {189 name : 'Country',190 isRef: false191 }192 }193 },194 COMPANY: {195 collectionName: 'Companies',196 map: {197 email: {198 name : 'Email',199 isRef: false200 },201 'social.LI': {202 name : 'LinkedIn',203 isRef: false204 },205 website: {206 name : 'Website',207 isRef: false208 },209 'social.FB': {210 name : 'Facebook',211 isRef: false212 },213 'name.first': {214 name : 'Name',215 isRef: false216 },217 'address.country': {218 name : 'Country',219 isRef: false220 },221 'salesPurchases.salesPerson': {222 name : 'Assigned To',223 isRef : true,224 collection: 'Employees',225 project : {$concat: ['$tmp.name.first', ' ', '$tmp.name.last']}226 },227 'createdBy.date': {228 name : 'Creation Date',229 isRef: false230 }231 }232 },233 DEALTASK: {234 collectionName: 'DealTasks',235 map: {236 description: {237 name : 'Description',238 isRef: false239 },240 assignedTo: {241 name : 'Assigned To',242 isRef : true,243 collection: 'Employees',244 project : {$concat: ['$tmp.name.first', ' ', '$tmp.name.last']}245 },246 workflow: {247 name : 'Stage',248 isRef : true,249 collection: 'workflows',250 project : '$tmp.name'251 },252 'createdBy.date': {253 name : 'Creation Date',254 isRef: false255 }256 }257 }...
sys_dialog.js
Source:sys_dialog.js
1/**2 * JS å¼¹åºæ示3 * Created by jinhui on 2014/9/23.4 */5var icons={6 error:"error",7 loading:"loading",8 question:"question",9 succeed:"succeed",10 warning:"warning"11}12function conTip(msg){13 conTip(msg,icons.succeed,false);14}15/**16 * å计æ¶èªå¨å
³éæ示ï¼ä¸éå±ï¼17 * @param msg æ示信æ¯18 * @param icon ICONå¾æ 19 */20function conTip(msg,icon,isRef) {21 conTipLock(msg,icon,isRef,null);22}23function conTip(msg,icon,isRef,url){24 var timer;25 art.dialog({26 id: 'tipdialog',27 icon: icon,28 fixed: true,29 drag: false,30 left:'50%',31 top:'150px',32 resize: false,33 content: msg,34 ok:function(){35 if(isRef){36 if(url==null) {37 location.reload();38 }else{39 location.href=url;40 }41 }42 },43 okVal:'ç¡®å®',44 close: function () {45 if(isRef){46 if(url==null) {47 window.location.reload();48 }else{49 window.location.href=url;50 }51 }52 }53 }).show();54}55function conTipLock(msg){56 conTip(msg,icons.succeed);57}58function conTipLock(msg,icon,isRef) {59 conTipLock(msg,icon,isRef,null);60}61/**62 * å计æ¶èªå¨å
³éæ示ï¼å¸¦éå±ï¼63 * @param msg æ示信æ¯64 * @param icon ICONå¾æ 65 */66function conTipLock(msg,icon,isRef,url){67 art.dialog({68 lock: true,69 background: '#000', // èæ¯è²70 opacity: 0.66, // éæ度71 id: 'tipdialog',72 icon: icon,73 fixed: true,74 drag: false,75 left:'50%',76 top:'150px',77 resize: false,78 content: msg,79 ok:function(){80 if(isRef){81 if(url==null) {82 window.location.reload();83 }else{84 window.location.href=url;85 }86 }87 },88 okVal:'ç¡®å®',89 close: function () {90 if(isRef){91 if(url==null) {92 window.location.reload();93 }else{94 window.location.href=url;95 }96 }97 }98 }).show();99}100artDialog.prompt = function (content, yes, placeholder, value) {101 value = value || '';102 placeholder = placeholder || '';103 var input;104 return artDialog({105 id: 'Prompt',106 icon: 'question',107 fixed: true,108 lock: true,109 opacity: .1,110 content: [111 '<div style="margin-bottom:5px;font-size:12px">',112 content,113 '</div>',114 '<div>',115 '<input value="',116 value,117 '" placeholder="',118 placeholder,119 '" maxlength="6" style="width:18em;padding:3px" />',120 '</div>'121 ].join(''),122 init: function () {123 input = this.DOM.content.find('input')[0];124 input.select();125 input.focus();126 },127 ok: function (here) {128 return yes && yes.call(this, input.value, here);129 },130 cancel: true131 });132};133/*134 * 带å
³éæé®æ示135 */136function conCancel(msg){137 conCancel(msg,icons.succeed,'å
³é');138}139function conCancel(msg,btnName){140 conCancel(msg,icons.succeed,btnName);141}142/**143 * æ示信æ¯ï¼ä¸éå±ï¼144 * @param msg éè¦æ示çä¿¡æ¯145 * @param icon ICONå¾æ 146 * @param btnName å
³éæé®å称147 */148function conCancel(msg,icon,btnName){149 art.dialog({150 icon: icon,151 content: msg,152 fixed: true,153 drag: false,154 left:'50%',155 top:'150px',156 resize: false,157 cancelVal: btnName,158 cancel: true //为trueçä»·äºfunction(){}159 });160}161function conCancelLock(msg){162 conCancel(msg,icons.succeed,'å
³é');163}164function conCancelLock(msg,btnName){165 conCancel(msg,icons.succeed,btnName);166}167/**168 * æ示信æ¯ï¼å¸¦éå±ï¼169 * @param msg éè¦æ示çä¿¡æ¯170 * @param icon ICONå¾æ 171 * @param btnName å
³éæé®å称172 */173function conCancelLock(msg,icon,btnName){174 art.dialog({175 lock: true,176 background: '#000', // èæ¯è²177 opacity: 0.66, // éæ度178 icon: icon,179 fixed: true,180 drag: false,181 left:'50%',182 top:'150px',183 resize: false,184 content: msg,185 cancelVal: btnName,186 cancel: true //为trueçä»·äºfunction(){}187 });188}189/**190 * 带å享åè½æ示191 * @param msg192 * @param icon193 * @param isRef194 * @param url195 */196function tipShare(msg,icon,isRef,url){197 art.dialog({198 lock: true,199 background: '#000', // èæ¯è²200 opacity: 0.66, // éæ度201 id: 'tipdialog',202 icon: icon,203 fixed: true,204 drag: false,205 left:'50%',206 top:'150px',207 resize: false,208 content: msg,209 cancelVal: btnName,210 cancel: function(){211 if(isRef){212 if(url==null) {213 window.location.reload();214 }else{215 window.location.href=url;216 }217 }218 },219 ok:function(){220 if(isRef){221 if(url==null) {222 window.location.reload();223 }else{224 window.location.href=url;225 }226 }227 },228 okVal:'ç¡®å®',229 close: function () {230 if(isRef){231 if(url==null) {232 window.location.reload();233 }else{234 window.location.href=url;235 }236 }237 }238 }).show();...
build-in.tau.snapshot.js
Source:build-in.tau.snapshot.js
1module.exports = {types: {2 "typeMap": [3 {4 "Boolean": {5 "type": "FunctionType",6 "isRef": false,7 "isAtom": false,8 "arguments": [9 {10 "annotation": "unknown",11 "type": "ReferenceType",12 "isAtom": false,13 "isRef": true14 }15 ],16 "result": {17 "annotation": "boolean",18 "isAtom": true,19 "isRef": false,20 "type": "AtomType"21 }22 },23 "Number": {24 "type": "FunctionType",25 "isRef": false,26 "isAtom": false,27 "arguments": [28 {29 "annotation": "unknown",30 "type": "ReferenceType",31 "isAtom": false,32 "isRef": true33 }34 ],35 "result": {36 "annotation": "number",37 "isAtom": true,38 "isRef": false,39 "type": "AtomType"40 }41 },42 "String": {43 "type": "FunctionType",44 "isRef": false,45 "isAtom": false,46 "arguments": [47 {48 "annotation": "unknown",49 "type": "ReferenceType",50 "isAtom": false,51 "isRef": true52 }53 ],54 "result": {55 "annotation": "string",56 "isAtom": true,57 "isRef": false,58 "type": "AtomType"59 }60 },61 "console": {62 "type": "ObjectType",63 "isRef": false,64 "isAtom": false,65 "annotation": {66 "log": {67 "type": "FunctionType",68 "isRef": false,69 "isAtom": false,70 "arguments": [71 {72 "annotation": "unknown",73 "type": "ReferenceType",74 "isAtom": false,75 "isRef": true76 }77 ]78 },79 "assert": {80 "type": "FunctionType",81 "isRef": false,82 "isAtom": false,83 "arguments": [84 {85 "annotation": "boolean",86 "isAtom": true,87 "isRef": false,88 "type": "AtomType"89 },90 {91 "annotation": "unknown",92 "type": "ReferenceType",93 "isAtom": false,94 "isRef": true95 }96 ]97 }98 }99 },100 "Math": {101 "type": "ObjectType",102 "isRef": false,103 "isAtom": false,104 "annotation": {105 "random": {106 "type": "FunctionType",107 "isRef": false,108 "isAtom": false,109 "arguments": [],110 "result": {111 "annotation": "number",112 "isAtom": true,113 "isRef": false,114 "type": "AtomType"115 }116 },117 "floor": {118 "type": "FunctionType",119 "isRef": false,120 "isAtom": false,121 "arguments": [122 {123 "annotation": "number",124 "isAtom": true,125 "isRef": false,126 "type": "AtomType"127 }128 ],129 "result": {130 "annotation": "number",131 "isAtom": true,132 "isRef": false,133 "type": "AtomType"134 }135 }136 }137 }138 }139 ]...
utils.js
Source:utils.js
1export const Utils = {2 isType(target, type) {3 let targetType = Object.prototype.toString.call(target).slice(8, -1).toLowerCase();4 return targetType === type.toLowerCase();5 },6 hasClass: function (target, className, isRef) {7 let classNames = isRef ? target : target.className || '';8 return (' ' + classNames + ' ').indexOf(' ' + className + ' ') === -1;9 },10 addClass: function (target, className, isRef) {11 let classNames = isRef ? target : target.className || '';12 if (this.hasClass(target, className, isRef)) {13 target.className = classNames ? classNames + ' ' + className : className;14 }15 },16 removeClass: function (target, className, isRef) {17 let classNames = isRef ? target : target.className || '';18 target.className = (' ' + classNames + ' ').replace(' ' + className + ' ', ' ').trim();19 },...
resolver-test.js
Source:resolver-test.js
...6fail = buster.fail;7buster.testCase('lib/resolver', {8 'isRef': {9 'should allow own $ref': function() {10 assert(new Resolver().isRef({ $ref: '' }));11 },12 'should not allow inherited $ref': function() {13 refute(new Resolver().isRef(Object.create({ $ref: '' })));14 },15 'should not allow missing $ref': function() {16 refute(new Resolver().isRef({}));17 },18 'should not allow null': function() {19 refute(new Resolver().isRef(null));20 refute(new Resolver().isRef());21 }22 }23});24})(25 require('buster'),26 require('../../../lib/resolver')...
Using AI Code Generation
1const { isRef } = require('playwright/lib/server/frames');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const page = await browser.newPage();6 const elementHandle = await page.$('text=Get started');7 console.log(isRef(elementHandle));8 await browser.close();9})();
Using AI Code Generation
1const { isRef } = require('playwright/lib/client/selectorImpl');2const { chromium } = require('playwright');3(async () => {4 const browser = await chromium.launch();5 const context = await browser.newContext();6 const page = await context.newPage();7 await page.click('input[name="q"]');8 await browser.close();9})();
Using AI Code Generation
1const { isRef } = require('@playwright/test/lib/test/page');2const { test, expect } = require('@playwright/test');3test('test', async ({ page }) => {4 const element = page.locator('text=Get started');5 expect(isRef(element)).toBe(true);6 expect(isRef('text=Get started')).toBe(false);7});
Using AI Code Generation
1const { isRef } = require("playwright/lib/server/dom");2const { test, expect } = require("@playwright/test");3test("isRef test", async ({ page }) => {4 const ref = await page.evaluateHandle(() => document);5 expect(isRef(ref)).toBe(true);6 await ref.dispose();7});
Using AI Code Generation
1const { isRef } = require('playwright/lib/server/dom.js');2const { ElementHandle } = require('playwright/lib/server/dom.js');3const { isRef } = require('playwright/lib/server/dom.js');4const { ElementHandle } = require('playwright/lib/server/dom.js');5const { isRef } = require('playwright/lib/server/dom.js');6const { ElementHandle } = require('playwright/lib/server/dom.js');7const { isRef } = require('playwright/lib/server/dom.js');8const { ElementHandle } = require('playwright/lib/server/dom.js');9const { isRef } = require('playwright/lib/server/dom.js');10const { ElementHandle } = require('playwright/lib/server/dom.js');11const { isRef } = require('playwright/lib/server/dom.js');12const { ElementHandle } = require('playwright/lib/server/dom.js');13const { isRef } = require('playwright/lib/server/dom.js');14const { ElementHandle } = require('playwright/lib/server/dom.js');15const { isRef } = require('playwright/lib/server/dom.js');16const { ElementHandle } = require('playwright/lib/server/dom.js');17const { isRef } = require('playwright/lib/server/dom.js');18const { ElementHandle } = require('playwright/lib/server/dom.js');19const { isRef } = require('playwright/lib/server/dom.js');20const { ElementHandle } = require('playwright/lib/server/dom.js');21const { isRef } = require('playwright/lib/server/dom.js');22const { ElementHandle } = require('playwright/lib/server/dom.js');23const { isRef } = require('playwright/lib/server/dom.js');24const { ElementHandle } = require('play
Using AI Code Generation
1const { isRef } = require('playwright/lib/server/frames');2const { ElementHandle } = require('playwright/lib/server/dom');3const { JSHandle } = require('playwright/lib/server/javascript');4const { assert } = require('playwright/lib/utils/utils');5const { Page } = require('playwright/lib/server/page');6const { Frame } = require('playwright/lib/server/frame');7const { isRef } = require('playwright/lib/server/frames');8const { ElementHandle } = require('playwright/lib/server/dom');9const { JSHandle } = require('playwright/lib/server/javascript');10const { assert } = require('playwright/lib/utils/utils');11const { Page } = require('playwright/lib/server/page');12const { Frame } = require('playwright/lib/server/frame');13const { isRef } = require('playwright/lib/server/frames');14const { ElementHandle } = require('playwright/lib/server/dom');15const { JSHandle } = require('playwright/lib/server/javascript');16const { assert } = require('playwright/lib/utils/utils');17const { Page } = require('playwright/lib/server/page');18const { Frame } = require('playwright/lib/server/frame');19const { isRef } = require('playwright/lib/server/frames');20const { ElementHandle } = require('playwright/lib/server/dom');21const { JSHandle } = require('playwright/lib/server/javascript');22const { assert } = require('playwright/lib/utils/utils');23const { Page } = require('playwright/lib/server/page');24const { Frame } = require('playwright/lib/server/frame');25const { isRef } = require('playwright/lib/server/frames');26const { ElementHandle } = require('playwright/lib/server/dom');27const { JSHandle } = require('playwright/lib/server/javascript');28const { assert } = require('playwright/lib/utils/utils');29const { Page } = require('playwright/lib/server/page');30const { Frame } = require('playwright/lib/server/frame');31const { isRef } = require('playwright/lib/server/frames');32const { ElementHandle } = require
Using AI Code Generation
1const { isRef } = require('@playwright/test/lib/utils/structs');2const { test } = require('@playwright/test');3test('test', async ({ page }) => {4 const ref = await page.$('body');5});6const { isString } = require('@playwright/test/lib/utils/utils');7const { isString } = require('@playwright/test/lib/utils/utils');
Using AI Code Generation
1const { isRef } = require('playwright/lib/client/selectorEngine');2const { isRef } = require('playwright/lib/client/selectorEngine');3const { isRef } = require('playwright/lib/client/selectorEngine');4const { isRef } = require('playwright/lib/client/selectorEngine');5const { isRef } = require('playwright/lib/client/selectorEngine');6const { isRef } = require('playwright/lib/client/selectorEngine');7const { isRef } = require('playwright/lib/client/selectorEngine');
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.
Get 100 minutes of automation test minutes FREE!!