2017-12-27 248 views
0

我工作的項目要求我重新編輯產品選擇過程,刪除產品並重新開始。據我的猜測,這可能會重複數百次。量角器中的迭代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.) 

規格2將被重複在洗澡的類別下一個浴等浴場通過,洗臉盆,淋浴間,廁所......地段! 。

是否有可能基於存儲在框架中的單獨數據文件創建一個變量負載,並在'spec2'中調用變量?有沒有一種方法可以實現這一點?

+0

對於這個數據文件,是你打算讓每個'variable'商店產品配置?然後將文件中的數據讀入列表並使用列表來配置產品/房間? – tehbeardedone

+0

每個產品都在外部電子表格中列出。該列表以指向產品數據庫中的位置的URL的形式存在 - 這裏是一個例子'Image of Cooke & Lewis Strand Corner Bath' –

回答

0

您可以使用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 
} 
相關問題