How to use drain method in Cypress

Best JavaScript code snippet using cypress

morrowind-ingredients.js

Source:morrowind-ingredients.js Github

copy

Full Screen

1(function (root, name, factory) {2  // Commonjs3  if (typeof module !== 'undefined' && module.exports) {4    module.exports = factory();5  }6  // Window7  else if (!name) {8    console.error('No name for root export of', factory.name, factory().name);9  } else if (root[name]) {10    console.warn('Already exported to root', name);11  } else {12    root[name] = factory();13  }14} (this, 'MORROWIND_INGREDIENTS', function () {15  return {16    "Adamantium Ore": {17      "name": "Adamantium Ore",18      "image": "//images.uesp.net/0/06/TR-icon-ingredient-Adamantium_Ore.png",19      "collect": "Found in Raw Adamantium Rocks. The best use of Adamantium Ore is making Adamantium Armor rather than creating potions.",20      "addon": "Tribunal",21      "type": "ingredient",22      "effects": [23        "Burden",24        "Restore Magicka",25        "Poison",26        "Reflect"27      ]28    },29    "Alit Hide": {30      "name": "Alit Hide",31      "image": "//images.uesp.net/8/82/MW-icon-ingredient-Alit_Hide.png",32      "collect": "Found by killing Alits",33      "type": "ingredient",34      "effects": [35        "Drain Intelligence",36        "Resist Poison",37        "Telekinesis",38        "Detect Animal"39      ]40    },41    "Ampoule Pod": {42      "name": "Ampoule Pod",43      "image": "//images.uesp.net/2/20/MW-icon-ingredient-Ampoule_Pod.png",44      "collect": "Common growing in swamps in the Bitter Coast region; one of two possible outputs of the draggle-tail plant (the other is the Coda Flower)",45      "type": "ingredient",46      "effects": [47        "Water Walking",48        "Paralyze",49        "Detect Animal",50        "Drain Willpower"51      ]52    },53    "Ash Salts": {54      "name": "Ash Salts",55      "image": "//images.uesp.net/6/6e/MW-icon-ingredient-Ash_Salts.png",56      "collect": "Found by killing Ash creatures",57      "type": "ingredient",58      "effects": [59        "Drain Agility",60        "Resist Magicka",61        "Cure Blight Disease",62        "Resist Magicka"63      ]64    },65    "Ash Yam": {66      "name": "Ash Yam",67      "image": "//images.uesp.net/a/a0/MW-icon-ingredient-Ash_Yam.png",68      "collect": "Most common in farm areas, occasionally found in the wild",69      "type": "ingredient",70      "effects": [71        "Fortify Intelligence",72        "Fortify Strength",73        "Resist Common Disease",74        "Detect Key"75      ]76    },77    "Bear Pelt": {78      "name": "Bear Pelt",79      "image": "//images.uesp.net/7/7c/BM-icon-ingredient-Bear_Pelt.png",80      "collect": "Found by killing Bears",81      "addon": "Bloodmoon",82      "type": "ingredient",83      "effects": [84        "Drain Fatigue",85        "Fortify Strength",86        "Resist Common Disease",87        "Night Eye"88      ]89    },90    "Bittergreen Petals": {91      "name": "Bittergreen Petals",92      "image": "//images.uesp.net/e/e3/MW-icon-ingredient-Bittergreen_Petal.png",93      "collect": "Grows on thorny vines in drier regions",94      "type": "ingredient",95      "effects": [96        "Restore Intelligence",97        "Invisibility",98        "Drain Endurance",99        "Drain Magicka"100      ]101    },102    "Black Anther": {103      "name": "Black Anther",104      "image": "//images.uesp.net/8/82/MW-icon-ingredient-Black_Anther.png",105      "collect": "These flowers are most common in the Ascadian Isles region",106      "type": "ingredient",107      "effects": [108        "Drain Agility",109        "Resist Fire",110        "Drain Endurance",111        "Light"112      ]113    },114    "Black Lichen": {115      "name": "Black Lichen",116      "image": "//images.uesp.net/4/42/MW-icon-ingredient-Black_Lichen.png",117      "collect": "Somewhat rare, mostly found in caves",118      "type": "ingredient",119      "effects": [120        "Drain Strength",121        "Resist Frost",122        "Drain Speed",123        "Cure Poison"124      ]125    },126    "Bloat": {127      "name": "Bloat",128      "image": "//images.uesp.net/6/6e/MW-icon-ingredient-Ash_Salts.png",129      "collect": "Grows in Bloat Spores, which are unfortunately not found anywhere in the game. The only examples you can find are in random containers, or sold by vendors.",130      "type": "ingredient",131      "effects": [132        "Drain Magicka",133        "Fortify Intelligence",134        "Fortify Willpower",135        "Detect Animal"136      ]137    },138    "Blood of an Innocent": {139      "name": "Blood of an Innocent",140      "image": "//images.uesp.net/2/22/MW-icon-ingredient-Red_Lichen.png",141      "type": "ingredient",142      "effects": [143        "Drain Speed",144        "Light",145        "Cure Common Disease",146        "Drain Magicka"147      ],148      "addon": "Bloodmoon (Special)",149      "collect": "Not found in game. Presumably this was intended to be used instead of the Heart of an Innocent."150    },151    "Bonemeal": {152      "name": "Bonemeal",153      "image": "//images.uesp.net/1/1a/MW-icon-ingredient-Bonemeal.png",154      "collect": "Found on skeletons (living or dead), and also in urns in most tombs.",155      "type": "ingredient",156      "effects": [157        "Restore Agility",158        "Telekinesis",159        "Drain Fatigue",160        "Drain Personality"161      ]162    },163    "Bread": {164      "name": "Bread",165      "image": "//images.uesp.net/a/a4/MW-icon-ingredient-Bread.png",166      "type": "ingredient",167      "effects": [168        "Restore Fatigue"169      ],170      "addon": "(Special)",171      "collect": ""172    },173    "Bristleback Leather": {174      "name": "Bristleback Leather",175      "image": "//images.uesp.net/b/b6/BM-icon-ingredient-Bristleback_Leather.png",176      "collect": "Found by killing Bristlebacks (with or without riders)",177      "addon": "Bloodmoon",178      "type": "ingredient",179      "effects": [180        "Blind",181        "Frost Damage",182        "Resist Frost",183        "Recall"184      ]185    },186    "Bungler's Bane": {187      "name": "Bungler's Bane",188      "image": "//images.uesp.net/6/60/MW-icon-ingredient-Bungler%27s_Bane.png",189      "collect": "This shelf-fungus grows on tree trunks in the Bitter Coast region",190      "type": "ingredient",191      "effects": [192        "Drain Speed",193        "Drain Endurance",194        "Dispel",195        "Drain Strength"196      ]197    },198    "Chokeweed": {199      "name": "Chokeweed",200      "image": "//images.uesp.net/5/57/MW-icon-ingredient-Chokeweed.png",201      "collect": "Found growing in drier regions",202      "type": "ingredient",203      "effects": [204        "Drain Luck",205        "Restore Fatigue",206        "Cure Common Disease",207        "Drain Willpower"208      ]209    },210    "Coda Flower": {211      "name": "Coda Flower",212      "image": "//images.uesp.net/a/ac/MW-icon-ingredient-Coda_Flower.png",213      "collect": "Found growing in swampy pools in the Bitter Coast region on the draggle-tail plant",214      "type": "ingredient",215      "effects": [216        "Drain Personality",217        "Levitate",218        "Drain Intelligence",219        "Drain Health"220      ]221    },222    "Comberry": {223      "name": "Comberry",224      "image": "//images.uesp.net/5/50/MW-icon-ingredient-Comberry.png",225      "collect": "Grows in shrubs in the West Gash and Ascadian Isles regions",226      "type": "ingredient",227      "effects": [228        "Drain Fatigue",229        "Restore Magicka",230        "Fire Shield",231        "Reflect"232      ]233    },234    "Corkbulb Root": {235      "name": "Corkbulb Root",236      "image": "//images.uesp.net/6/64/MW-icon-ingredient-Corkbulb_Root.png",237      "collect": "Mostly found in drier regions in the wild.",238      "type": "ingredient",239      "effects": [240        "Cure Paralyzation",241        "Restore Health",242        "Lightning Shield",243        "Fortify Luck"244      ]245    },246    "Corprus Weepings": {247      "name": "Corprus Weepings",248      "image": "//images.uesp.net/9/92/MW-icon-ingredient-Corprus_Weepings.png",249      "collect": "Found by killing Corprus Stalkers",250      "type": "ingredient",251      "effects": [252        "Drain Fatigue",253        "Fortify Luck",254        "Drain Willpower",255        "Restore Health"256      ]257    },258    "Crab Meat": {259      "name": "Crab Meat",260      "image": "//images.uesp.net/3/37/MW-icon-ingredient-Crab_Meat.png",261      "collect": "Found by killing Mudcrabs",262      "type": "ingredient",263      "effects": [264        "Restore Fatigue",265        "Resist Shock",266        "Lightning Shield",267        "Restore Luck"268      ]269    },270    "Daedra Skin": {271      "name": "Daedra Skin",272      "image": "//images.uesp.net/1/12/MW-icon-ingredient-Daedra_Skin.png",273      "collect": "Somewhat rare, mostly found at vendors",274      "type": "ingredient",275      "effects": [276        "Fortify Strength",277        "Cure Common Disease",278        "Paralyze",279        "Swift Swim"280      ]281    },282    "Daedra's Heart": {283      "name": "Daedra's Heart",284      "image": "//images.uesp.net/7/7a/MW-icon-ingredient-Daedra%27s_Heart.png",285      "type": "ingredient",286      "effects": [287        "Restore Magicka",288        "Fortify Endurance",289        "Drain Agility",290        "Night Eye"291      ],292      "addon": "(Special)",293      "collect": "Found as offerings at Daedric shrines. See Cursed Items for more details."294    },295    "Diamond": {296      "name": "Diamond",297      "image": "//images.uesp.net/a/a5/MW-icon-ingredient-Diamond.png",298      "type": "ingredient",299      "effects": [300        "Drain Agility",301        "Invisibility",302        "Reflect",303        "Detect Key"304      ],305      "addon": "(Special)",306      "collect": "Found as offerings at Daedric shrines. See Cursed Items for more details."307    },308    "Dreugh Wax": {309      "name": "Dreugh Wax",310      "image": "//images.uesp.net/c/c5/MW-icon-ingredient-Dreugh_Wax.png",311      "collect": "Found by killing Dreugh",312      "type": "ingredient",313      "effects": [314        "Fortify Strength",315        "Restore Strength",316        "Drain Luck",317        "Drain Willpower"318      ]319    },320    "Durzog Meat": {321      "name": "Durzog Meat",322      "image": "//images.uesp.net/7/78/TR-icon-ingredient-Durzog_Meat.png",323      "collect": "Found by killing Durzogs",324      "addon": "Tribunal",325      "type": "ingredient",326      "effects": [327        "Fortify Agility",328        "Fortify Strength",329        "Blind",330        "Damage Magicka"331      ]332    },333    "Ectoplasm": {334      "name": "Ectoplasm",335      "image": "//images.uesp.net/7/77/MW-icon-ingredient-Ectoplasm.png",336      "collect": "Found by killing Ghosts",337      "type": "ingredient",338      "effects": [339        "Fortify Agility",340        "Detect Animal",341        "Drain Strength",342        "Drain Health"343      ]344    },345    "Emerald": {346      "name": "Emerald",347      "image": "//images.uesp.net/1/1d/MW-icon-ingredient-Emerald.png",348      "type": "ingredient",349      "effects": [350        "Fortify Magicka",351        "Restore Health",352        "Drain Agility",353        "Drain Endurance"354      ],355      "addon": "(Special)",356      "collect": "Found as offerings at Daedric shrines. See Cursed Items for more details."357    },358    "Fire Petal": {359      "name": "Fire Petal",360      "image": "//images.uesp.net/4/42/MW-icon-ingredient-Fire_Petal.png",361      "collect": "Found growing in the Molag Amur, Ashlands, and Red Mountain regions",362      "type": "ingredient",363      "effects": [364        "Resist Fire",365        "Drain Health",366        "Spell Absorption",367        "Paralyze"368      ]369    },370    "Fire Salts": {371      "name": "Fire Salts",372      "image": "//images.uesp.net/a/a0/MW-icon-ingredient-Fire_Salts.png",373      "collect": "Found by killing Flame Atronachs",374      "type": "ingredient",375      "effects": [376        "Drain Health",377        "Fortify Agility",378        "Resist Frost",379        "Fire Shield"380      ]381    },382    "Flaming Eye of the Lightkeeper": {383      "name": "Flaming Eye of the Lightkeeper",384      "image": "//images.uesp.net/d/da/BM-icon-ingredient-Grahl_Eyeball.png",385      "type": "ingredient",386      "effects": [387        "Resist Frost",388        "Night Eye",389        "Drain Magicka",390        "Fortify Strength"391      ],392      "addon": "Bloodmoon (Special)",393      "collect": "Taken from the Lightkeeper Grahl during The Ritual of the Sun."394    },395    "Frost Salts": {396      "name": "Frost Salts",397      "image": "//images.uesp.net/2/2b/MW-icon-ingredient-Frost_Salts.png",398      "collect": "Found by killing Frost Atronachs",399      "type": "ingredient",400      "effects": [401        "Drain Speed",402        "Restore Magicka",403        "Frost Shield",404        "Resist Fire"405      ]406    },407    "Ghoul Heart": {408      "name": "Ghoul Heart",409      "image": "//images.uesp.net/e/ea/MW-icon-ingredient-Ghoul_Heart.png",410      "collect": "Supposedly the heart tissue of an Ash Ghoul, but not found on them. Mostly in random ingredient containers and sold at vendors.",411      "type": "ingredient",412      "effects": [413        "Paralyze",414        "Cure Poison",415        "Fortify Attack"416      ]417    },418    "Girith's Guar Hide": {419      "name": "Girith's Guar Hide",420      "image": "//images.uesp.net/b/b4/MW-icon-ingredient-Guar_Hide.png",421      "type": "ingredient",422      "effects": [423        "Drain Fatigue",424        "Fortify Endurance",425        "Restore Personality",426        "Fortify Luck"427      ],428      "addon": "(Special)",429      "collect": "Stolen from Athanden Girith, a trader in the Grazelands. Recover them in the Girith's Stolen Hides quest."430    },431    "Gold Kanet": {432      "name": "Gold Kanet",433      "image": "//images.uesp.net/6/6f/MW-icon-ingredient-Gold_Kanet.png",434      "collect": "Found growing in bushes in the grassy regions",435      "type": "ingredient",436      "effects": [437        "Drain Health",438        "Burden",439        "Drain Luck",440        "Restore Strength"441      ]442    },443    "Golden Sedge Flowers": {444      "name": "Golden Sedge Flowers",445      "image": "//images.uesp.net/5/57/TR-icon-ingredient-Golden_Sedge.png",446      "collect": "Found in planters throughout Mournhold",447      "addon": "Tribunal",448      "type": "ingredient",449      "effects": [450        "Drain Magicka",451        "Fortify Strength",452        "Fortify Attack",453        "Swift Swim"454      ]455    },456    "Grahl Eyeball": {457      "name": "Grahl Eyeball",458      "image": "//images.uesp.net/d/da/BM-icon-ingredient-Grahl_Eyeball.png",459      "collect": "Found by killing Grahls",460      "addon": "Bloodmoon",461      "type": "ingredient",462      "effects": [463        "Resist Frost",464        "Night Eye",465        "Drain Magicka",466        "Fortify Strength"467      ]468    },469    "Gravedust": {470      "name": "Gravedust",471      "image": "//images.uesp.net/a/a9/MW-icon-ingredient-Gravedust.png",472      "collect": "No reliable location. Occasionally for sale at vendors or found in random containers",473      "type": "ingredient",474      "effects": [475        "Drain Intelligence",476        "Cure Common Disease",477        "Drain Magicka",478        "Restore Endurance"479      ]480    },481    "Gravetar": {482      "name": "Gravetar",483      "image": "//images.uesp.net/f/f9/BM-icon-ingredient-Gravetar.png",484      "collect": "Found by killing Draugr",485      "addon": "Bloodmoon",486      "type": "ingredient",487      "effects": [488        "Resist Frost",489        "Drain Health",490        "Fortify Fatigue",491        "Drain Luck"492      ]493    },494    "Green Lichen": {495      "name": "Green Lichen",496      "image": "//images.uesp.net/e/e5/MW-icon-ingredient-Green_Lichen.png",497      "collect": "Mostly grows on rocks in caves",498      "type": "ingredient",499      "effects": [500        "Fortify Personality",501        "Cure Common Disease",502        "Drain Strength",503        "Drain Health"504      ]505    },506    "Guar Hide": {507      "name": "Guar Hide",508      "image": "//images.uesp.net/b/b4/MW-icon-ingredient-Guar_Hide.png",509      "collect": "Found by killing Guars",510      "type": "ingredient",511      "effects": [512        "Drain Fatigue",513        "Fortify Endurance",514        "Restore Personality",515        "Fortify Luck"516      ]517    },518    "Hackle-Lo Leaf": {519      "name": "Hackle-Lo Leaf",520      "image": "//images.uesp.net/d/d3/MW-icon-ingredient-Hackle-Lo_Leaf.png",521      "collect": "Found as food in most houses; grows wild in the Azura's Coast region.",522      "type": "ingredient",523      "effects": [524        "Restore Fatigue",525        "Paralyze",526        "Water Breathing",527        "Restore Luck"528      ]529    },530    "Heart of an Innocent": {531      "name": "Heart of an Innocent",532      "image": "//images.uesp.net/7/7a/MW-icon-ingredient-Daedra%27s_Heart.png",533      "type": "ingredient",534      "effects": [535        "Restore Magicka",536        "Fortify Endurance",537        "Drain Agility",538        "Night Eye"539      ],540      "addon": "Bloodmoon (Special)",541      "collect": "Obtained during the Rite of the Wolf Giver quest."542    },543    "Heart of the Udyrfrykte": {544      "name": "Heart of the Udyrfrykte",545      "image": "//images.uesp.net/7/7a/MW-icon-ingredient-Daedra%27s_Heart.png",546      "type": "ingredient",547      "effects": [548        "Restore Magicka",549        "Fortify Endurance",550        "Drain Agility",551        "Night Eye"552      ],553      "addon": "Bloodmoon (Special)",554      "collect": "Found by killing The Udyrfrykte"555    },556    "Heart of the Wolf": {557      "name": "Heart of the Wolf",558      "image": "//images.uesp.net/7/7a/MW-icon-ingredient-Daedra%27s_Heart.png",559      "type": "ingredient",560      "effects": [561        "Restore Magicka",562        "Fortify Endurance",563        "Drain Agility",564        "Night Eye"565      ],566      "addon": "Bloodmoon (Special)",567      "collect": "Obtained during the Rite of the Wolf Giver quest."568    },569    "Heartwood": {570      "name": "Heartwood",571      "image": "//images.uesp.net/f/f7/BM-icon-ingredient-Heartwood.png",572      "collect": "Occasionally found by killing Spriggans",573      "addon": "Bloodmoon",574      "type": "ingredient",575      "effects": [576        "Restore Magicka",577        "Fortify Agility",578        "Drain Strength",579        "Weakness to Fire"580      ]581    },582    "Heather": {583      "name": "Heather",584      "image": "//images.uesp.net/7/78/MW-icon-ingredient-Heather.png",585      "collect": "This common flower grows throughout the greener regions of Vvardenfell.",586      "type": "ingredient",587      "effects": [588        "Restore Personality",589        "Feather",590        "Drain Speed",591        "Drain Personality"592      ]593    },594    "Holly Berries": {595      "name": "Holly Berries",596      "image": "//images.uesp.net/4/45/BM-icon-ingredient-Holly_Berries.png",597      "collect": "Grows all over Solstheim",598      "addon": "Bloodmoon",599      "type": "ingredient",600      "effects": [601        "Resist Frost",602        "Frost Shield",603        "Frost Damage",604        "Weakness to Fire"605      ]606    },607    "Horker Tusk": {608      "name": "Horker Tusk",609      "image": "//images.uesp.net/2/2d/BM-icon-ingredient-Horker_Tusk.png",610      "collect": "Found by killing Horkers",611      "addon": "Bloodmoon",612      "type": "ingredient",613      "effects": [614        "Drain Alteration",615        "Fortify Intelligence",616        "Fortify Maximum Magicka",617        "Detect Animal"618      ]619    },620    "Horn Lily Bulb": {621      "name": "Horn Lily Bulb",622      "image": "//images.uesp.net/6/6b/TR-icon-ingredient-Horn_Lily_Bulb.png",623      "collect": "Found in planters throughout Mournhold",624      "addon": "Tribunal",625      "type": "ingredient",626      "effects": [627        "Resist Paralysis",628        "Drain Health",629        "Restore Strength",630        "Restore Endurance"631      ]632    },633    "Hound Meat": {634      "name": "Hound Meat",635      "image": "//images.uesp.net/b/b2/MW-icon-ingredient-Hound_Meat.png",636      "collect": "Found by killing Nix-Hounds",637      "type": "ingredient",638      "effects": [639        "Restore Fatigue",640        "Fortify Fatigue",641        "Reflect",642        "Detect Enchantment"643      ]644    },645    "Human Flesh": {646      "name": "Human Flesh",647      "image": "//images.uesp.net/3/38/MW-icon-ingredient-Rat_Meat.png",648      "type": "ingredient",649      "effects": [650        "Fortify Health",651        "Drain Intelligence",652        "Drain Personality"653      ],654      "addon": "(Special)",655      "collect": "Very rare. Only found in certain places. One is Palansour."656    },657    "Hypha Facia": {658      "name": "Hypha Facia",659      "image": "//images.uesp.net/e/e5/MW-icon-ingredient-Hypha_Facia.png",660      "collect": "This shelf-fungus is found growing on tree trunks in the Bitter Coast region",661      "type": "ingredient",662      "effects": [663        "Drain Luck",664        "Drain Agility",665        "Drain Fatigue",666        "Detect Enchantment"667      ]668    },669    "Kagouti Hide": {670      "name": "Kagouti Hide",671      "image": "//images.uesp.net/f/f7/MW-icon-ingredient-Kagouti_Hide.png",672      "collect": "Found by killing Kagoutis",673      "type": "ingredient",674      "effects": [675        "Drain Fatigue",676        "Fortify Speed",677        "Resist Common Disease",678        "Night Eye"679      ]680    },681    "Kresh Fiber": {682      "name": "Kresh Fiber",683      "image": "//images.uesp.net/c/c0/MW-icon-ingredient-Kresh_Fiber.png",684      "collect": "Kreshweed is found growing near sea water, most common in the Azura's Coast, Bitter Coast and West Gash regions.",685      "type": "ingredient",686      "effects": [687        "Restore Luck",688        "Fortify Personality",689        "Drain Magicka",690        "Drain Speed"691      ]692    },693    "Kwama Cuttle": {694      "name": "Kwama Cuttle",695      "image": "//images.uesp.net/b/b4/MW-icon-ingredient-Kwama_Cuttle.png",696      "collect": "Found by killing Kwama (any type).",697      "type": "ingredient",698      "effects": [699        "Resist Poison",700        "Drain Fatigue",701        "Water Walking",702        "Water Breathing"703      ]704    },705    "Large Corprusmeat Hunk": {706      "name": "Large Corprusmeat Hunk",707      "image": "//images.uesp.net/4/4e/MW-icon-ingredient-Corpusmeat_05.png",708      "collect": "These are found in abundance in most 6th House strongholds",709      "type": "ingredient",710      "effects": [711        "Drain Fatigue",712        "Drain Health",713        "Drain Magicka"714      ]715    },716    "Large Kwama Egg": {717      "name": "Large Kwama Egg",718      "image": "//images.uesp.net/7/73/MW-icon-ingredient-Kwama_Egg.png",719      "collect": "Found in Egg Mines. Also common as food in houses.",720      "type": "ingredient",721      "effects": [722        "Restore Fatigue",723        "Paralyze",724        "Frost Shield",725        "Fortify Health"726      ]727    },728    "Large Wrapped Corprusmeat": {729      "name": "Large Wrapped Corprusmeat",730      "image": "//images.uesp.net/4/4a/MW-icon-ingredient-Corpusmeat_01.png",731      "collect": "These are found in abundance in most 6th House strongholds",732      "type": "ingredient",733      "effects": [734        "Drain Fatigue",735        "Drain Health",736        "Drain Magicka"737      ]738    },739    "Lloramor Spines": {740      "name": "Lloramor Spines",741      "image": "//images.uesp.net/a/a2/TR-icon-ingredient-Lloramor_Spines.png",742      "collect": "Found in planters throughout Mournhold",743      "addon": "Tribunal",744      "type": "ingredient",745      "effects": [746        "Spell Absorption",747        "Invisibility",748        "Poison",749        "Detect Enchantment"750      ]751    },752    "Luminous Russula": {753      "name": "Luminous Russula",754      "image": "//images.uesp.net/d/d3/MW-icon-ingredient-Luminous_Russula.png",755      "collect": "Found in the Bitter Coast region, also common in caves",756      "type": "ingredient",757      "effects": [758        "Water Breathing",759        "Drain Fatigue",760        "Poison"761      ]762    },763    "Marshmerrow": {764      "name": "Marshmerrow",765      "image": "//images.uesp.net/f/fe/MW-icon-ingredient-Marshmerrow.png",766      "collect": "Found growing near water, most common in the Azura's Coast region",767      "type": "ingredient",768      "effects": [769        "Restore Health",770        "Detect Enchantment",771        "Drain Willpower",772        "Drain Fatigue"773      ]774    },775    "Marsus' Guar Hide": {776      "name": "Marsus' Guar Hide",777      "image": "//images.uesp.net/b/b4/MW-icon-ingredient-Guar_Hide.png",778      "type": "ingredient",779      "effects": [780        "Drain Fatigue",781        "Fortify Endurance",782        "Restore Personality",783        "Fortify Luck"784      ],785      "addon": "(Special)",786      "collect": "Stolen from Marsus Tullius, a trader in the Grazelands. Recover them in the Marsus Tullius' Missing Hides quest."787    },788    "Meadow Rye": {789      "name": "Meadow Rye",790      "image": "//images.uesp.net/3/39/TR-icon-ingredient-Meadow_Rye.png",791      "collect": "Found in planters throughout Mournhold",792      "addon": "Tribunal",793      "type": "ingredient",794      "effects": [795        "Fortify Speed",796        "Damage Health",797        "Restore Speed",798        "Drain Speed"799      ]800    },801    "Medium Corprusmeat Hunk": {802      "name": "Medium Corprusmeat Hunk",803      "image": "//images.uesp.net/e/ed/MW-icon-ingredient-Corpusmeat_06.png",804      "collect": "These are found in abundance in most 6th House strongholds",805      "type": "ingredient",806      "effects": [807        "Drain Fatigue",808        "Drain Health",809        "Drain Magicka"810      ]811    },812    "Medium Wrapped Corprusmeat": {813      "name": "Medium Wrapped Corprusmeat",814      "image": "//images.uesp.net/b/b3/MW-icon-ingredient-Corpusmeat_03.png",815      "collect": "These are found in abundance in most 6th House strongholds",816      "type": "ingredient",817      "effects": [818        "Drain Fatigue",819        "Drain Health",820        "Drain Magicka"821      ]822    },823    "Meteor Slime": {824      "name": "Meteor Slime",825      "image": "//images.uesp.net/7/75/MW-icon-ingredient-Scrib_Jelly.png",826      "type": "ingredient",827      "effects": [828        "Fortify Willpower",829        "Cure Poison",830        "Cure Blight Disease",831        "Restore Willpower"832      ],833      "addon": "(Special)",834      "collect": "Found on Charles the Plant, at Jobasha's Rare Books in Vivec."835    },836    "Moon Sugar": {837      "name": "Moon Sugar",838      "image": "//images.uesp.net/c/c2/MW-icon-ingredient-Moon_Sugar.png",839      "collect": "Found in smuggler caves. Most vendors will not deal with you if you are carrying this illegal narcotic substance.",840      "type": "ingredient",841      "effects": [842        "Fortify Speed",843        "Dispel",844        "Drain Endurance",845        "Drain Luck"846      ]847    },848    "Muck": {849      "name": "Muck",850      "image": "//images.uesp.net/2/23/MW-icon-ingredient-Muck.png",851      "collect": "Found in Muckspunge plants which grow near water in many regions",852      "type": "ingredient",853      "effects": [854        "Drain Intelligence",855        "Detect Key",856        "Drain Personality",857        "Cure Common Disease"858      ]859    },860    "Muffin": {861      "name": "Muffin",862      "image": "//images.uesp.net/a/a4/MW-icon-ingredient-Bread.png",863      "type": "ingredient",864      "effects": [865        "Restore Fatigue"866      ],867      "addon": "(Special)",868      "collect": "Carried by Gakkenfeld, an Orc at the Gro-Bagrat Plantation in the Ascadian Isles region."869    },870    "Netch Leather": {871      "name": "Netch Leather",872      "image": "//images.uesp.net/6/68/MW-icon-ingredient-Netch_Leather.png",873      "collect": "Found by killing Netch",874      "type": "ingredient",875      "effects": [876        "Fortify Endurance",877        "Fortify Intelligence",878        "Drain Personality",879        "Cure Paralyzation"880      ]881    },882    "Nirthfly Stalks": {883      "name": "Nirthfly Stalks",884      "image": "//images.uesp.net/2/2f/TR-icon-ingredient-Nirthfly_Stalks.png",885      "collect": "Found in planters throughout Mournhold",886      "addon": "Tribunal",887      "type": "ingredient",888      "effects": [889        "Damage Health",890        "Fortify Speed",891        "Restore Speed",892        "Drain Speed"893      ]894    },895    "Noble Sedge Flowers": {896      "name": "Noble Sedge Flowers",897      "image": "//images.uesp.net/e/e5/TR-icon-ingredient-Noble_Sedge.png",898      "collect": "Found in planters throughout Mournhold",899      "addon": "Tribunal",900      "type": "ingredient",901      "effects": [902        "Damage Health",903        "Restore Agility",904        "Poison",905        "Fortify Agility"906      ]907    },908    "Pearl": {909      "name": "Pearl",910      "image": "//images.uesp.net/c/cd/MW-icon-ingredient-Pearl.png",911      "type": "ingredient",912      "effects": [913        "Drain Agility",914        "Dispel",915        "Water Breathing",916        "Resist Common Disease"917      ],918      "addon": "(Special)",919      "collect": "Found as offerings at Daedric shrines. See Cursed Items for more details."920    },921    "Pinetear": {922      "name": "Pinetear",923      "image": "//images.uesp.net/1/1d/MW-icon-ingredient-Emerald.png",924      "type": "ingredient",925      "effects": [926        "Fortify Magicka",927        "Restore Health",928        "Drain Agility",929        "Drain Endurance"930      ],931      "addon": "Bloodmoon (Special)",932      "collect": "Family heirloom obtained during A Wife's Retribution."933    },934    "Poison": {935      "name": "Poison",936      "image": "//images.uesp.net/9/92/MW-icon-ingredient-Corprus_Weepings.png",937      "type": "ingredient",938      "effects": [939        "Poison"940      ],941      "addon": "(Special)",942      "collect": "Very rare. Only a few are known to exist. Some in Palansour, and also in Mudan Grotto."943    },944    "Racer Plumes": {945      "name": "Racer Plumes",946      "image": "//images.uesp.net/9/97/MW-icon-ingredient-Racer_Plumes.png",947      "collect": "Found by killing Cliff Racers",948      "type": "ingredient",949      "effects": [950        "Drain Willpower",951        "Levitate"952      ]953    },954    "Rat Meat": {955      "name": "Rat Meat",956      "image": "//images.uesp.net/3/38/MW-icon-ingredient-Rat_Meat.png",957      "collect": "Found by killing Rats",958      "type": "ingredient",959      "effects": [960        "Drain Magicka",961        "Paralyze",962        "Cure Poison",963        "Resist Poison"964      ]965    },966    "Raw Ebony": {967      "name": "Raw Ebony",968      "image": "//images.uesp.net/8/86/MW-icon-ingredient-Raw_Ebony.png",969      "type": "ingredient",970      "effects": [971        "Drain Agility",972        "Cure Poison",973        "Frost Shield",974        "Restore Speed"975      ],976      "addon": "(Special)",977      "collect": "Found as offerings at Daedric shrines. See Cursed Items for more details."978    },979    "Raw Glass": {980      "name": "Raw Glass",981      "image": "//images.uesp.net/b/b6/MW-icon-ingredient-Raw_Glass.png",982      "type": "ingredient",983      "effects": [984        "Drain Intelligence",985        "Drain Strength",986        "Drain Speed",987        "Fire Shield"988      ],989      "addon": "(Special)",990      "collect": "Found in Beshara, needed for The Angry Trader quest."991    },992    "Raw Stalhrim": {993      "name": "Raw Stalhrim",994      "image": "//images.uesp.net/6/68/BM-icon-ingredient-Raw_Stalhrim.png",995      "collect": "Found in barrows. Ancient Stalhrim Pickaxe required.",996      "addon": "Bloodmoon",997      "type": "ingredient",998      "effects": [999        "Resist Frost",1000        "Frost Damage",1001        "Paralyze",1002        "Restore Health"1003      ]1004    },1005    "Red Lichen": {1006      "name": "Red Lichen",1007      "image": "//images.uesp.net/2/22/MW-icon-ingredient-Red_Lichen.png",1008      "collect": "Found growing on rocks, mostly in the Ashlands. Also for sale at vendors.",1009      "type": "ingredient",1010      "effects": [1011        "Drain Speed",1012        "Light",1013        "Cure Common Disease",1014        "Drain Magicka"1015      ]1016    },1017    "Resin": {1018      "name": "Resin",1019      "image": "//images.uesp.net/4/4f/MW-icon-ingredient-Resin.png",1020      "collect": "No reliable location. Occasionally for sale at vendors or found in random containers.",1021      "type": "ingredient",1022      "effects": [1023        "Restore Health",1024        "Restore Speed",1025        "Burden",1026        "Resist Common Disease"1027      ]1028    },1029    "Ripened Belladonna Berries": {1030      "name": "Ripened Belladonna Berries",1031      "image": "//images.uesp.net/7/76/BM-icon-ingredient-Belladonna_Berries.png",1032      "collect": "Somewhat less common than the unripe variety, but still relatively widespread.",1033      "addon": "Bloodmoon",1034      "type": "ingredient",1035      "effects": [1036        "Resist Magicka",1037        "Restore Magicka",1038        "Fortify Magicka",1039        "Drain Magicka"1040      ]1041    },1042    "Roland's Tear": {1043      "name": "Roland's Tear",1044      "image": "//images.uesp.net/6/6f/MW-icon-ingredient-Gold_Kanet.png",1045      "type": "ingredient",1046      "effects": [1047        "Drain Health",1048        "Burden",1049        "Drain Luck",1050        "Restore Strength"1051      ],1052      "addon": "(Special)",1053      "collect": "This variation of Gold Kanet grows near Ald Sotha. Needed for the quest of the same name."1054    },1055    "Roobrush": {1056      "name": "Roobrush",1057      "image": "//images.uesp.net/5/54/MW-icon-ingredient-Roobrush.png",1058      "collect": "Found growing in hilly regions",1059      "type": "ingredient",1060      "effects": [1061        "Drain Willpower",1062        "Fortify Agility",1063        "Drain Health",1064        "Cure Poison"1065      ]1066    },1067    "Ruby": {1068      "name": "Ruby",1069      "image": "//images.uesp.net/8/81/MW-icon-ingredient-Ruby.png",1070      "type": "ingredient",1071      "effects": [1072        "Drain Health",1073        "Feather",1074        "Restore Intelligence",1075        "Drain Agility"1076      ],1077      "addon": "(Special)",1078      "collect": "Found as offerings at Daedric shrines. See Cursed Items for more details."1079    },1080    "Saltrice": {1081      "name": "Saltrice",1082      "image": "//images.uesp.net/8/8b/MW-icon-ingredient-Saltrice.png",1083      "collect": "Found growing near sea water, most common in the Azura's Coast region. Also a common food item in houses.",1084      "type": "ingredient",1085      "effects": [1086        "Restore Fatigue",1087        "Fortify Magicka",1088        "Drain Strength",1089        "Restore Health"1090      ]1091    },1092    "Scales": {1093      "name": "Scales",1094      "image": "//images.uesp.net/f/fa/MW-icon-ingredient-Scales.png",1095      "collect": "Found by killing Slaughterfish",1096      "type": "ingredient",1097      "effects": [1098        "Drain Personality",1099        "Water Walking",1100        "Restore Endurance",1101        "Swift Swim"1102      ]1103    },1104    "Scamp Skin": {1105      "name": "Scamp Skin",1106      "image": "//images.uesp.net/e/eb/MW-icon-ingredient-Scamp_Skin.png",1107      "collect": "Found by killing Scamps",1108      "type": "ingredient",1109      "effects": [1110        "Drain Magicka",1111        "Cure Paralyzation",1112        "Restore Personality",1113        "Restore Strength"1114      ]1115    },1116    "Scathecraw": {1117      "name": "Scathecraw",1118      "image": "//images.uesp.net/d/db/MW-icon-ingredient-Scathecraw.png",1119      "collect": "Grows in dry, hilly regions",1120      "type": "ingredient",1121      "effects": [1122        "Drain Strength",1123        "Cure Poison",1124        "Drain Health",1125        "Restore Willpower"1126      ]1127    },1128    "Scrap Metal": {1129      "name": "Scrap Metal",1130      "image": "//images.uesp.net/7/73/MW-icon-ingredient-Scrap_Metal.png",1131      "collect": "Found by killing Dwemer constructs. Also common in barrels and on shelves in Dwemer ruins.",1132      "type": "ingredient",1133      "effects": [1134        "Drain Health",1135        "Lightning Shield",1136        "Resist Shock",1137        "Restore Intelligence"1138      ]1139    },1140    "Scrib Cabbage": {1141      "name": "Scrib Cabbage",1142      "image": "//images.uesp.net/e/e7/TR-icon-ingredient-Scrib_Cabbage.png",1143      "collect": "Found in planters throughout Mournhold",1144      "addon": "Tribunal",1145      "type": "ingredient",1146      "effects": [1147        "Drain Intelligence",1148        "Damage Health",1149        "Restore Agility",1150        "Fortify Agility"1151      ]1152    },1153    "Scrib Jelly": {1154      "name": "Scrib Jelly",1155      "image": "//images.uesp.net/7/75/MW-icon-ingredient-Scrib_Jelly.png",1156      "collect": "Found by killing Scribs",1157      "type": "ingredient",1158      "effects": [1159        "Fortify Willpower",1160        "Cure Poison",1161        "Cure Blight Disease",1162        "Restore Willpower"1163      ]1164    },1165    "Scrib Jerky": {1166      "name": "Scrib Jerky",1167      "image": "//images.uesp.net/4/41/MW-icon-ingredient-Scrib_Jerky.png",1168      "collect": "Found as a food item in houses.",1169      "type": "ingredient",1170      "effects": [1171        "Restore Fatigue",1172        "Fortify Fatigue",1173        "Burden",1174        "Swift Swim"1175      ]1176    },1177    "Scuttle": {1178      "name": "Scuttle",1179      "image": "//images.uesp.net/8/88/MW-icon-ingredient-Scuttle.png",1180      "collect": "Found as a food item in houses.",1181      "type": "ingredient",1182      "effects": [1183        "Restore Fatigue",1184        "Fortify Fatigue",1185        "Feather",1186        "Telekinesis"1187      ]1188    },1189    "Shalk Resin": {1190      "name": "Shalk Resin",1191      "image": "//images.uesp.net/e/e5/MW-icon-ingredient-Shalk_Resin.png",1192      "collect": "Found by killing Shalks",1193      "type": "ingredient",1194      "effects": [1195        "Drain Fatigue",1196        "Fortify Health",1197        "Drain Personality",1198        "Fortify Speed"1199      ]1200    },1201    "Sload Soap": {1202      "name": "Sload Soap",1203      "image": "//images.uesp.net/a/aa/MW-icon-ingredient-Sload_Soap.png",1204      "collect": "Rare. Mostly found for sale at vendors or in random containers.",1205      "type": "ingredient",1206      "effects": [1207        "Drain Personality",1208        "Fortify Agility",1209        "Fire Shield",1210        "Restore Agility"1211      ]1212    },1213    "Small Corprusmeat Hunk": {1214      "name": "Small Corprusmeat Hunk",1215      "image": "//images.uesp.net/1/19/MW-icon-ingredient-Corpusmeat_07.png",1216      "collect": "These are found in abundance in most 6th House strongholds",1217      "type": "ingredient",1218      "effects": [1219        "Drain Fatigue",1220        "Drain Health",1221        "Drain Magicka"1222      ]1223    },1224    "Small Kwama Egg": {1225      "name": "Small Kwama Egg",1226      "image": "//images.uesp.net/7/73/MW-icon-ingredient-Kwama_Egg.png",1227      "collect": "Found in Egg Mines. Also common food item in houses.",1228      "type": "ingredient",1229      "effects": [1230        "Restore Fatigue"1231      ]1232    },1233    "Small Wrapped Corprusmeat": {1234      "name": "Small Wrapped Corprusmeat",1235      "image": "//images.uesp.net/7/7a/MW-icon-ingredient-Corpusmeat_02.png",1236      "collect": "These are found in abundance in most 6th House strongholds",1237      "type": "ingredient",1238      "effects": [1239        "Drain Fatigue",1240        "Drain Health",1241        "Drain Magicka"1242      ]1243    },1244    "Snow Bear Pelt": {1245      "name": "Snow Bear Pelt",1246      "image": "//images.uesp.net/2/2a/BM-icon-ingredient-Snow_Bear_Pelt.png",1247      "collect": "Found by killing Snow Bears",1248      "addon": "Bloodmoon",1249      "type": "ingredient",1250      "effects": [1251        "Drain Fatigue",1252        "Fortify Speed",1253        "Resist Common Disease",1254        "Night Eye"1255      ]1256    },1257    "Snow Wolf Pelt": {1258      "name": "Snow Wolf Pelt",1259      "image": "//images.uesp.net/8/81/BM-icon-ingredient-Snow_Wolf_Pelt.png",1260      "collect": "Found by killing Snow Wolves",1261      "addon": "Bloodmoon",1262      "type": "ingredient",1263      "effects": [1264        "Drain Fatigue",1265        "Fortify Speed",1266        "Resist Common Disease",1267        "Night Eye"1268      ]1269    },1270    "Spore Pod": {1271      "name": "Spore Pod",1272      "image": "//images.uesp.net/a/a4/MW-icon-ingredient-Spore_Pod.png",1273      "collect": "Found on Slough Ferns growing in the Bitter Coast region",1274      "type": "ingredient",1275      "effects": [1276        "Drain Strength",1277        "Drain Fatigue",1278        "Detect Key",1279        "Paralyze"1280      ]1281    },1282    "Stoneflower Petals": {1283      "name": "Stoneflower Petals",1284      "image": "//images.uesp.net/1/17/MW-icon-ingredient-Stoneflower_Petals.png",1285      "collect": "These flowers are common in the West Gash and Ascadian Isles regions.",1286      "type": "ingredient",1287      "effects": [1288        "Restore Strength",1289        "Fortify Magicka",1290        "Drain Luck",1291        "Fortify Personality"1292      ]1293    },1294    "Sweetpulp": {1295      "name": "Sweetpulp",1296      "image": "//images.uesp.net/1/18/TR-icon-ingredient-Sweetpulp.png",1297      "collect": "Found in planters throughout Mournhold",1298      "addon": "Tribunal",1299      "type": "ingredient",1300      "effects": [1301        "Paralyze",1302        "Levitate",1303        "Resist Paralysis",1304        "Restore Health"1305      ]1306    },1307    "Timsa-Come-By flowers": {1308      "name": "Timsa-Come-By flowers",1309      "image": "//images.uesp.net/6/6d/TR-icon-ingredient-Timsa-Come-By_Flowers.png",1310      "collect": "Found in planters throughout Mournhold",1311      "addon": "Tribunal",1312      "type": "ingredient",1313      "effects": [1314        "Dispel",1315        "Resist Paralysis",1316        "Drain Magicka",1317        "Restore Endurance"1318      ]1319    },1320    "Trama Root": {1321      "name": "Trama Root",1322      "image": "//images.uesp.net/5/53/MW-icon-ingredient-Trama_Root.png",1323      "collect": "Found growing in dry, hilly regions",1324      "type": "ingredient",1325      "effects": [1326        "Restore Willpower",1327        "Levitate",1328        "Drain Magicka",1329        "Drain Speed"1330      ]1331    },1332    "Treated Bittergreen Petals": {1333      "name": "Treated Bittergreen Petals",1334      "image": "//images.uesp.net/e/e3/MW-icon-ingredient-Bittergreen_Petal.png",1335      "type": "ingredient",1336      "effects": [1337        "Restore Intelligence",1338        "Drain Magicka",1339        "Drain Endurance",1340        "Invisibility"1341      ],1342      "addon": "(Special)",1343      "collect": "Given by Taros Dral of the Morag Tong to poison Balyn Omavel for Mephala's Quest."1344    },1345    "Unripened Belladonna Berries": {1346      "name": "Unripened Belladonna Berries",1347      "image": "//images.uesp.net/7/76/BM-icon-ingredient-Belladonna_Berries.png",1348      "collect": "Grows all over Solstheim.Common at barrow entrances.",1349      "addon": "Bloodmoon",1350      "type": "ingredient",1351      "effects": [1352        "Resist Magicka",1353        "Restore Magicka",1354        "Fortify Magicka",1355        "Drain Magicka"1356      ]1357    },1358    "Vampire Dust": {1359      "name": "Vampire Dust",1360      "image": "//images.uesp.net/8/80/MW-icon-ingredient-Vampire_Dust.png",1361      "collect": "Found by killing Vampires",1362      "type": "ingredient",1363      "effects": [1364        "Fortify Health",1365        "Fortify Strength",1366        "Spell Absorption",1367        "Vampirism"1368      ]1369    },1370    "Violet Coprinus": {1371      "name": "Violet Coprinus",1372      "image": "//images.uesp.net/8/8e/MW-icon-ingredient-Violet_Coprinus.png",1373      "collect": "These mushrooms grow throughout the Bitter Coast region, and are also common in caves.",1374      "type": "ingredient",1375      "effects": [1376        "Water Walking",1377        "Drain Fatigue",1378        "Poison"1379      ]1380    },1381    "Void Salts": {1382      "name": "Void Salts",1383      "image": "//images.uesp.net/0/00/MW-icon-ingredient-Void_Salts.png",1384      "collect": "Found by killing Storm Atronachs or Winged Twilights",1385      "type": "ingredient",1386      "effects": [1387        "Restore Magicka",1388        "Spell Absorption",1389        "Paralyze",1390        "Drain Endurance"1391      ]1392    },1393    "Wickwheat": {1394      "name": "Wickwheat",1395      "image": "//images.uesp.net/f/fc/MW-icon-ingredient-Wickwheat.png",1396      "collect": "Found growing in the Grazelands region",1397      "type": "ingredient",1398      "effects": [1399        "Restore Health",1400        "Fortify Willpower",1401        "Paralyze",1402        "Damage Intelligence"1403      ]1404    },1405    "Willow Anther": {1406      "name": "Willow Anther",1407      "image": "//images.uesp.net/c/c9/MW-icon-ingredient-Willow_Anther.png",1408      "collect": "Most common in the Ascadian Isles region",1409      "type": "ingredient",1410      "effects": [1411        "Drain Personality",1412        "Frost Shield",1413        "Cure Common Disease",1414        "Cure Paralyzation"1415      ]1416    },1417    "Wolf Pelt": {1418      "name": "Wolf Pelt",1419      "image": "//images.uesp.net/1/1d/BM-icon-ingredient-Wolf_Pelt.png",1420      "collect": "Found by killing Wolves",1421      "addon": "Bloodmoon",1422      "type": "ingredient",1423      "effects": [1424        "Drain Fatigue",1425        "Fortify Speed",1426        "Resist Common Disease",1427        "Night Eye"1428      ]1429    },1430    "Wolfsbane Petals": {1431      "name": "Wolfsbane Petals",1432      "image": "//images.uesp.net/3/3b/BM-icon-ingredient-Wolfsbane_Petals.png",1433      "collect": "Grows on Hvitkald Peak. One found in Lassnr's shack in the Skaal village.",1434      "addon": "Bloodmoon",1435      "type": "ingredient",1436      "effects": [1437        "Restore Intelligence",1438        "Invisibility",1439        "Drain Endurance",1440        "Drain Magicka"1441      ]1442    },1443    "Wrapped Corprusmeat Hunk": {1444      "name": "Wrapped Corprusmeat Hunk",1445      "image": "//images.uesp.net/d/d9/MW-icon-ingredient-Corpusmeat_04.png",1446      "collect": "These are found in abundance in most 6th House strongholds",1447      "type": "ingredient",1448      "effects": [1449        "Drain Fatigue",1450        "Drain Health",1451        "Drain Magicka"1452      ]1453    }1454  };...

Full Screen

Full Screen

spells.js

Source:spells.js Github

copy

Full Screen

1import * as spellCategories from './spellCategories'2export default [3  {4    spellCategory: spellCategories.COMBAT,5    isElemental: true,6    isDirect: false,7    name: 'Acid Stream',8    tags: [],9    isLOS: true,10    isArea: false,11    isMana: false,12    isPhysicalDamage: true,13    drain: -3,14    duration: 'I',15  },16  {17    spellCategory: spellCategories.COMBAT,18    isElemental: true,19    isDirect: false,20    name: 'Toxic Wave',21    tags: [],22    isLOS: true,23    isArea: true,24    isMana: false,25    isPhysicalDamage: true,26    drain: -1,27    duration: 'I',28  },29  {30    spellCategory: spellCategories.COMBAT,31    isElemental: false,32    isDirect: false,33    name: 'Punch',34    tags: [],35    isLOS: false,36    isArea: false,37    isMana: false,38    isPhysicalDamage: false,39    drain: -6,40    duration: 'I',41  },42  {43    spellCategory: spellCategories.COMBAT,44    isElemental: false,45    isDirect: false,46    name: 'Clout',47    tags: [],48    isLOS: true,49    isArea: false,50    isMana: false,51    isPhysicalDamage: false,52    drain: -3,53    duration: 'I',54  },55  {56    spellCategory: spellCategories.COMBAT,57    isElemental: false,58    isDirect: false,59    name: 'Blast',60    tags: [],61    isLOS: true,62    isArea: true,63    isMana: false,64    isPhysicalDamage: false,65    drain: 0,66    duration: 'I',67  },68  {69    spellCategory: spellCategories.COMBAT,70    isElemental: false,71    isDirect: true,72    name: 'DeathTouch',73    tags: [],74    isLOS: false,75    isArea: false,76    isMana: true,77    isPhysicalDamage: true,78    drain: -6,79    duration: 'I',80  },81  {82    spellCategory: spellCategories.COMBAT,83    isElemental: false,84    isDirect: true,85    name: 'Manabolt',86    tags: [],87    isLOS: true,88    isArea: false,89    isMana: true,90    isPhysicalDamage: true,91    drain: -3,92    duration: 'I',93  },94  {95    spellCategory: spellCategories.COMBAT,96    isElemental: false,97    isDirect: true,98    name: 'Manaball',99    tags: [],100    isLOS: true,101    isArea: true,102    isMana: true,103    isPhysicalDamage: true,104    drain: 0,105    duration: 'I',106  },107  {108    spellCategory: spellCategories.COMBAT,109    isElemental: true,110    isDirect: false,111    name: 'Flamethrower',112    tags: [],113    isLOS: true,114    isArea: false,115    isMana: false,116    isPhysicalDamage: true,117    drain: -3,118    duration: 'I',119  },120  {121    spellCategory: spellCategories.COMBAT,122    isElemental: true,123    isDirect: false,124    name: 'Fireball',125    tags: [],126    isLOS: true,127    isArea: true,128    isMana: false,129    isPhysicalDamage: true,130    drain: -1,131    duration: 'I',132  },133  {134    spellCategory: spellCategories.COMBAT,135    isElemental: true,136    isDirect: false,137    name: 'Lightning Bolt',138    tags: [],139    isLOS: true,140    isArea: false,141    isMana: false,142    isPhysicalDamage: true,143    drain: -3,144    duration: 'I',145  },146  {147    spellCategory: spellCategories.COMBAT,148    isElemental: true,149    isDirect: false,150    name: 'Ball Lightning',151    tags: [],152    isLOS: true,153    isArea: true,154    isMana: false,155    isPhysicalDamage: true,156    drain: -1,157    duration: 'I',158  },159  {160    spellCategory: spellCategories.COMBAT,161    isElemental: false,162    isDirect: true,163    name: 'Shatter',164    tags: [],165    isLOS: false,166    isArea: false,167    isMana: false,168    isPhysicalDamage: true,169    drain: -6,170    duration: 'I',171  },172  {173    spellCategory: spellCategories.COMBAT,174    isElemental: false,175    isDirect: true,176    name: 'Powerbolt',177    tags: [],178    isLOS: true,179    isArea: false,180    isMana: false,181    isPhysicalDamage: true,182    drain: -3,183    duration: 'I',184  },185  {186    spellCategory: spellCategories.COMBAT,187    isElemental: false,188    isDirect: true,189    name: 'Powerball',190    tags: [],191    isLOS: true,192    isArea: true,193    isMana: false,194    isPhysicalDamage: true,195    drain: 0,196    duration: 'I',197  },198  {199    spellCategory: spellCategories.COMBAT,200    isElemental: false,201    isDirect: true,202    name: 'Knockout',203    tags: [],204    isLOS: false,205    isArea: false,206    isMana: true,207    isPhysicalDamage: false,208    drain: -6,209    duration: 'I',210  },211  {212    spellCategory: spellCategories.COMBAT,213    isElemental: false,214    isDirect: true,215    name: 'Stunbolt',216    tags: [],217    isLOS: true,218    isArea: false,219    isMana: true,220    isPhysicalDamage: false,221    drain: -3,222    duration: 'I',223  },224  {225    spellCategory: spellCategories.COMBAT,226    isElemental: false,227    isDirect: true,228    name: 'Stunball',229    tags: [],230    isLOS: true,231    isArea: true,232    isMana: true,233    isPhysicalDamage: false,234    drain: 0,235    duration: 'I',236  },237  {238    spellCategory: spellCategories.DETECTION,239    name: 'Analyze Device',240    tags: [],241    isActive: true,242    isDirectional: true,243    isMana: false,244    isLOS: false,245    isArea: false,246    isExtendedArea: false,247    isPsychic: false,248    duration: 'S',249    drain: -3,250  },251  {252    spellCategory: spellCategories.DETECTION,253    name: 'Analyze Magic',254    tags: [],255    isActive: true,256    isDirectional: true,257    isMana: false,258    isLOS: false,259    isArea: false,260    isExtendedArea: false,261    isPsychic: false,262    duration: 'S',263    drain: -3,264  },265  {266    spellCategory: spellCategories.DETECTION,267    name: 'Analyze Truth',268    tags: [],269    isActive: true,270    isDirectional: true,271    isMana: true,272    isLOS: false,273    isArea: false,274    isExtendedArea: false,275    isPsychic: false,276    duration: 'S',277    drain: -2,278  },279  {280    spellCategory: spellCategories.DETECTION,281    name: 'Clairaudience',282    tags: [],283    isActive: false,284    isDirectional: true,285    isMana: true,286    isLOS: false,287    isArea: false,288    isExtendedArea: false,289    isPsychic: false,290    duration: 'S',291    drain: -3,292  },293  {294    spellCategory: spellCategories.DETECTION,295    name: 'Clairvoyance',296    tags: [],297    isActive: false,298    isDirectional: true,299    isMana: true,300    isLOS: false,301    isArea: false,302    isExtendedArea: false,303    isPsychic: false,304    duration: 'S',305    drain: -3,306  },307  {308    spellCategory: spellCategories.DETECTION,309    name: 'Combat Sense',310    tags: [],311    isActive: true,312    isDirectional: false,313    isMana: true,314    isLOS: false,315    isArea: false,316    isExtendedArea: false,317    isPsychic: true,318    duration: 'S',319    drain: 0,320  },321  {322    spellCategory: spellCategories.DETECTION,323    name: 'Detect Enemies',324    tags: [],325    isActive: true,326    isDirectional: false,327    isMana: true,328    isLOS: false,329    isArea: true,330    isExtendedArea: false,331    isPsychic: false,332    duration: 'S',333    drain: -2,334  },335  {336    spellCategory: spellCategories.DETECTION,337    name: 'Detect Enemies, Extended',338    tags: [],339    isActive: true,340    isDirectional: false,341    isMana: true,342    isLOS: false,343    isArea: false,344    isExtendedArea: true,345    isPsychic: false,346    duration: 'S',347    drain: 0,348  },349  {350    spellCategory: spellCategories.DETECTION,351    name: 'Detect Individual',352    tags: [],353    isActive: true,354    isDirectional: false,355    isMana: true,356    isLOS: false,357    isArea: true,358    isExtendedArea: false,359    isPsychic: false,360    duration: 'S',361    drain: -3,362  },363  {364    spellCategory: spellCategories.DETECTION,365    name: 'Detect Life',366    tags: [],367    isActive: true,368    isDirectional: false,369    isMana: true,370    isLOS: false,371    isArea: false,372    isExtendedArea: true,373    isPsychic: false,374    duration: 'S',375    drain: -1,376  },377  {378    spellCategory: spellCategories.DETECTION,379    name: 'Detect [Life Form]',380    tags: [],381    isActive: true,382    isDirectional: false,383    isMana: true,384    isLOS: false,385    isArea: true,386    isExtendedArea: false,387    isPsychic: false,388    duration: 'S',389    drain: -2,390  },391  {392    spellCategory: spellCategories.DETECTION,393    name: 'Detect [Life Form], Extended',394    tags: [],395    isActive: true,396    isDirectional: false,397    isMana: true,398    isLOS: false,399    isArea: false,400    isExtendedArea: true,401    isPsychic: false,402    duration: 'S',403    drain: 0,404  },405  {406    spellCategory: spellCategories.DETECTION,407    name: 'Detect Magic',408    tags: [],409    isActive: true,410    isDirectional: false,411    isMana: true,412    isLOS: false,413    isArea: true,414    isExtendedArea: false,415    isPsychic: false,416    duration: 'S',417    drain: -2,418  },419  {420    spellCategory: spellCategories.DETECTION,421    name: 'Detect Magic, Extended',422    tags: [],423    isActive: true,424    isDirectional: false,425    isMana: true,426    isLOS: false,427    isArea: true,428    isExtendedArea: false,429    isPsychic: false,430    duration: 'S',431    drain: 0,432  },433  {434    spellCategory: spellCategories.DETECTION,435    name: 'Detect [Object]',436    tags: [],437    isActive: true,438    isDirectional: false,439    isMana: false,440    isLOS: false,441    isArea: true,442    isExtendedArea: false,443    isPsychic: false,444    duration: 'S',445    drain: -2,446  },447  {448    spellCategory: spellCategories.DETECTION,449    name: 'Mindlink',450    tags: [],451    isActive: true,452    isDirectional: false,453    isMana: true,454    isLOS: false,455    isArea: false,456    isExtendedArea: false,457    isPsychic: true,458    duration: 'S',459    drain: -1,460  },461  {462    spellCategory: spellCategories.DETECTION,463    name: 'Mind Probe',464    tags: [],465    isActive: true,466    isDirectional: true,467    isMana: true,468    isLOS: false,469    isArea: false,470    isExtendedArea: false,471    isPsychic: false,472    duration: 'S',473    drain: 0,474  },475  {476    spellCategory: spellCategories.HEALTH,477    name: 'Antidote',478    tags: [],479    isEssence: false,480    isMana: true,481    isLOS: false,482    isArea: false,483    duration: 'P',484    drain: -3,485  },486  {487    spellCategory: spellCategories.HEALTH,488    name: 'Cure Disease',489    tags: [],490    isEssence: true,491    isMana: true,492    isLOS: false,493    isArea: false,494    duration: 'P',495    drain: -4,496  },497  {498    spellCategory: spellCategories.HEALTH,499    name: 'Decrease [Attribute]',500    tags: [],501    isEssence: true,502    isMana: false,503    isLOS: false,504    isArea: false,505    duration: 'S',506    drain: -2,507  },508  {509    spellCategory: spellCategories.HEALTH,510    name: 'Detox',511    tags: [],512    isEssence: false,513    isMana: true,514    isLOS: false,515    isArea: false,516    duration: 'P',517    drain: -6,518  },519  {520    spellCategory: spellCategories.HEALTH,521    name: 'Heal',522    tags: [],523    isEssence: true,524    isMana: true,525    isLOS: false,526    isArea: false,527    duration: 'P',528    drain: -4,529  },530  {531    spellCategory: spellCategories.HEALTH,532    name: 'Increase [Attribute]',533    tags: [],534    isEssence: true,535    isMana: false,536    isLOS: false,537    isArea: false,538    duration: 'S',539    drain: -3,540  },541  {542    spellCategory: spellCategories.HEALTH,543    name: 'Increase Reflexes',544    tags: [],545    isEssence: true,546    isMana: false,547    isLOS: false,548    isArea: false,549    duration: 'S',550    drain: 0,551  },552  {553    spellCategory: spellCategories.HEALTH,554    name: 'Oxygenate',555    tags: [],556    isEssence: false,557    isMana: false,558    isLOS: false,559    isArea: false,560    duration: 'S',561    drain: -5,562  },563  {564    spellCategory: spellCategories.HEALTH,565    name: 'Prophylaxis',566    tags: [],567    isEssence: false,568    isMana: true,569    isLOS: false,570    isArea: false,571    duration: 'S',572    drain: -4,573  },574  {575    spellCategory: spellCategories.HEALTH,576    name: 'Resist Pain',577    tags: [],578    isEssence: false,579    isMana: true,580    isLOS: false,581    isArea: false,582    duration: 'P',583    drain: -6,584  },585  {586    spellCategory: spellCategories.HEALTH,587    name: 'Stabilize',588    tags: [],589    isEssence: false,590    isMana: true,591    isLOS: false,592    isArea: false,593    duration: 'P',594    drain: -4,595  },596  {597    spellCategory: spellCategories.ILLUSION,598    name: 'Agony',599    tags: [],600    isRealistic: true,601    isMultisense: false,602    isLOS: true,603    isArea: false,604    isMana: true,605    duration: 'S',606    drain: -4,607  },608  {609    spellCategory: spellCategories.ILLUSION,610    name: 'Mass Agony',611    tags: [],612    isRealistic: true,613    isMultisense: true,614    isLOS: true,615    isArea: true,616    isMana: true,617    duration: 'S',618    drain: -2,619  },620  {621    spellCategory: spellCategories.ILLUSION,622    name: 'Bugs',623    tags: [],624    isRealistic: true,625    isMultisense: true,626    isLOS: true,627    isArea: false,628    isMana: true,629    duration: 'S',630    drain: -3,631  },632  {633    spellCategory: spellCategories.ILLUSION,634    name: 'Swarm',635    tags: [],636    isRealistic: true,637    isMultisense: true,638    isLOS: true,639    isArea: true,640    isMana: true,641    duration: 'S',642    drain: -1,643  },644  {645    spellCategory: spellCategories.ILLUSION,646    name: 'Confusion',647    tags: [],648    isRealistic: true,649    isMultisense: true,650    isLOS: true,651    isArea: false,652    isMana: true,653    duration: 'S',654    drain: -3,655  },656  {657    spellCategory: spellCategories.ILLUSION,658    name: 'Mass Confusion',659    tags: [],660    isRealistic: true,661    isMultisense: true,662    isLOS: true,663    isArea: true,664    isMana: true,665    duration: 'S',666    drain: -1,667  },668  {669    spellCategory: spellCategories.ILLUSION,670    name: 'Chaos',671    tags: [],672    isRealistic: true,673    isMultisense: true,674    isLOS: true,675    isArea: false,676    isMana: false,677    duration: 'S',678    drain: -2,679  },680  {681    spellCategory: spellCategories.ILLUSION,682    name: 'Chaotic World',683    tags: [],684    isRealistic: true,685    isMultisense: true,686    isLOS: true,687    isArea: true,688    isMana: false,689    duration: 'S',690    drain: 0,691  },692  {693    spellCategory: spellCategories.ILLUSION,694    name: 'Entertainment',695    tags: [],696    isRealistic: false,697    isMultisense: true,698    isLOS: true,699    isArea: true,700    isMana: true,701    duration: 'S',702    drain: -3,703  },704  {705    spellCategory: spellCategories.ILLUSION,706    name: 'Trid Entertainment',707    tags: [],708    isRealistic: false,709    isMultisense: true,710    isLOS: true,711    isArea: true,712    isMana: false,713    duration: 'S',714    drain: -2,715  },716  {717    spellCategory: spellCategories.ILLUSION,718    name: 'Invisibility',719    tags: [],720    isRealistic: true,721    isMultisense: false,722    isLOS: true,723    isArea: false,724    isMana: true,725    duration: 'S',726    drain: -2,727  },728  {729    spellCategory: spellCategories.ILLUSION,730    name: 'Improved Invisibility',731    tags: [],732    isRealistic: true,733    isMultisense: false,734    isLOS: true,735    isArea: false,736    isMana: false,737    duration: 'S',738    drain: -1,739  },740  {741    spellCategory: spellCategories.ILLUSION,742    name: 'Mask',743    tags: [],744    isRealistic: true,745    isMultisense: true,746    isLOS: false,747    isArea: false,748    isMana: true,749    duration: 'S',750    drain: -2,751  },752  {753    spellCategory: spellCategories.ILLUSION,754    name: 'Physical Mask',755    tags: [],756    isRealistic: true,757    isMultisense: true,758    isLOS: false,759    isArea: false,760    isMana: false,761    duration: 'S',762    drain: -1,763  },764  {765    spellCategory: spellCategories.ILLUSION,766    name: 'Phantasm',767    tags: [],768    isRealistic: true,769    isMultisense: true,770    isLOS: true,771    isArea: true,772    isMana: true,773    duration: 'S',774    drain: -1,775  },776  {777    spellCategory: spellCategories.ILLUSION,778    name: 'Trid Phantasm',779    tags: [],780    isRealistic: true,781    isMultisense: true,782    isLOS: true,783    isArea: true,784    isMana: false,785    duration: 'S',786    drain: 0,787  },788  {789    spellCategory: spellCategories.ILLUSION,790    name: 'Hush',791    tags: [],792    isRealistic: true,793    isMultisense: false,794    isLOS: true,795    isArea: true,796    isMana: true,797    duration: 'S',798    drain: -2,799  },800  {801    spellCategory: spellCategories.ILLUSION,802    name: 'Silence',803    tags: [],804    isRealistic: true,805    isMultisense: false,806    isLOS: true,807    isArea: true,808    isMana: false,809    duration: 'S',810    drain: -1,811  },812  {813    spellCategory: spellCategories.ILLUSION,814    name: 'Stealth',815    tags: [],816    isRealistic: true,817    isMultisense: false,818    isLOS: true,819    isArea: false,820    isMana: false,821    duration: 'S',822    drain: -2,823  },824  {825    spellCategory: spellCategories.MANIPULATION,826    name: 'Armor',827    tags: [],828    isPhysical: true,829    isMental: false,830    isEnvironmental: false,831    isDamaging: false,832    isLOS: true,833    isArea: false,834    isMana: false,835    duration: 'S',836    drain: -1,837  },838  {839    spellCategory: spellCategories.MANIPULATION,840    name: 'Control Actions',841    tags: [],842    isPhysical: false,843    isMental: true,844    isEnvironmental: false,845    isDamaging: false,846    isLOS: true,847    isArea: false,848    isMana: true,849    duration: 'S',850    drain: -1,851  },852  {853    spellCategory: spellCategories.MANIPULATION,854    name: 'Mob Control',855    tags: [],856    isPhysical: false,857    isMental: true,858    isEnvironmental: false,859    isDamaging: false,860    isLOS: true,861    isArea: true,862    isMana: true,863    duration: 'S',864    drain: 1,865  },866  {867    spellCategory: spellCategories.MANIPULATION,868    name: 'Control Thoughts',869    tags: [],870    isPhysical: false,871    isMental: true,872    isEnvironmental: false,873    isDamaging: false,874    isLOS: true,875    isArea: false,876    isMana: true,877    duration: 'S',878    drain: 1,879  },880  {881    spellCategory: spellCategories.MANIPULATION,882    name: 'Mob Mind',883    tags: [],884    isPhysical: false,885    isMental: true,886    isEnvironmental: false,887    isDamaging: false,888    isLOS: true,889    isArea: true,890    isMana: true,891    duration: 'S',892    drain: 1,893  },894  {895    spellCategory: spellCategories.MANIPULATION,896    name: 'fling',897    tags: [],898    isPhysical: true,899    isMental: false,900    isEnvironmental: false,901    isDamaging: false,902    isLOS: true,903    isArea: false,904    isMana: false,905    duration: 'I',906    drain: -2,907  },908  {909    spellCategory: spellCategories.MANIPULATION,910    name: 'Ice Sheet',911    tags: [],912    isPhysical: false,913    isMental: false,914    isEnvironmental: true,915    isLOS: true,916    isArea: true,917    isMana: false,918    duration: 'I',919    drain: 0,920  },921  {922    spellCategory: spellCategories.MANIPULATION,923    name: 'Ignite',924    tags: [],925    isPhysical: true,926    isMental: false,927    isEnvironmental: false,928    isLOS: true,929    isArea: false,930    isMana: false,931    duration: 'P',932    drain: -1,933  },934  {935    spellCategory: spellCategories.MANIPULATION,936    name: 'Influence',937    tags: [],938    isPhysical: false,939    isMental: true,940    isEnvironmental: false,941    isLOS: true,942    isArea: false,943    isMana: true,944    duration: 'P',945    drain: -1,946  },947  {948    spellCategory: spellCategories.MANIPULATION,949    name: 'Levitate',950    tags: [],951    isPhysical: true,952    isMental: false,953    isEnvironmental: false,954    isLOS: true,955    isArea: false,956    isMana: false,957    duration: 'S',958    drain: -2,959  },960  {961    spellCategory: spellCategories.MANIPULATION,962    name: 'Light',963    tags: [],964    isPhysical: false,965    isMental: false,966    isEnvironmental: true,967    isLOS: true,968    isArea: true,969    isMana: false,970    duration: 'S',971    drain: -4,972  },973  {974    spellCategory: spellCategories.MANIPULATION,975    name: 'Magic Fingers',976    tags: [],977    isPhysical: true,978    isMental: false,979    isEnvironmental: false,980    isLOS: true,981    isArea: false,982    isMana: false,983    duration: 'S',984    drain: -2,985  },986  {987    spellCategory: spellCategories.MANIPULATION,988    name: 'Mana Barrier',989    tags: [],990    isPhysical: false,991    isMental: false,992    isEnvironmental: true,993    isLOS: true,994    isArea: true,995    isMana: true,996    duration: 'S',997    drain: -2,998  },999  {1000    spellCategory: spellCategories.MANIPULATION,1001    name: 'Physical Barrier',1002    tags: [],1003    isPhysical: false,1004    isMental: false,1005    isEnvironmental: true,1006    isLOS: true,1007    isArea: true,1008    isMana: false,1009    duration: 'S',1010    drain: -1,1011  },1012  {1013    spellCategory: spellCategories.MANIPULATION,1014    name: 'Poltergeist',1015    tags: [],1016    isPhysical: false,1017    isMental: false,1018    isEnvironmental: true,1019    isLOS: true,1020    isArea: true,1021    isMana: false,1022    duration: 'S',1023    drain: -2,1024  },1025  {1026    spellCategory: spellCategories.MANIPULATION,1027    name: 'Shadow',1028    tags: [],1029    isPhysical: false,1030    isMental: false,1031    isEnvironmental: true,1032    isLOS: true,1033    isArea: true,1034    isMana: false,1035    duration: 'S',1036    drain: -3,1037  },...

Full Screen

Full Screen

basic-test.js

Source:basic-test.js Github

copy

Full Screen

1import Ember from 'ember';2import {module, test} from 'qunit';3import startApp from '../../helpers/start-app';4import { stubRequest } from '../../helpers/fake-server';5let App;6let stackHandle = 'my-stack-handle',7    stackId = 'my-stack-id',8    orgName = 'my org',9    orgId = '1',10    url = `stacks/${stackId}/logging`;11module('Acceptance: Log Drains', {12  beforeEach: function() {13    App = startApp();14    stubStacks();15    stubOrganization({id: orgId, name: orgName});16  },17  afterEach: function() {18    Ember.run(App, 'destroy');19  },20  prepareStubs: function(options, databasesPayload){21    let defaultLogDrains = [{22      id: 'drain-1',23      handle: 'first-drain',24      drain_host: 'abcdef.com',25      drain_port: 123,26      status: 'provisioning'27    }];28    options = options || {logDrains: defaultLogDrains};29    stubStack({30      id: stackId,31      handle: stackHandle,32      _embedded: { log_drains: options.logDrains },33      _links: {34        organization: { href: `/organizations/${orgId}`},35        databases: { href: `/accounts/${stackId}/databases` }36     }37    });38    stubRequest('get', 'log_drains/:id', function(request) {39      let matchedLogDrain = {};40      options.logDrains.forEach(function(logDrain, i){41        if (options.logDrains[i].id === request.params.id) {42          matchedLogDrain = options.logDrains[i];43        }44      });45      return this.success(matchedLogDrain);46    });47    databasesPayload = databasesPayload || [{id: 'db-1', type: 'elasticsearch'}];48    stubStackDatabases(stackId, databasesPayload);49  }50});51function openModal() {52  let openButton = findWithAssert('.open-log-drain-modal').eq(0);53  openButton.click();54}55test(`visit ${url} requires authentication`, function(){56  expectRequiresAuthentication(url);57});58test(`visit ${url} shows basic info`, function(assert){59  let logDrains = [{60    id: 'drain-1',61    handle: 'first-drain',62    drain_host: 'abcdef.com',63    drain_port: 123,64    status: 'provisioned'65  }, {66    id: 'drain-2',67    handle: 'second-drain',68    drain_host: 'second.com',69    drain_port: 456,70    status: 'pending'71  }, {72    id: 'drain-3',73    handle: 'second-drain',74    drain_host: 'second.com',75    drain_port: 456,76    status: 'deprovisioning'77  }];78  this.prepareStubs({logDrains});79  signInAndVisit(url);80  andThen(function(){81    assert.equal(currentPath(), 'requires-authorization.enclave.stack.log-drains.index');82    expectButton('Create Log Drain');83    let logDrainEls = find('.log-drain');84    assert.equal( logDrainEls.length, logDrains.length, 'shows all 3 log drains');85    logDrains.forEach(function(logDrain, i){86      let logDrainEl = find(`.log-drain:eq(${i})`);87      assert.ok( logDrainEl.text().indexOf( logDrain.drain_host ) > -1,88          'shows drain host');89      assert.ok( logDrainEl.text().indexOf( logDrain.drain_port ) > -1,90          'shows drain port');91      expectTitle(`${stackHandle} Log Drains`);92    });93    assert.ok(find('h5:contains(Provisioned Log Drains)').length, 'has a provisioned header');94    assert.equal(find('.provisioned-log-drains .log-drain').length, 1, 'has one provisioned log drain');95    assert.ok(find('h5:contains(Provisioning Log Drains)').length, 'has a pending header');96    assert.equal(find('.pending-log-drains .log-drain').length, 1, 'has one pending log drain');97    assert.ok(find('h5:contains(Deprovisioning Log Drains)').length, 'has a deprovisioning header');98    assert.equal(find('.deprovisioning-log-drains .log-drain').length, 1, 'has one deprovisioning log drain');99  });100});101test(`visit ${url} shows pending and provisioning`, function(assert){102  let logDrains = [{103    id: 'drain-1',104    handle: 'first-drain',105    drain_host: 'abcdef.com',106    drain_port: 123,107    status: 'pending'108  }, {109    id: 'drain-2',110    handle: 'second-drain',111    drain_host: 'second.com',112    drain_port: 456,113    status: 'provisioning'114  }];115  this.prepareStubs({logDrains});116  signInAndVisit(url);117  andThen(function(){118    assert.equal(currentPath(), 'requires-authorization.enclave.stack.log-drains.index');119    expectButton('Create Log Drain');120    let logDrainEls = find('.log-drain');121    assert.equal( logDrainEls.length, logDrains.length );122    assert.ok(find('h5:contains(Provisioning Log Drains)').length, 'has a pending header');123    assert.ok(find('h5:contains(Host)').length, 'has host section');124    assert.equal(find('.pending-log-drains .log-drain').length, 2, 'has one pending log drain');125  });126});127test(`visit ${url} shows log tail explanation`, function(assert) {128  let logDrains = [{129    id: 'drain-1',130    handle: 'first-drain',131    drain_type: 'tail',132    status: 'pending'133  }];134  this.prepareStubs({logDrains});135  signInAndVisit(url);136  andThen(function(){137    assert.equal(currentPath(), 'requires-authorization.enclave.stack.log-drains.index');138    assert.ok(!find('h5:contains(Host)').length, 'has no host section');139    assert.ok(find('h3:contains(log drain was automatically provisioned)').length, 'has tail explanation');140  });141});142test(`visit ${url} with no log drains will show message`, function(assert) {143  this.prepareStubs({logDrains:[]});144  signInAndVisit(url);145  andThen(function() {146     assert.equal(currentPath(), 'requires-authorization.enclave.stack.log-drains.index');147    assert.equal(find('.activate-notice:contains(has no log drains)').length, 1, 'shows notice of no apps');148    assert.equal(find('.open-log-drain-modal:contains(Create Log Drain)').length, 1, 'Shows create log drain button');149  });150});151test(`visit ${url} with log drains and click add log shows form`, function(assert){152  this.prepareStubs();153  signInAndVisit(url);154  andThen(openModal);155  andThen(function() {156    let formEl = find('form.create-log');157    assert.ok( formEl.length, 'has form');158    let context = formEl;159    expectInput('drain-host', {context});160    expectInput('drain-port', {context});161    expectInput('handle', {context});162    expectInput('drain-type', {context});163    expectFocusedInput('handle', {context});164    expectButton('Save Log Drain');165    expectButton('Cancel');166  });167});168test(`visit ${url} with log drains and restart one`, function(assert){169  let operationId = 1;170  let defaultLogDrains = { logDrains: [{171    id: 'drain-1',172    handle: 'first-drain',173    drain_host: 'abcdef.com',174    drain_port: 123,175    status: 'provisioned'176  }]};177  this.prepareStubs(defaultLogDrains);178  stubRequest('post', `/log_drains/:id/operations`, function(request){179    let json = this.json(request);180    assert.equal(json.type, 'configure', 'creates a configure operation');181    return this.success({182      id: '1',183      status: 'queued',184      type: 'configure'185    });186  });187  stubRequest('get', `/operations/${operationId}`, function(){188    return this.success({189      id: '1',190      status: 'succeeded',191      type: 'configure'192    });193  });194  stubRequest('put', `/log_drains/:id`, function(request){195    let drain = this.json(request);196    assert.equal(drain.status, 'provisioning', 'sets status to provisioning for polling');197    drain.id = request.params.id;198    return this.success(drain);199  });200  signInAndVisit(url);201  andThen(function(){202    clickButton('Restart');203  });204  andThen(function() {205    assert.equal(find('.alert-success').length, 1, 'displays a success message');206  });207});208test(`visit ${url} with log drains and deprovisions one`, function(assert){209  this.prepareStubs();210  let operationId = 1;211  stubRequest('post', `/log_drains/:id/operations`, function(request){212    let json = this.json(request);213    assert.equal(json.type, 'deprovision', 'creates a deprovision operation');214    return this.success({215      id: '1',216      status: 'queued',217      type: 'deprovision'218    });219  });220  stubRequest('get', `/operations/${operationId}`, function(){221    return this.success({222      id: '1',223      status: 'succeeded',224      type: 'deprovision'225    });226  });227  stubRequest('put', `/log_drains/:id`, function(request){228    let drain = this.json(request);229    assert.equal(drain.status, 'deprovisioning', 'sets status to deprovisioning');230    drain.id = request.params.id;231    return this.success(drain);232  });233  signInAndVisit(url);234  andThen(function(){235    // Clobber window confirm to accept delete.236    window.confirm = () => { return true; };237    clickButton('Delete');238  });239  andThen(function() {240    assert.equal(find('.alert-success').length, 1, 'displays a success message');241    assert.equal(currentPath(), 'requires-authorization.enclave.stack.log-drains.index',242      'should first redirect to index page');243  });244});245test(`visit ${url} and cancel`, function(assert){246  this.prepareStubs();247  signInAndVisit(url);248  andThen(openModal);249  andThen(function(){250    clickButton('Cancel');251  });252  andThen(function(){253    assert.equal(currentPath(), 'requires-authorization.enclave.stack.log-drains.index');254  });255});256test(`visit ${url} and create log success`, function(assert){257  assert.expect(8);258  this.prepareStubs();259  var drainHost = 'abc-host.com',260      drainPort = '1234',261      handle = 'my-log-name',262      drainType = 'syslog_tls_tcp',263      logDrainId = 'log-id-1';264  stubRequest('post', '/accounts/:stack_id/log_drains', function(request){265    assert.ok(true, 'posts to log_drains');266    let json = this.json(request);267    assert.equal(json.drain_host, drainHost);268    assert.equal(json.drain_port, drainPort);269    assert.equal(json.drain_type, drainType);270    assert.equal(json.handle, handle);271    json.id = logDrainId;272    json.status='provisioning';273    return this.success(json);274  });275  stubRequest('get', `/log_drains/${logDrainId}`, function(){276    assert.ok(true, 'polls for updates');277    return this.success({278      id: logDrainId,279      handle: handle,280      drain_host: drainHost,281      drain_port: drainPort282    });283  });284  stubRequest('post', `/log_drains/${logDrainId}/operations`, function(request){285    let json = this.json(request);286    assert.equal(json.type, 'configure', 'creates configure operation');287    return this.success();288  });289  signInAndVisit(url);290  andThen(openModal);291  andThen(function(){292    let formEl = find('form.create-log');293    let context = formEl;294    fillInput('drain-host', drainHost, {context});295    fillInput('drain-port', drainPort, {context});296    fillInput('handle', handle, {context});297    clickButton('Save Log Drain', {context});298  });299  andThen(function(){300    assert.equal(currentPath(), 'requires-authorization.enclave.stack.log-drains.index');301  });302});303test(`visit ${url} without elasticsearch databases`, function(assert){304  this.prepareStubs(null, []);305  signInAndVisit(url);306  andThen(openModal);307  andThen(function(){308    click( find('label:contains(Elasticsearch)')); // click elasticsearch radio button309  });310  andThen(function() {311    let saveButton = find('button:contains(Save Log Drain)');312    assert.ok(find('.no-es-databases-warning').length, 'shows warning');313    assert.ok(saveButton.is(':disabled'), 'save button is disabled');314  });315});316test(`visit ${url} and create log to elasticsearch`, function(assert){317  assert.expect(8);318  let drainUser = 'someUser',319      drainPassword = 'somePw',320      drainHost = 'abc-host.com',321      drainPort = '1234',322      drainType = 'elasticsearch',323      logDrainId = 'log-drain-foo',324      databaseHandle = 'databaseHandle';325  let databasesPayload = [326    {327      id: 'db-1',328      type: 'elasticsearch',329      handle: 'do-not-pick-me',330      connection_url: `http:\/\/user:password@foo-bar.com:4567`331    }, {332      id: 'db-2',333      type: 'elasticsearch',334      handle: databaseHandle,335      connection_url: `http:\/\/${drainUser}:${drainPassword}@${drainHost}:${drainPort}`336    }337  ];338  this.prepareStubs(null, databasesPayload);339  stubRequest('post', '/accounts/:stack_id/log_drains', function(request){340    assert.ok(true, 'posts to log_drains');341    let json = this.json(request);342    assert.equal(json.drain_host, drainHost);343    assert.equal(json.drain_port, drainPort);344    assert.equal(json.drain_type, drainType);345    assert.equal(json.drain_password, drainPassword);346    assert.equal(json.drain_username, drainUser);347    json.id = logDrainId;348    json.status = 'provisioning';349    return this.success(json);350  });351  stubRequest('post', `/log_drains/${logDrainId}/operations`, function(){352    return this.success();353  });354  stubRequest('get', `/log_drains/${logDrainId}`, function(){355    assert.ok(true, 'polls for updates');356    return this.success({357      id: logDrainId,358      status: 'provisioned',359      drainHost: drainHost,360      drainPort: drainPort,361      handle: logDrainId,362      drainType: drainType,363      databaseHandle: databaseHandle364    });365  });366  signInAndVisit(url);367  andThen(openModal);368  andThen(function(){369    let formEl = find('form.create-log');370    let context = formEl;371    click( find('label:contains(Elasticsearch)')); // click elasticsearch radio button372    fillInput('handle', 'handle', { context });373    fillInput('database-selector', 'db-2');374    clickButton('Save Log', {context});375  });376  andThen(function(){377    assert.equal(currentPath(), 'requires-authorization.enclave.stack.log-drains.index');378  });379});380test(`visit ${url} and create log to HTTPS`, function(assert){381  assert.expect(7);382  this.prepareStubs();383  let drainHost = 'abc-host.com',384      drainPort = '443',385      drainType = 'https',386      handle    = 'https-test',387      logDrainId = 'log-drain-bar';388  stubRequest('post', '/accounts/:stack_id/log_drains', function(request){389    assert.ok(true, 'posts to log_drains');390    let json = this.json(request);391    assert.equal(json.drain_host, drainHost);392    assert.equal(json.drain_port, drainPort);393    assert.equal(json.drain_type, drainType);394    assert.equal(json.handle, handle);395    json.id = logDrainId;396    return this.success(json);397  });398  stubRequest('get', '/log_drains/:id', function(request){399    return this.success({400      id: request.params.id,401      handle: handle,402      drain_host: drainHost,403      drain_port: drainPort404    });405  });406  stubRequest('post', `/log_drains/${logDrainId}/operations`, function(request){407    let json = this.json(request);408    assert.equal(json.type, 'configure', 'creates configure operation');409    return this.success();410  });411  signInAndVisit(url);412  andThen(openModal);413  andThen(function(){414    let formEl = find('form.create-log');415    let context = formEl;416    click( find('label:contains(HTTPS)')); // click HTTPS radio button417    fillInput('drain-host', drainHost, {context});  // Port should default to 443418    fillInput('handle', handle, {context});419    clickButton('Save Log Drain', {context});420  });421  andThen(function(){422    assert.equal(currentPath(), 'requires-authorization.enclave.stack.log-drains.index');423  });424});425test(`visit ${url} and create log failure`, function(assert){426  this.prepareStubs();427  let errorMessage = 'The log drain is invalid';428  stubRequest('post', '/accounts/:stack_id/log_drains', function(){429    assert.ok(true, 'posts to log_drains');430    return this.error({ message: errorMessage });431  });432  signInAndVisit(url);433  andThen(openModal);434  andThen(function(){435    let formEl = find('form.create-log');436    clickButton('Save Log', {context:formEl});437  });438  andThen(function(){439    assert.equal(currentPath(), 'requires-authorization.enclave.stack.log-drains.index');440    let errorDiv = find('.alert');441    assert.ok( errorDiv.length, 'error div is shown');442    assert.ok( errorDiv.text().indexOf(errorMessage) > -1,443        'error message is displayed');444  });445});446test(`visit ${url} when unverified disables create button`, function(assert) {447  this.prepareStubs();448  let userData = {verified: false};449  signInAndVisit(url, userData);450  andThen( () => {451    let createButton = findWithAssert('.btn:contains(Create Log Drain)');452    assert.ok(createButton.attr('disabled'), 'button is disabled');453  });...

Full Screen

Full Screen

pshWellInput.js

Source:pshWellInput.js Github

copy

Full Screen

1var SGuid = getQueryStr("SGuid");2var id = getQueryStr("id");3var title = getQueryStr("title");4var type = getQueryStr("type");//修改还是查看5var url=""; 6$(function(){7	initClick();8	//扩展获取表单方法9	$.fn.serializeObject = function() {  10		var o = {};    11	    var a = this.serializeArray();    12	    $.each(a, function() {    13	        if (o[this.name]) {    14	            if (!o[this.name].push) {    15	                o[this.name] = [ o[this.name] ];    16	            }    17	            o[this.name].push(this.value || '');    18	        } else {    19	            o[this.name] = this.value || '';    20	        }    21	    });    22	    return o;    23	};24	loadData();25});26function loadData(){27	if(type=="update"){28		var data=window.parent.wellDateNow;29		$("#wellIndex").val(data.wellIndex);30		if(data.id){31			$("#id").val(data.id);32		}33		if(data.x){34			$("#x").val(data.x);35		}36		if(data.y){37			$("#y").val(data.y);38		}39		if(data.pipeType && data.pipeType!=""){40			$(":radio[name='pipeType'][value='"+data.pipeType+"']").prop("checked", "checked");41			if($('input[name="pipeType"]:checked').val()==undefined){42				$(":radio[name='pipeType'][value='其他']").prop("checked", "checked");43				$("#pipeType").val(data.pipeType);44				$("#glb").show();45			}46			47		}48		if(data.wellId && data.wellId!=""){49			$("#wellId").val(data.wellId);50			$("#wellIdName").val("窨井("+data.wellId+")");51		}52		if(data.wellType && data.wellType!=""){53			$(":radio[name='wellType'][value='"+data.wellType+"']").prop("checked", "checked");54			if($('input[name="wellType"]:checked').val()==undefined){55				$(":radio[name='wellType'][value='其他']").prop("checked", "checked");56				$("#wellType").val(data.wellType);57				$("#jlb").show();58			}59			if(data.wellType=="合流检测井" || data.wellType=="污水检测井"){60		   		$("#wsld").show();61		   		$("#qtysld").hide();62		   	}else{63		   		$("#wsld").hide();64		   		$("#qtysld").show();65		   	}66		}67		if(data.wellPro && data.wellPro!=""){68			var wellProData="淤积,堵塞,无水流动,晴天有水流动";69			if(data.wellPro.indexOf(",")>=0){70				var wellPros=data.wellPro.split(",");71				for(var i in wellPros){72					if(wellProData.indexOf(wellPros[i])>=0){73						$(":checkbox[name='wellPro'][value='"+wellPros[i]+"']").prop("checked", "checked");74					}else{75						$(":checkbox[name='wellPro'][value='其他']").prop("checked", "checked");76						if(wellPros[i].indexOf("其他:") >= 0){77							$("#wellPro").val(wellPros[i].substring(3,wellPros[i].length));78						}else{79							$("#wellPro").val(wellPros[i]);80						}81						$("#jczdwt").show();82					}83				}84			}else{85				if(wellProData.indexOf(data.wellPro)>=0){86					$(":checkbox[name='wellPro'][value='"+data.wellPro+"']").prop("checked", "checked");87				}else{88					$(":checkbox[name='wellPro'][value='其他']").prop("checked", "checked");89					if(data.wellPro.indexOf("其他:") >= 0){90						$("#wellPro").val(data.wellPro.substring(3,data.wellPro.length));91					}else{92						$("#wellPro").val(data.wellPro);93					}94					$("#jczdwt").show();95				}96			}97		}98		if(data.wellDir && data.wellDir!=""){99			$(":radio[name='wellDir'][value='"+data.wellDir+"']").prop("checked", "checked");100			if($('input[name="wellDir"]:checked').val()==undefined){101				$(":radio[name='wellDir'][value='其他']").prop("checked", "checked");102				$("#wellDir").val(data.wellDir);103				$("#psqx").show();104			}105			106		}107		if(data.drainPro && data.drainPro!=""){108			if(data.drainPro.indexOf("#")>=0){109				var drainPros=data.drainPro.split("#");110				if(drainPros[0] && drainPros[0]=="雨污混接"){111					$(":checkbox[name='drainPro'][value='雨污混接']").prop("checked", "checked");112				}113				if(drainPros[1] && drainPros[1]!=""){114					$(":checkbox[name='drainPro'][value='排水性状异常(描述)']").prop("checked", "checked");115					$("#ycms").val(drainPros[1]);116					$("#ycms").show();117				}118				if(drainPros[2] && drainPros[2]=="偷排"){119					$(":checkbox[name='drainPro'][value='偷排']").prop("checked", "checked");120				}121				if(drainPros[3] && drainPros[3]!=""){122					$(":checkbox[name='drainPro'][value='其他(描述)']").prop("checked", "checked");123					$("#qtms").val(drainPros[3]);124					$("#qtms").show();125				}126			}127		}128	}129}130//格式化排水存在的问题131function formatDrainPro(drainPro){132	if(drainPro==null) return '';133	drainPro=drainPro.replace(/##/g, '#').replace(/##/g, '#');134	if(drainPro.length>1){135		if(drainPro.charAt(drainPro.length-1)=='#'){136			drainPro=drainPro.substring(0,drainPro.length-1);137		}138	}139	if(drainPro.length>0){140		if(drainPro.charAt(0)=='#'){141			drainPro=drainPro.replace(/#/, '');142		}143	}144	drainPro=drainPro.replace(/#/g, '、');145	return drainPro;146}147function initClick(){148	$("input[name='pipeType']").click(function(){149       if($(this).val()=="其他"){150    	   $("#glb").show();151       }else{152    	   $("#glb").hide();153       }154    });155	$("input[name='wellType']").click(function(){156       if($(this).val()=="其他"){157    	   $("#jlb").show();158       }else{159    	   $("#jlb").hide();160       }161       $(":checkbox[name='wellPro']").removeAttr("checked");//取消全选162	   	if($(this).val()=="合流检测井" || $(this).val()=="污水检测井"){163	   		$("#wsld").show();164	   		$("#qtysld").hide();165	   	}else{166	   		$("#wsld").hide();167	   		$("#qtysld").show();168	   	}169    });170	$("input[name='wellPro']").click(function(){171		var wellPro="";172		$("input:checkbox[name='wellPro']:checked").each(function() { 173			wellPro+="%"+$(this).val();174		});175       if($(this).val()=="其他"){176    	   if(wellPro.indexOf("%其他")>=0){177    		   $("#jczdwt").show();178    	   }else{179    		   $("#jczdwt").hide(); 180    	   }181       }182    });183	$("input[name='wellDir']").click(function(){184       if($(this).val()=="其他"){185    	   $("#psqx").show();186       }else{187    	   $("#psqx").hide();188       }189    });190	$("input[name='drainPro']").click(function(){191		var drainPro="";192		$("input:checkbox[name='drainPro']:checked").each(function() { 193			drainPro+="%"+$(this).val();194		});195       if($(this).val()=="排水性状异常(描述)"){196    	   if(drainPro.indexOf("%排水性状异常(描述)")>=0){197    		   $("#ycms").show();198    	   }else{199    		   $("#ycms").hide(); 200    	   }201       }else if($(this).val()=="其他(描述)"){202    	   if(drainPro.indexOf("%其他(描述)")>=0){203    		   $("#qtms").show();204    	   }else{205    		   $("#qtms").hide(); 206    	   }207       }208    });209}210//选择接驳井211function connectWell() {    212    layer.open({213		type: 2,214		title: "选择接驳井",215		shadeClose: false,216		// closeBtn : [0 , true],217		shade: 0.5,218		maxmin: false, //开启最大化最小化按钮219		area: ['700px', '350px'],220		//offset: ['0px', $(window).width()/2-230+'px'],221		content: "/psxj/psh/psh_lr/wellDW.html?SGuid="+SGuid+"&wellId="+$('#wellId').val(),222		cancle:function(){223		},224		end : function(){225		}226	});227}228function isArray(o){229	return Object.prototype.toString.call(o)=='[object Array]';230}231//保存232function save(){233	var wellPro="";234	$("input:checkbox[name='wellPro']:checked").each(function() { 235		wellPro+="%"+$(this).val();236	});237	var drainPro="";238	$("input:checkbox[name='drainPro']:checked").each(function() { 239		drainPro+="%"+$(this).val();240	});241	242	//校验243	if($('input[name="pipeType"]:checked').val() == undefined){244		layer.msg('管类别不能为空', {icon: 7});245		return;246	}else if($('input[name="pipeType"]:checked').val() == "其他" && $("#pipeType").val() == ""){247		layer.msg('管类别-其他不能为空', {icon: 7});248		return;249	} else if($('input[name="wellType"]:checked').val() == undefined){250		layer.msg('井类别不能为空', {icon: 7});251		return;252	}else if($('input[name="wellType"]:checked').val() == "其他" && $("#wellType").val() == ""){253		layer.msg('井类别-其他不能为空', {icon: 7});254		return;255	}else if(wellPro.indexOf("%其他")>=0 && $("#wellPro").val() == ""){256		layer.msg('井存在问题-其他不能为空', {icon: 7});257		return;258	}else if($('input[name="wellDir"]:checked').val() == undefined){259		layer.msg('排水去向不能为空', {icon: 7});260		return;261	}else if($('input[name="wellDir"]:checked').val() == "其他" && $("#wellDir").val() == ""){262		layer.msg('排水去向-其他不能为空', {icon: 7});263		return;264	}else if(drainPro.indexOf("%排水性状异常(描述)")>=0 && $("#ycms").val() == ""){265		layer.msg('排水存在的问题-排水性状异常不能为空', {icon: 7});266		return;267	}else if(drainPro.indexOf("%其他(描述)")>=0 && $("#qtms").val() == ""){268		layer.msg('排水存在的问题-其他不能为空', {icon: 7});269		return;270	}271	//获取表单数据及处理272	var well = $("#well").serializeObject();273	var ywell= $("#well").serializeObject();274	if(well.pipeType=="其他"){275		if(well.glb!=""){276			well.pipeType=well.glb;277		}278	}279	if(well.wellType=="其他"){280		if(well.jlb!=""){281			well.wellType=well.jlb;282		}283	}284	if(well.wellPro && well.wellPro.length>0){285		var wellPro="";286		if(isArray(well.wellPro)){287			for( var i = 0; i <well.wellPro.length; i++){288				if(i==0){289					wellPro+=well.wellPro[i];290				}else{291					wellPro+=","+well.wellPro[i];292				}293			}294		}else{295			wellPro=well.wellPro;296		}297		298		if(wellPro.indexOf("其他")>=0){299			wellPro=wellPro.replace(/其他/g, "其他:"+well.jczdwt)300			//well.wellPro="其他:"+well.jczdwt;301		}302		well.wellPro=wellPro;303	}else{304		well.wellPro="";305	}306	if(well.wellDir=="其他"){307		if(well.psqx!=""){308			well.wellDir=well.psqx;309		}310	}311	if(well.drainPro && well.drainPro.length>0){312		var drainPro="";313		/*for( var i = 0; i <well.drainPro.length; i++){314			drainPro+=well.drainPro[i]+"#";315		}*/316		$("input:checkbox[name='drainPro']").each(function() {317			if($(this).prop('checked')){318				drainPro+=$(this).val()+"#";319			}else{320				drainPro+="#";321			}322		});323		if(drainPro.indexOf("排水性状异常(描述)")>=0){324			drainPro=drainPro.replace("排水性状异常(描述)", well.ycms)325		}326		if(drainPro.indexOf("其他(描述)")>=0){327			drainPro=drainPro.replace("其他(描述)", well.qtms)328		}329		well.drainPro=drainPro;330	}else{331		well.drainPro="####";332	}333	window.parent.addWell(ywell,well);334	window.parent.layer.closeAll();335}336//接驳井定位337function position(objectId){338	toMap();339	window.parent.parent.positionObjId(objectId);340}341//跳回到map地图342function toMap(){343	var aTab = parent.parent.$(".page-tabs-content a[data-id*='wrapper-map']");344    aTab.addClass("active").siblings(".J_menuTab").removeClass("active");345    var aContent = parent.parent.$(".J_mainContent .J_iframe[data-id*='wrapper-map']");346    aContent.show().siblings(".J_iframe").hide();...

Full Screen

Full Screen

pool-base.js

Source:pool-base.js Github

copy

Full Screen

1'use strict'2const DispatcherBase = require('./dispatcher-base')3const FixedQueue = require('./node/fixed-queue')4const { kConnected, kSize, kRunning, kPending, kQueued, kBusy, kFree, kUrl, kClose, kDestroy, kDispatch } = require('./core/symbols')5const PoolStats = require('./pool-stats')6const kClients = Symbol('clients')7const kNeedDrain = Symbol('needDrain')8const kQueue = Symbol('queue')9const kClosedResolve = Symbol('closed resolve')10const kOnDrain = Symbol('onDrain')11const kOnConnect = Symbol('onConnect')12const kOnDisconnect = Symbol('onDisconnect')13const kOnConnectionError = Symbol('onConnectionError')14const kGetDispatcher = Symbol('get dispatcher')15const kAddClient = Symbol('add client')16const kRemoveClient = Symbol('remove client')17const kStats = Symbol('stats')18class PoolBase extends DispatcherBase {19  constructor () {20    super()21    this[kQueue] = new FixedQueue()22    this[kClients] = []23    this[kQueued] = 024    const pool = this25    this[kOnDrain] = function onDrain (origin, targets) {26      const queue = pool[kQueue]27      let needDrain = false28      while (!needDrain) {29        const item = queue.shift()30        if (!item) {31          break32        }33        pool[kQueued]--34        needDrain = !this.dispatch(item.opts, item.handler)35      }36      this[kNeedDrain] = needDrain37      if (!this[kNeedDrain] && pool[kNeedDrain]) {38        pool[kNeedDrain] = false39        pool.emit('drain', origin, [pool, ...targets])40      }41      if (pool[kClosedResolve] && queue.isEmpty()) {42        Promise43          .all(pool[kClients].map(c => c.close()))44          .then(pool[kClosedResolve])45      }46    }47    this[kOnConnect] = (origin, targets) => {48      pool.emit('connect', origin, [pool, ...targets])49    }50    this[kOnDisconnect] = (origin, targets, err) => {51      pool.emit('disconnect', origin, [pool, ...targets], err)52    }53    this[kOnConnectionError] = (origin, targets, err) => {54      pool.emit('connectionError', origin, [pool, ...targets], err)55    }56    this[kStats] = new PoolStats(this)57  }58  get [kBusy] () {59    return this[kNeedDrain]60  }61  get [kConnected] () {62    return this[kClients].filter(client => client[kConnected]).length63  }64  get [kFree] () {65    return this[kClients].filter(client => client[kConnected] && !client[kNeedDrain]).length66  }67  get [kPending] () {68    let ret = this[kQueued]69    for (const { [kPending]: pending } of this[kClients]) {70      ret += pending71    }72    return ret73  }74  get [kRunning] () {75    let ret = 076    for (const { [kRunning]: running } of this[kClients]) {77      ret += running78    }79    return ret80  }81  get [kSize] () {82    let ret = this[kQueued]83    for (const { [kSize]: size } of this[kClients]) {84      ret += size85    }86    return ret87  }88  get stats () {89    return this[kStats]90  }91  async [kClose] () {92    if (this[kQueue].isEmpty()) {93      return Promise.all(this[kClients].map(c => c.close()))94    } else {95      return new Promise((resolve) => {96        this[kClosedResolve] = resolve97      })98    }99  }100  async [kDestroy] (err) {101    while (true) {102      const item = this[kQueue].shift()103      if (!item) {104        break105      }106      item.handler.onError(err)107    }108    return Promise.all(this[kClients].map(c => c.destroy(err)))109  }110  [kDispatch] (opts, handler) {111    const dispatcher = this[kGetDispatcher]()112    if (!dispatcher) {113      this[kNeedDrain] = true114      this[kQueue].push({ opts, handler })115      this[kQueued]++116    } else if (!dispatcher.dispatch(opts, handler)) {117      dispatcher[kNeedDrain] = true118      this[kNeedDrain] = !this[kGetDispatcher]()119    }120    return !this[kNeedDrain]121  }122  [kAddClient] (client) {123    client124      .on('drain', this[kOnDrain])125      .on('connect', this[kOnConnect])126      .on('disconnect', this[kOnDisconnect])127      .on('connectionError', this[kOnConnectionError])128    this[kClients].push(client)129    if (this[kNeedDrain]) {130      process.nextTick(() => {131        if (this[kNeedDrain]) {132          this[kOnDrain](client[kUrl], [this, client])133        }134      })135    }136    return this137  }138  [kRemoveClient] (client) {139    client.close(() => {140      const idx = this[kClients].indexOf(client)141      if (idx !== -1) {142        this[kClients].splice(idx, 1)143      }144    })145    this[kNeedDrain] = this[kClients].some(dispatcher => (146      !dispatcher[kNeedDrain] &&147      dispatcher.closed !== true &&148      dispatcher.destroyed !== true149    ))150  }151}152module.exports = {153  PoolBase,154  kClients,155  kNeedDrain,156  kAddClient,157  kRemoveClient,158  kGetDispatcher...

Full Screen

Full Screen

record.js

Source:record.js Github

copy

Full Screen

...10    userId: userId,11    ...eventData,12  };13  events = [...events, event];14  drain(writeKey, contextData, drainIntervalMilliseconds);15}16function drain(writeKey, contextData, drainIntervalMilliseconds) {17  const drainIntervalRemainder = drainIntervalMilliseconds - (Date.now() - lastDrainTime);18  const drainIntervalHasPast = drainIntervalRemainder <= 0;19  // If drain interval hasn't past yet, or there are no events, reshedule drain20  if (!drainIntervalHasPast || !events.length) {21    return _scheduleDrain();22  }23  // If there's no network connection, reshedule drain, else begin drain.24  return NetInfo.isConnected.fetch().done(isConnected => {25    if (isConnected) {26      return _beginDrain();27    }28    return _beginDrain();29    // return _scheduleDrain();30  });31  // - Drain helpers -32  function _scheduleDrain() {33    // Set timeout for `drainIntervalMilliseconds` to re-call drain with same34    // parameters.35    if (drainTimeout) {36      clearTimeout(drainTimeout);37    }38    drainTimeout = setTimeout(() => drain(writeKey, contextData, drainIntervalMilliseconds), drainIntervalMilliseconds);39    return drainTimeout;40  }41  function _beginDrain() {42    // Capture events to drain, and then empty `events` so that it can begin to43    // accumulate fresh events for the next drain interval.44    const drainEvents = events;45    events = [];46    const authKey = 'Basic ' + writeKey;47    // TODO: Ensure that the batch is less than 500kb, and if it's not, split it48    // into multiple requests.49    // Attempt to asynchronously import events to segment.50    return axios({51      method: 'post',52      url: 'https://api.segment.io/v1/import/',...

Full Screen

Full Screen

component.js

Source:component.js Github

copy

Full Screen

1import Ember from 'ember';2// We create an anchor since that is, afaik, the easiest way to parse a url in javascript3function parseUrl(url) {4  let a = document.createElement('a');5  a.href = url;6  a.hostWithoutPort = a.host.substring(0, a.host.lastIndexOf(':')); // Remove port7  // Workaround for HTMLAnchorElement not properly parsing username and password in phantomjs.8  if(!a.username && !a.password) {9    let credentials = url.substring(a.protocol.length + 2, url.lastIndexOf('@' + a.hostWithoutPort)).split(':');10    a.username = credentials[0];11    a.password = credentials[1];12  }13  return a;14}15export default Ember.Component.extend({16  newLogDrain: null,17  title: Ember.computed('stack.handle', function() {18    return `Create a new log drain on ${this.get('stack.handle')}`;19  }),20  description: Ember.computed('stack.handle', function() {21      return `Log Drains let you collect stdout and stderr logs from your apps22              deployed on ${this.get('stack.handle')} and route them to a log23              destination.`;24  }),25  isPending: Ember.computed.or('newLogDrain.isSaving', 'newLogDrain.isValidating'),26  hasError: Ember.computed.gt('errors.newLogDrain.handle.length', 0),27  isSyslogDrain: Ember.computed.equal('newLogDrain.drainType', 'syslog_tls_tcp'),28  isHttpsDrain: Ember.computed.equal('newLogDrain.drainType', 'https'),29  isHostPortDrain: Ember.computed.or('isSyslogDrain', 'isHttpsDrain'),30  disableSave: Ember.computed('isHostPortDrain', 'esDatabases', function() {31    return this.get('newLogDrain.isSaving') ||32           (!this.get('isHostPortDrain') &&33           this.get('esDatabases.length') === 0);34  }),35  setDrainFromDatabase: Ember.observer('esDatabase', function() {36    let database = this.get('esDatabase');37    if(database) {38      let connectionUrl = database.get('connectionUrl');39      let a = parseUrl(connectionUrl);40      let newLogDrain = this.get('newLogDrain');41      newLogDrain.set('drainHost', a.hostWithoutPort);42      newLogDrain.set('drainPort', a.port);43      newLogDrain.set('drainUsername', a.username);44      newLogDrain.set('drainPassword', a.password);45    }46  }),47  dismissOnSave: Ember.observer('newLogDrain.isNew', function() {48    if(this.get('newLogDrain.isNew') === false) {49      if (!this.isDestroyed) {50        this.sendAction('dismiss');51      }52    }53  }),54  focusHandle: Ember.on('didInsertElement', function() {55    Ember.run.later(() => {56      this.$('input').eq(0).focus();57    });58  }),59  actions: {60    httpsSelected () {61      let newLogDrain = this.get('newLogDrain');62      if (!newLogDrain.get('drainPort')) {63        newLogDrain.set('drainPort', '443');64      }65    },66    onDismiss() {67      this.get('newLogDrain').rollback();68      //this.sendAction('dismiss');69    },70    createLogDrain() {71      let logDrain = this.get('newLogDrain');72      this.sendAction('onCreateLogDrain', logDrain);73    },74    outsideClick: Ember.K75  }...

Full Screen

Full Screen

heroku.js

Source:heroku.js Github

copy

Full Screen

1const Heroku = require('heroku-client');2const hl = require('highland');3// function getLogDrains(app) {4//   const logDrainApi = heroku.apps(app.id).logDrains();5//   const logDrainList =  hl.wrapCallback(logDrainApi.list.bind(logDrainApi));6//   //yield 'logDrains';7//   return logDrainList8// }9function getLogDrains(app) {10  const logDrainApi = heroku.apps(app.id).logDrains();11    return hl(function (push, next) {12      logDrainApi.list((err, res) => {13        push(err, {app: app, logs: res});14        push(null, hl.nil);15      });16    });17}18var heroku = new Heroku({19  token: process.env.HEROKU_API_TOKEN20});21const hkApps = heroku.apps();22const appList = hl.wrapCallback(hkApps.list.bind(hkApps));23function showAppNameThat(filter) {24  return appList()25    .flatMap(x => x)26    .map(getLogDrains)27    .flatten()28    .filter(filter)29    .map(app => ({30      name: app.app.name,31      logs: app.logs32    }))33    .errors(e => console.log('error: ', e))34}35function haveNoLogsDrain(app) {36  return  app.logs.length === 037}38function haveLogsDrain(app) {39  return  app.logs.length !== 040}41module.exports = {42  haveDrains: () => showAppNameThat(haveLogsDrain),43  missingDrains: () => showAppNameThat(haveNoLogsDrain),44  addDrain: addDrain,45}46function addDrain(appName, drainUrl) {47  heroku.apps(appName).logDrains().create({url: drainUrl}, (err, res) => {48    if (err) console.log('Error creating drain for %s. Error: ', appName, JSON.stringify(err));49    else console.log('LogDrain created: %s, is now draining to %s', appName, drainUrl);50  })...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2  it('Does not do much!', function() {3    cy.pause()4    cy.contains('type').click()5    cy.url().should('include', '/commands/actions')6    cy.get('.action-email')7      .type('

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.on('uncaught:exception', (err, runnable) => {2  })3  describe('Test', () => {4    it('Test', () => {5      cy.get('input[name="username"]').type('test')6      cy.get('input[name="password"]').type('test')7      cy.get('button[type="submit"]').click()8      cy.get('a[href="/login"]').click()9      cy.get('input[name="username"]').type('test')10      cy.get('input[name="password"]').type('test')11      cy.get('button[type="submit"]').click()12      cy.get('a[href="/dashboard"]').click()13      cy.get('button[type="button"]').click()14      cy.get('a[href="/login"]').click()15      cy.get('input[name="username"]').type('test')16      cy.get('input[name="password"]').type('test')17      cy.get('button[type="submit"]').click()18      cy.get('a[href="/dashboard"]').click()19      cy.get('button[type="button"]').click()20      cy.get('a[href="/login"]').click()21      cy.get('input[name="username"]').type('test')22      cy.get('input[name="password"]').type('test')23      cy.get('button[type="submit"]').click()24      cy.get('a[href="/dashboard"]').click()25      cy.get('button[type="button"]').click()26      cy.get('a[href="/login"]').click()27      cy.get('input[name="username"]').type('test')28      cy.get('input[name="password"]').type('test')29      cy.get('button[type="submit"]').click()30      cy.get('a[href="/dashboard"]').click()31      cy.get('button[type="button"]').click()32      cy.get('a[href="/login"]').click()33      cy.get('input[name="username"]').type('test')34      cy.get('input[name="password"]').type('test')35      cy.get('button[type="submit"]').click()36      cy.get('a[href="/dashboard"]').click()37      cy.get('button[type="button"]').click()38      cy.get('a[href="/login"]').click()39      cy.get('input[name="username"]').type('test')40      cy.get('input[name="password"]').type('test')41      cy.get('button[type="submit"]').click()

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('button').click()2cy.get('button').click()3cy.get('button').click()4cy.get('button').click()5cy.get('button').click()6cy.wait(1000)7cy.get('button').click()8cy.get('button').click()9cy.get('button').click()10cy.get('button').click()11cy.get('button').click()12cy.wait(1000)13cy.get('button').click()14cy.get('button').click()15cy.get('button').click()16cy.get('button').click()17cy.get('button').click()18cy.wait(1000)19cy.get('button').click()20cy.get('button').click()21cy.get('button').click()22cy.get('button').click()23cy.get('button').click()24cy.wait(1000)25cy.get('button').click()26cy.get('button').click()27cy.get('button').click()28cy.get('button').click()29cy.get('button').click()30cy.wait(1000)31cy.get('button').click()32cy.get('button').click()33cy.get('button').click()34cy.get('button').click()35cy.get('button').click()36cy.wait(1000)37cy.get('button').click()38cy.get('button').click()39cy.get('button').click()40cy.get('button').click()41cy.get('button').click()42cy.wait(1000)43cy.get('button').click()44cy.get('button').click()45cy.get('button').click()46cy.get('button').click()47cy.get('button').click()48cy.wait(1000)49cy.get('button').click()50cy.get('button').click()51cy.get('button').click()52cy.get('button').click()53cy.get('button').click()54cy.wait(1000)55cy.get('button').click()56cy.get('button').click()57cy.get('button').click()58cy.get('button').click()59cy.get('button').click()60cy.wait(1000)61cy.get('button').click()62cy.get('button').click()63cy.get('button').click()64cy.get('button').click()65cy.get('button').click()66cy.wait(1000)67cy.get('button').click()68cy.get('button').click()69cy.get('button').click()70cy.get('button').click()71cy.get('button').click()72cy.wait(1000)73cy.get('button').click()

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('.drain').then(($drain) => {2  const drain = $drain[0];3  drain.addEventListener('click', () => {4    cy.wrap($drain).click();5  });6});

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test for drain method', () => {2    it('should drain the method', () => {3        cy.server()4        cy.route('GET', 'comments/*').as('getComment')5        cy.get('.network-btn').click()6        cy.wait('@getComment').then((xhr) => {7            cy.get('.network-comment').should('contain', xhr.response.body.name)8        })9    })10})11{12    "env": {13    },14    "testFiles": "**/*.{js,jsx,coffee,ts,tsx,feature,features}",15}16import './commands'

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Drain method', () => {2  it('Drains the current command queue and yields the previous subject', () => {3    cy.get('.action-btn').then(($btn) => {4      expect($btn).to.have.class('action-btn')5      $btn.text('Changed text')6      cy.get('.action-btn').drain().should('have.text', 'Changed text')7    })8  })9})

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