cypress

cy.url() and/or cy.location('href') does not return a string

狂风中的少年 提交于 2020-04-15 06:50:52
问题 I have an editor page. When I add any content and click the "Save" button my URL will change, adding a random id in the URL. I want to check if my ID's are changing every time when I click the "Save button". I save the URL result in variable and want to check it, I do it like this: const currentURL = cy.url(); cy.get('.editor-toolbar-actions-save').click(); cy.url().should('not.eq', currentURL); But my currentURL variable's type is not string: expected http://localhost:8080/editor/37b44d4d

cy.url() and/or cy.location('href') does not return a string

柔情痞子 提交于 2020-04-15 06:47:10
问题 I have an editor page. When I add any content and click the "Save" button my URL will change, adding a random id in the URL. I want to check if my ID's are changing every time when I click the "Save button". I save the URL result in variable and want to check it, I do it like this: const currentURL = cy.url(); cy.get('.editor-toolbar-actions-save').click(); cy.url().should('not.eq', currentURL); But my currentURL variable's type is not string: expected http://localhost:8080/editor/37b44d4d

Cypress: set attribute value

倾然丶 夕夏残阳落幕 提交于 2020-04-12 08:34:11
问题 I have just started exploring Cypress and came across such a problem: is it possible to select a concrete attribute and change its value like in Selenium with the help of JavascriptExecutor ? For example lets take this simple piece of code input id="mapsearch" type="textbox" class="form-control" name="address" test="" Is it possible to get the test attribute and assign my own value? 回答1: Yes. Anything you can do in JavaScript is possible within Cypress tests. For the html above, you could do

Cypress: set attribute value

被刻印的时光 ゝ 提交于 2020-04-12 08:34:07
问题 I have just started exploring Cypress and came across such a problem: is it possible to select a concrete attribute and change its value like in Selenium with the help of JavascriptExecutor ? For example lets take this simple piece of code input id="mapsearch" type="textbox" class="form-control" name="address" test="" Is it possible to get the test attribute and assign my own value? 回答1: Yes. Anything you can do in JavaScript is possible within Cypress tests. For the html above, you could do

Executing a task after all test are launch cypress

冷暖自知 提交于 2020-04-11 04:30:28
问题 I need to execute some code after all tests run. I add this test on after hook. But this task needs the report to be created, but on after hook, the report is not created yet. I also tried to use on('run:end', () => { console.log("gdfgfdsafkañjsdfjñaldfkjsñkasfdñlassfjdskafmjassd"); }); but it does nothing. 回答1: You can't, there is an open issue for that. At the moment you can only leverage a package.json post hook. So, if you have a dedicated command in your package.json file "scripts": {

Executing a task after all test are launch cypress

前提是你 提交于 2020-04-11 04:29:03
问题 I need to execute some code after all tests run. I add this test on after hook. But this task needs the report to be created, but on after hook, the report is not created yet. I also tried to use on('run:end', () => { console.log("gdfgfdsafkañjsdfjñaldfkjsñkasfdñlassfjdskafmjassd"); }); but it does nothing. 回答1: You can't, there is an open issue for that. At the moment you can only leverage a package.json post hook. So, if you have a dedicated command in your package.json file "scripts": {

Setting the browser language in Cypress

懵懂的女人 提交于 2020-04-10 10:13:28
问题 Is it possible to tell Cypress to launch Chrome with a certain language (e.g. German) as I have an application which I need to test in multiple languages. I can't see this detailed anywhere in the documentation which suggests it is not possible at present. I have tried adding the --lang argument when Chrome is launched but this does not seem to have any effect and Chrome still uses English. See the pluginsFile code below. module.exports = (on, config) => { on('before:browser:launch', (browser

《痞子衡嵌入式半月刊》 第 5 期

十年热恋 提交于 2020-04-06 06:04:24
痞子衡嵌入式半月刊: 第 5 期 这里分享嵌入式领域有用有趣的项目/工具以及一些热点新闻,农历年分二十四节气,希望在每个交节之日准时发布一期。 本期刊是开源项目(GitHub: JayHeng/pzh-mcu-bi-weekly ),欢迎提交 issue,投稿或推荐你知道的嵌入式那些事儿。 上期回顾 : 《痞子衡嵌入式半月刊: 第 4 期》 唠两句 今天是清明,也是全国哀悼日,为抗击新冠肺炎疫情斗争牺牲的烈士和逝世同胞表示深切哀悼! 本期共收录 2条资讯、3个项目、2个工具、1个RT产品,希望对你有帮助! 资讯类 1、美敦力公开 PB560 呼吸机完整设计 随着新冠疫情在全球持续扩散,上周以来,全世界都出现了呼吸机抢购大战。近日,美国的医疗器械龙头企业美敦力响应 FDA 的号召,宣布公开分享其旗下 Puritan Bennett 560(PB 560)呼吸机的设计规范,帮助行业参与者快速评估呼吸机制造方案,应对全球内的新冠肺炎疫情。 资料主页:Medtronic.com/openventilator 美敦力开源了 PB560 的所有的资料,包括源代码,原理图、PCB、BOM 清单、3D CAD 图等,呼吸机主控使用的是意法半导体 ST10F276。 2、赛普拉斯推出第六代 USB-C 控制器 ACG1F 不久前,赛普拉斯半导体推出了第六代 USB-C 控制器 ACG1F。ACG1F

《痞子衡嵌入式半月刊》 第 5 期

时光总嘲笑我的痴心妄想 提交于 2020-04-05 17:42:07
痞子衡嵌入式半月刊: 第 5 期 这里分享嵌入式领域有用有趣的项目/工具以及一些热点新闻,农历年分二十四节气,希望在每个交节之日准时发布一期。 本期刊是开源项目(GitHub: JayHeng/pzh-mcu-bi-weekly ),欢迎提交 issue,投稿或推荐你知道的嵌入式那些事儿。 上期回顾 : 《痞子衡嵌入式半月刊: 第 4 期》 唠两句 今天是清明,也是全国哀悼日,为抗击新冠肺炎疫情斗争牺牲的烈士和逝世同胞表示深切哀悼! 本期共收录 2条资讯、3个项目、2个工具、1个RT产品,希望对你有帮助! 资讯类 1、美敦力公开 PB560 呼吸机完整设计 随着新冠疫情在全球持续扩散,上周以来,全世界都出现了呼吸机抢购大战。近日,美国的医疗器械龙头企业美敦力响应 FDA 的号召,宣布公开分享其旗下 Puritan Bennett 560(PB 560)呼吸机的设计规范,帮助行业参与者快速评估呼吸机制造方案,应对全球内的新冠肺炎疫情。 资料主页:Medtronic.com/openventilator 美敦力开源了 PB560 的所有的资料,包括源代码,原理图、PCB、BOM 清单、3D CAD 图等,呼吸机主控使用的是意法半导体 ST10F276。 2、赛普拉斯推出第六代 USB-C 控制器 ACG1F 不久前,赛普拉斯半导体推出了第六代 USB-C 控制器 ACG1F。ACG1F

How to test single page application with Cypress and Auth0

老子叫甜甜 提交于 2020-03-25 18:59:41
问题 I am having a single page application hidden behind Auth0 lock, using @auth0/auth0-spa-js. I would like to test it using Cypress, so I have decided to follow the official Auth0 blog post, as well as Johnny Reilly blog post. I am able to successfully retrieve valid JWT token from auth0 using suggested request. I have no idea what to do with it :( The trouble I am facing is that both of the above approaches are relying on the app to store the JWT token locally (either in cookie or localstorage)