![]() Private readonly Dictionary detailsPages Then you will need a dictionary in your step definition class, and of course the step definition: stuff specific to the company details page Public class CompanyDetailsPage : IReadOnlyPageModel ![]() stuff specific to the stock details page Then implement this interface in your page models: public class StockDetailsPage : IReadOnlyPageModel You will need each of your page objects to implement the same interface, so you can store them in a dictionary and call the GetText method on them in the step definition: public interface IReadOnlyPageModel Then I should see the following details on the "Company Details" page: Then I should see the following details on the "Stock" page: You can parameterize the name of the page and keep a dictionary of page objects. Which has stock list fields etc.for 50 different pages Public void PopulatedWithStockFromTheDatabase()Īssert.That((entry.Key), Is.EqualTo(entry.Value)) Which has fields like address line1, address line 2 etc.Īnd the Stock Page feature which has step def: expect all fields on the screen populated with Stock from the Database")] ![]() Public void PopulatedWithAddressDetailsFromTheDatabase()Īssert.That((entry.Key), Is.EqualTo(entry.Value)) To clarify each page is different so in addition to above step defs, for the Address page feature i have a step def: expect all fields on the screen populated with AddressDetails from the Database")] The problem is i will need to do this on another 50+ pages, CustomerPage, CompanyDetailsPage, StockPage, DeliveryPage etc.Īny advice on how i could structure this so i have more commonality in the step defs? - there must be a better way, i'm just duplicating code but struggling to visualise a solution from an architectural perspective.Īctions common to many pages should be encapsulated as the own page models and Page models can be composed of multiple page models - how can this be achieved? Its been recommended that i dont share step definitions like this as they are using different page objects which i agree with. Public void PopulatedWithCompanyDetailsFromTheDatabase()Īssert.That((entry.Key), Is.EqualTo(entry.Value)) īoth use the relevant page object class to get the text from the page and assert its correct. In the company step definition file: expect all fields on the screen populated with Company Details from the Database")] Public void PopulatedWithCustomerDetailsFromTheDatabase ()Īssert.That((entry.Key), Is.EqualTo(entry.Value)) I have a number of feature files which need to assert the pre-populated data on the webpage - each feature file has its own step definition fileĮ.g in customer feature step def file: expect all fields on the screen populated with Customer Details from the Database")]
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |