cypress

Cypress web自动化30-操作窗口滚动条(scrollTo)

落爺英雄遲暮 提交于 2020-08-20 00:29:57
前言 web页面的操作,有些元素不在窗口上显示,需滑动滚动条才能显示出来,Cypress 可以使用 scrollTo 操作滚动条的位置。 可以根据窗口的位置来滚动,也可以根据屏幕像素或百分比来滚动。 相关语法 操作 window 窗口对象,窗口上的滚动条,可以直接使用 cy.scrollTo() cy.scrollTo(position) cy.scrollTo(x, y) cy.scrollTo(position, options) cy.scrollTo(x, y, options) // 正确用法示例 cy.scrollTo(0, 500) // Scroll the window 500px down 也可以先定位到元素,滚动到元素的位置 .scrollTo(position) .scrollTo(x, y) .scrollTo(position, options) .scrollTo(x, y, options) // 正确用法示例 cy.get('.sidebar').scrollTo('bottom') // Scroll 'sidebar' to its bottom 参数说明: position(字符串) 窗口或元素滚动到的指定位置,有效的位置topLeft,top,topRight,left,center,right,bottomLeft,bottom

Cypress学习4-table表格元素(别名使用Aliasing)

Deadly 提交于 2020-08-16 06:20:19
前言 页面上有些元素定位路径比较复杂,可以先定位到该元素使用别名,通过这个别名去操作元素,这样看起来简洁一些。 .as()使用别名定位元素 table表格上的元素定位使用示例 <table class="as-table table table-bordered"> <thead> <tr> <th>Column 1</th> <th>Column 2</th> </tr> </thead> <tbody> <tr> <td> Row 1: Cell 1 <button class="btn btn-primary btn-success">Changed</button> </td> <td> Row 1: Cell 2 <button class="btn btn-primary">Change</button> </td> </tr> <tr> <td> Row 2: Cell 1 <button class="btn btn-primary">Change</button> </td> <td> Row 2: Cell 2 <button class="btn btn-primary">Change</button> </td> </tr> </tbody> </table> // The following DOM command chain is unwieldy. /

Cypress学习5- Assertions断言使用(should, expect)

蹲街弑〆低调 提交于 2020-08-16 03:49:55
前言 每个测试用例需要加断言,Cypress里面断言常用的有should, expect 隐式断言 .should() 可以使用.should()给当前用例加断言 should('have.class', 'success') 断言元素的class属性值是 'success' should('have.text', 'Column content') 断言元素文本值 'Column content' should('contain', 'Column content') 断言元素文本包含 'Column content' should('have.html', 'Column content') 断言元素html文本'Column content' should('match', 'td') chai-jquery 使用 "is()"检查元素是否与选择器匹配 .invoke('text') .should('match', /column content/i) 文本与正则表达式匹配先使用invoke结合should .contains('text') 文本与正则表达式匹配元素文本包含,这种比上面更好 <table class="table table-bordered assertion-table"> <thead> <tr> <th>#</th> <th>Column

网络通信与便携式应用驱动SRAM技术发展

99封情书 提交于 2020-08-15 06:30:19
数据通信和便携式系统成为当今 SRAM 的重要应用领域。某些SRAM由于能够提供实现较高带宽所需的性能(比如在网络系统中)或维持较长电池使用寿命所需的低功耗(比如在便携式设备中)而在许多应用中起着主导作用。这些架构指的是面向高性能应用的NoBL (无总线延迟)和QDR (四倍数据速率)以及针对低性能应用的MoBL (更长的电池使用寿命)。 多年来工艺几何尺寸的不断压缩使得兼顾速度、功耗和密度的新型架构的推出成为可能。以CYPRESS为例。不断缩小的工艺几何尺寸使得各家公司能够在存储器技术上确立诸多优势,如实现更快的速度、更低的功耗、更高的存储密度和更有竞争力的制造成本。 网络与数据通信领域竞速在当今的网络应用中,分组处理需要极高的存储带宽。分组处理所涉及的多项功能再加上其他的存储功能对SRAM提出了不同的要求。人们已经开发出了所需的SRAM用新型协议和架构,以便对数据通信系统的需要提供支持。 目前网络系统中采用了多种同步快速SRAM架构,包括流水线突发型、直通型、无总线延迟(NoBL) (流水线/直通)型、双倍数据速率(DDR)型SRAM和四倍数据速率(QDR)型SRAM等等。同步流水线型和直通型SRAM面市已有很多年了,它们最初是为PC高速缓存应用而开发的。现今一般用于低性能网络领域,主要目的在于实现成本-效益性

符合汽车安全和质量标准的CYPRESS FRAM

 ̄綄美尐妖づ 提交于 2020-08-12 13:31:03
