女孩子喜欢什么礼物| 黄芪什么时候种植| 盆腔炎做什么检查能查出来| 斑鸠是什么意思| 支气管炎吃什么消炎药| 什么星座最疼射手座| 第一颗原子弹叫什么| 鱼油不能和什么一起吃| 脚水肿吃什么药| camus是什么酒| NT是什么钱| 蜱虫长什么样| 便是什么意思| 左眼皮老是跳是什么原因| 白事的礼金叫什么| 买车置换是什么意思| 圣杯是什么意思| 白身是什么意思| 位移是什么| 养老金什么时候可以领取| 蜂蜜的波美度是什么意思| 20度穿什么| 既寿永昌什么意思| 围棋九段是什么水平| 穷的生肖指什么生肖| 坐西向东是什么宅| 靠谱什么意思| 舌苔发黑是什么病的前兆| 美女的阴暗是什么样的| 尿血是什么病| 晚上尿多是什么病| 祛痣后应注意什么| 绝经后子宫内膜增厚是什么原因| 血液是由什么组成的| 父亲节送什么好| 86属什么生肖| 洗了牙齿要注意什么| 乙肝抗体阳性是什么意思| 仙灵脾又叫什么| 夜晚咳嗽是什么原因| 定制和订制有什么区别| 妇联是干什么的| 测子女缘什么时候到来| 脑供血不足吃什么药好得快| 腿经常抽筋是什么原因| 印度人为什么用手抓饭吃| 肚脐下方硬硬的是什么| 为什么会有副乳| 减肥用什么好| 不复相见什么意思| 东吴在现在什么地方| espresso是什么咖啡| 腱鞘炎要挂什么科| 外阴起红点是什么病| 冰粉是什么做的| 2t是什么意思| eps是什么意思| 气血不足是什么意思| 什么病不能吃西兰花| 吃什么保肝护肝| 九头身什么意思| 益母草能治什么病| 治疗风湿有什么好方法| e6e7阳性是什么意思| mr是什么意思| 月经前一周失眠是什么原因| 鸡蛋白是什么| 马克杯是什么| fob什么意思| 苦杏仁味是什么中毒| 三生万物是什么意思| dw什么意思| 干咳无痰吃什么药效果最好| 家里为什么有蚂蚁| 1998年什么命| 粉玫瑰代表什么| 少阳证是什么意思| 不加一笔是什么字| 出山是什么意思| 空调综合征有什么症状| 木耳和什么菜搭配好吃| 胎盘1级什么意思| 什么叫屈光不正| other是什么意思| 十月二十七是什么星座| 贫血吃什么补品| 什么是顺时针| 花牛是什么| 什么东西蛋白质含量高| 肠子长息肉有什么症状| 慢性炎伴鳞化是什么意思| 什么是气滞| 无犯罪记录证明需要什么材料| 耳朵里长痘是什么原因| 遇人不淑什么意思| 瘁是什么意思| 巅峰是什么意思| 蓝玫瑰代表什么| 一月二十五号是什么星座| 71属什么生肖| 肝疼是什么原因| 什么的香味| 吃什么去胃火口臭| 马桶为什么叫马桶| 血管夹层是什么病| 什么人吃天麻最好| 目不暇接的意思是什么| 八岁属什么生肖| 水土不服吃什么药| 男人射精是什么感觉| 药剂科是干什么的| 口气重是什么原因| 胎儿靠什么吸收营养| 非典型细胞是什么意思| 女性夜尿多吃什么调理| 小腿外侧是什么经络| 床上放什么可以驱虫| 啃手指甲是什么毛病| 手指甲月牙代表什么| 王牌是什么意思| 碳酸氢铵是什么| 如花是什么意思| 胃火旺怎么调理吃什么药最好| 山昆读什么| 吃什么补钙快| 山野是什么意思| 什么叫风热感冒| 必要条件是什么意思| td什么意思| 世界上最高的塔是什么塔| 纸可以做什么| 抗皱用什么产品好| 梦到自己老公出轨是什么意思| 湛蓝是什么颜色| 微醺什么意思| 协警是什么编制| 吃什么消炎药可以喝酒| 光顾是什么意思| 蛾子吃什么| 冬至穿什么衣服| 2月11日什么星座| 核磁共振主要检查什么| 满月红鸡蛋用什么染| 4月7号是什么星座| 肺动脉高压用什么药| 过命之交是什么意思| vogue是什么牌子| 吃了拉肚子的药叫什么| 毛刺是什么意思| dia是什么意思| 婴儿掉头发是什么原因| 月亮星座是什么| 疯马皮是什么皮| 肝脏是什么功能| 考拉是什么意思| kipling是什么牌子| miffy是什么意思| 梦见闹离婚是什么意思| 阴道出血是什么原因引起的| 白葡萄酒配什么食物| 什么的交流| 根尖周炎吃什么药| 复方北豆根氨酚那敏片是什么药| 小分子肽有什么作用| 蓝牙耳机什么样的好| 拉肚子喝什么| 来大姨妈肚子疼是什么原因| 手掌痒是什么原因| 调和营卫是什么意思| fourone是什么牌子| 拔智齿挂什么科| 老上火是什么原因造成的| 立事牙疼吃什么药| 扁桃体发炎挂什么科| 绝眼是什么原因引起的| 胃不好可以喝什么茶| 什么是爱情观| 94年是什么年| 长豆角叫什么| 血糖高饮食需要注意什么| 野鸡吃什么食物| 梅艳芳什么病| 一直鼻塞是什么原因| 蝙蝠屎是什么中药| 特别容易饿是什么原因| 狗女和什么属相最配| 白化病是什么遗传| 偏光是什么意思| 鼻子出汗是什么原因| 胃疼想吐恶心是什么原因| 今年养殖什么最挣钱| 什么药止血效果最快| 政协副主席是什么级别| 先父什么意思| 皮肤细菌感染用什么药| 丙二醇是什么| 吃西红柿有什么好处和坏处| 耳后长痣代表什么意思| A型血为什么是完美血型| 舌尖发麻是什么原因| 肝掌是什么原因引起的| 寒门子弟是什么意思| 晗字五行属什么| 签退是什么意思| hcg是什么激素| 友尽是什么意思| 歪果仁是什么意思| 马黛茶什么味道| 大腿痛挂什么科| 男人吃荔枝有什么好处| 减肥吃什么肉| 半年抛是什么意思| 肾素高说明什么| 积液是什么原因造成的怎么治疗| 珍珠疹是什么| 心肌缺血是什么原因造成的| 出汗发粘是什么原因| 喝蒲公英有什么好处| 为什么抽烟会恶心想吐| hp检查是什么意思| 推拿和按摩有什么区别| 海带有什么营养| 乙肝表面抗原高是什么意思| 夫妻分床睡意味着什么| 扁头适合什么发型| 本科和专科有什么区别| 哈喇味是什么味道| 来月经为什么会拉肚子| 螃蟹为什么横着走| 玄米是什么米| 飞机杯是什么感觉| 聚乙二醇是什么东西| 琼脂是什么东西| 徐州二院全名叫什么| 骨科属于什么科| 起床头疼是什么原因| 尿后余沥是什么意思| 一只眼睛肿了是什么原因| 脾胃虚吃什么水果好| 哺乳期不能吃什么| 白发是什么原因引起的| 什么水果泡酒最好| 补肝血吃什么药| 封印是什么意思| 细菌性前列腺炎吃什么药| 泄身是什么意思| 属龙的和什么属相最配| 8月6日是什么星座| 狐臭什么味| 尿出来很黄是什么原因| 早上6点是什么时辰| 吃什么升血压| 92年什么命| 泌尿外科主要看什么病| 后羿是一个什么样的人| 铁马是什么| 血管痉挛是什么原因引起的| 囊性结节是什么意思| 蛇喜欢吃什么| 冬眠是什么意思| 息肉是什么| 腔梗是什么意思| 胆酷醇高有什么危害| 泪囊炎用什么眼药水| 百度

@masteratm/cypress-autorecord
TypeScript icon, indicating that this package has built-in type declarations

3.1.4???Public???Published

广西食药监公布3批次不合格产品 天猫等企业登黑榜

百度 本赛季至今科里奇在克罗地亚甲级联赛12次出场贡献了3球2助攻。

Cypress Autorecord is a plugin built to be used with Cypress.io. It simplifies mocking by auto-recording/stubbing HTTP interactions and automating the process of updating/deleting recordings. Spend more time writing integration tests instead of managing your mock data. Refer to the changelog for more details on all the changes.

v3.0.0 is now live!

Version 3 is now compatible with Cypress 6 and 7 and includes a few fixes. If you are using an earlier cypress version, you will need to use cypress-autorecord v2.x.

Getting Started

Install from npm

npm install --save-dev cypress-autorecord

Add this snippet in your project's /cypress/plugins/index.js

const fs = require('fs');
const autoRecord = require('cypress-autorecord/plugin');

module.exports = (on, config) => {
  autoRecord(on, config, fs);
};

To allow for auto-recording and stubbing to work, require cypress-autorecord in each of your test file and call the function at the beginning of your parent describe block.

const autoRecord = require('cypress-autorecord'); // Require the autorecord function
  
describe('Home Page', function() { // Do not use arrow functions
  autoRecord(); // Call the autoRecord function at the beginning of your describe block
  
  // Your hooks (beforeEach, afterEach, etc) goes here
  
  it('...', function() { // Do not use arrow functions
    // Your test goes here
  });
});

NOTE: Do not use ES6 arrow functions for your describe or it callback. This will cause the recording function to break.

That is it! Now, just run your tests and the auto-record will take care of the rest!

Updating Mocks

In the case you need to update your mocks for a particular test:

const autoRecord = require('cypress-autorecord');
  
describe('Home Page', function() {
  autoRecord();
  
  it('[r] my awesome test', function() { // Insert [r] at the beginning of your test name
    // ...
  });
});

This will force the test to record over your existent mocks for ONLY this test on your next run.

