量角器的迭代E2E测试



我正在工作的项目要求我重复使用编辑的产品选择过程,删除产品并重新开始。最好的猜测,这可能会重复几百次。

轮廓过程看起来像这样:

1. Spec 1 creates the empty room into which products will be placed.
2. Spec 2 selects the first product category (baths), selects the first 
product in that category - which is placed into the 'empty room'. Next, 
various options are added/removed from the product..for example, taps, 
side-panels etc. Some assertions will take place, then this product 
will be removed (there's a nice simple on button remove.)

Spec 2然后将重复用于浴室类别的下一个浴室,依此类推,依此类推,盆地,淋浴,淋浴,厕所...

是否可以基于存储在框架中的单独数据文件并在'spec2'中调用变量?是否有一种实现这一目标的方式?

您可能可以使用browser.params()为此。您可以将数据存储在量角配置中,也可以使用外部参数文件,然后在配置中导入/需要它。

您可以将产品配置存储在JSON对象中,将该对象读取到列表中,然后在列表上迭代以设置每个对象。

params: {
  productConfigurations: [
    product: {
      category: "baths",
      options: {
        taps: true,
        side-panels: false 
      }
    },
    product: {
      //etc...
    }
  ]  
}

然后在您的测试中,您可以将值分配给数组,然后离开...

const productConfigs = browser.params.productConfigurations;
for(const product in productConfigs) {
  //do your product setup and assertions in here
}

最新更新