汽车设计人员在设计时必须考虑质量和安全性以及性能方面的考虑。汽车行业经验丰富的供应商通常会超出性能要求,赛普拉斯FRAM器件经过AEC-Q100认证,例如最高温度达到85°C或125°C-并且还拥有所有必要的认证,例如作为TS16949,支持PPAP流程,并与特定客户保持联合资格。 还必须符合ISO 262626功能安全标准,因此客户希望获得详细的可靠性报告和质量文件。对于Excelon-Auto设备,及时故障率(FIT)大大低于ISO 26262规范在组件级别要求的阈值。嵌入式纠错码(ECC)可确保写入和读取操作中的软错误率接近零,也远优于闪存或EEPROM器件。 总而言之,如今可以在EDR中使用符合汽车标准的 FRAM 存储设备,从而在事故发生前的最后一刻提供存储车辆传感器数据所需的快速操作和持久耐用性,而无需昂贵的缓冲存储器和备用电源。与传统的基于闪存或EEPROM的方法相比,在汽车EDR中使用FRAM产生了更简单,更小且性能更好的设计(请参见下图)。 图1:启用Excelon FRAM的PSOC6 Pioneer套件(来源:赛普拉斯半导体) 来源: oschina 链接: https://my.oschina.net/u/4393788/blog/4486957

Cypress web自动化25-生成mochawesome-report合并报告

非 Y 不嫁゛ 提交于 2020-08-11 07:22:33
前言 前一篇通过生成的 xml 报告最后用 allure 生成一个html报告内容。 我们也可以生成json格式的报告,最后把json格式报告合并成一个,最终生成一个html报告,这在分布式执行的时候用得到。 安装依赖包 我们需要安装几个依赖: npm install --save-dev mocha mochawesome mochawesome-merge mochawesome-report-generator 安装完成后会在 package.json 文件中生成对应的依赖包版本号信息 "devDependencies": { "cypress": "^4.5.0", "mocha": "^7.2.0", "mochawesome": "^6.1.1", "mochawesome-merge": "^4.0.3", "mochawesome-report-generator": "^5.1.0" } 然后在 cypress.json 配置 mochawesome 报告生成器,保存每一个JSON测试报告到cypress/results目录: reporter 选择报告生成器mochawesome reportDir 指定报告存放路径,不指定默认在项目目录下mochawesome-report overwrite 是否覆盖原来的报告 html 是否生成html报告 json

Cypress学习15-Hooks使用方法

百般思念 提交于 2020-08-10 22:20:28
前言 Cypress 提供了 hooks 函数,方便我们在组织测试用例的时候,设置用例的前置操作和后置清理。 类似于 python 的 unittest 里面的 setUp 和 setUpclass 功能 Hooks Cypress 提供了 hooks 函数。 这些有助于设置要在一组测试之前或每个测试之前运行的条件。它们也有助于在一组测试之后或每次测试之后清理条件。 describe('Hooks', () => { before(() => { // runs once before all tests in the block }) after(() => { // runs once after all tests in the block }) beforeEach(() => { // runs before each test in the block }) afterEach(() => { // runs after each test in the block }) }) Hooks 和测试执行的顺序如下: before()钩子运行(一次) beforeEach() 每个测试用例前都会运行 it 运行测试用例 afterEach() 每个测试用例之后都会运行 after() 钩子运行(一次) 执行案例 写2个测试用例,带上 hooks 函数,查看用例执行顺序, /

CORS policy error when trying to setRequestHeader in Cypress test

Deadly 提交于 2020-08-10 20:04:07
问题 Im my Cypress test I want to set x-forwarded-for header to force the browser to load a page with a specific locale. However, while doing so, I'm getting errors as following in the console: Access to XMLHttpRequest at '...' from origin '...' has been blocked by CORS policy: Request header field x-forwarded-for is not allowed by Access-Control-Allow-Headers in preflight response. In my cypress.json file, I have set: "env":{ "chromeWebSecurity": false } Which is supposed to prevent this from

CORS policy error when trying to setRequestHeader in Cypress test

北城余情 提交于 2020-08-10 20:03:33
问题 Im my Cypress test I want to set x-forwarded-for header to force the browser to load a page with a specific locale. However, while doing so, I'm getting errors as following in the console: Access to XMLHttpRequest at '...' from origin '...' has been blocked by CORS policy: Request header field x-forwarded-for is not allowed by Access-Control-Allow-Headers in preflight response. In my cypress.json file, I have set: "env":{ "chromeWebSecurity": false } Which is supposed to prevent this from

Incrementing and decrementing the value of an <input type=“number”/> in Cypress

六月ゝ 毕业季﹏ 提交于 2020-08-09 21:29:14
问题 I would like to test incrementing and decrementing the value of an HTML input field ( type="number" ) in Cypress. More precisely, I would prefer to increment and decrement the value using the arrow keys, but I can't seem to get this to work using the most apparent approach. As a minimal working example, I have set up a React component whose render method looks as follows: render() { return (<input type="number" />); }; Outside of Cypress, typing into this field works without any problems. The