This can also be done through the configurations by adding the test name in the file cypress.json:

{
  "autorecord": {
    "recordTests": ["my awesome test"]
  }
}

Alternatively, you can update recordings for all tests by setting forceRecord to true before rerunning your tests:

{
  "autorecord": {
    "forceRecord": true
  }
}

Removing Stale Mocks

Stale mocks that are no longer being used can be automatically removed when you run your tests by setting cleanMocks to true in the file cypress.json:

{
  "autorecord": {
    "cleanMocks": true
  }
}

NOTE: Only mocks that are used during the run are considered "active". Make sure to only set cleanMocks to true when you are running ALL your tests. Remove any unintentional .only or .skip.

Set Recording Pattern For Cypress Intercept

By default autorecorder is recording all outgoing requests but if you want to record only specific calls based on pattern(Ex. just record api calls on backend), you can set interceptPattern in cypress.json. it is an array of glob

{
  "autorecord": {
    "interceptPattern": [
      "http://localhost:3000/api/**",
      "http://localhost:4000/api/**"
    ]
  }
}

How It Works

How does the recording and stubbing work?

Cypress Autorecord uses Cypress' built-in cy.intercept to hook into every request, including GET, POST, DELETE and PUT. If mocks doesn't exist for a test, the http calls (requests and responses) are captured and automatically written to a local file. If mocks exist for a test, each http call will be stubbed in the beforeEach hook.

Where are the mocks saved?

The mocks will be automatically generated and saved in the /cypress/mocks/ folder. Mocks are grouped by test name and test file name. You will find mock files matching the name of your test files. Within your mock files, mocks are organized by test names in the order that they were called. Changing the test file name or test name will result to a disconnection to the mocks and trigger a recording on your next run.

Can I manually update the mocks?

Mocks are saved as a simple json object and can be updated manually. This is not recommended since any manual change you make will be overwritten when you automatically update the mocks. Leave the data management to cypress-autorecord. Make any modifications to the http calls inside your test so that it will be consistent across recordings.

it('should display an error message when send message fails', function() {
  cy.route({
    url: '/message',
    method: 'POST',
    status: 404,
    response: { error: 'It did not work' },
  });

  cy.get('[data-cy="msgInput"]').type('Hello World!');
  cy.get('[data-cy="msgSend"]').click();
  cy.get('[data-cy="errorMessage"]').should('contain', 'Looks like we ran into a problem. Please try again.');
});

Known Issues

Only XMLHttpRequests will be recorded and stubbed

Cypress-autorecord leverages Cypress' built in cy.route to handle stubbing, which means that it inherits some limitations as well. This is the disclaimer on the cy.route documentation page with some potential workarounds:

Please be aware that Cypress only currently supports intercepting XMLHttpRequests. Requests using the Fetch API and other types of network requests like page loads and <script> tags will not be intercepted or visible in the Command Log. See #95 for more details and temporary workarounds.

Contributions

I would really appreciate any help with bug fixes or any new features you think might be relevant! Feel free to submit a PR!

Package Sidebar

Install

npm i @masteratm/cypress-autorecord

Weekly Downloads

0

Version

3.1.4

License

MIT

Unpacked Size

31.1 kB

Total Files

15

Last publish

Collaborators

  • masteratm
远字五行属什么 胶水用什么能洗掉 肺结核的痰是什么颜色 阴道瘙痒用什么药 玉树临风是什么意思
眉尾上方有痣代表什么 刚柔并济是什么意思 马云父母是做什么的 偏瘫是什么意思 徐才厚什么级别
什么原因导致月经量少 什么时候拔罐最好 TOYOTA是什么车 脸浮肿是什么病的前兆 孕妇为什么不能吃桃子
1974年属什么 11.20是什么星座 长湿疹是什么原因引起的 最大的罩杯是什么杯 人参片泡水喝有什么功效和作用
轻度溶血是什么意思hcv9jop0ns2r.cn 中耳炎吃什么药效果好hcv7jop4ns8r.cn 人为什么不可以偏食hcv8jop8ns7r.cn 亲家母是什么意思hcv9jop3ns9r.cn 针眼是什么hcv9jop2ns3r.cn
hbcab偏高是什么意思hcv8jop3ns9r.cn 舅舅的爸爸叫什么luyiluode.com 县团级是什么级别hcv9jop2ns1r.cn 嘴唇发黑什么原因hcv9jop4ns0r.cn 检查血脂挂什么科hcv8jop0ns0r.cn
湿疹是什么病hcv9jop7ns0r.cn 微量元素是什么hcv8jop1ns7r.cn 馀事勿取什么意思mmeoe.com 贪嗔痴是什么意思hcv7jop9ns8r.cn 福布斯是什么意思hcv8jop2ns4r.cn
皮赘用什么药膏去除hcv9jop1ns8r.cn 上焦湿热吃什么中成药hcv8jop9ns3r.cn 惊魂未定的意思是什么hcv8jop0ns3r.cn 什么是五官hcv9jop2ns7r.cn 榴莲跟什么不能一起吃hcv8jop5ns5r.cn
百度