Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 测试-访问Cypress中的种子数据_Ruby On Rails_Cypress_E2e Testing_Seeding - Fatal编程技术网

Ruby on rails 测试-访问Cypress中的种子数据

Ruby on rails 测试-访问Cypress中的种子数据,ruby-on-rails,cypress,e2e-testing,seeding,Ruby On Rails,Cypress,E2e Testing,Seeding,我想在测试期间访问种子数据库 我的设置: 我的测试种子包括: FactoryBot.创建列表(:用户,10) 我的用户工厂看起来像: factory:user{email{Faker::Internet.unique.email} (因此我无法事先知道他们的电子邮件地址) 我的目标 在我的测试中,有一点我很想做如下事情: cy.get('body')) .should('contain',`${user.last.email}`) 有没有办法在Cypress测试中实现这一结果?演示了如何通

我想在测试期间访问种子数据库

我的设置: 我的测试种子包括:

FactoryBot.创建列表(:用户,10)
我的用户工厂看起来像:

factory:user{email{Faker::Internet.unique.email}
(因此我无法事先知道他们的电子邮件地址)

我的目标 在我的测试中,有一点我很想做如下事情:

cy.get('body'))
.should('contain',`${user.last.email}`)
有没有办法在Cypress测试中实现这一结果?

演示了如何通过以语言和框架无关的方式实现的远程命令访问种子数据

它是使用一个Cypress命令完成的,该命令调用一个

这些任务向正在执行的发出API请求

此技术可用于从远程或本地实例访问种子数据,并可用于驱动测试,如中所示