Example #1
0
        public void VerifyFields(Table table)
        {
            Genericpage.GetCBILSTextfieldByCss("Name").WaitUntilElementIsDisplayed();
            var fields = table.CreateInstance <CBILSBusinessLookUp>();

            Genericpage.GetCBILSTextfieldByCss("Name").GetText().ShouldEqual(fields.RelationshipName);
            Genericpage.GetCBILSTextfieldByCss("BillingStreet").GetText().ShouldEqual(fields.BillingStreet);
            Genericpage.GetCBILSTextfieldByCss("BillingCity").GetText().ShouldEqual(fields.BillingCity);
            Genericpage.GetCBILSTextfieldByCss("BillingPostalCode").GetText().ShouldEqual(fields.PostalCode);
        }
Example #2
0
 /// <summary>
 /// Fills the form.
 /// </summary>
 /// <param name="table">The table.</param>
 /// <param name="fieldName">Name of the field.</param>
 /// <param name="valueName">Name of the value.</param>
 internal void FillForm(TechTalk.SpecFlow.Table table, string fieldName, string valueName)
 {
     if (table.Rows == null || (table.Rows != null && table.Rows.Count == 0))
     {
         throw new SpecFlowSeleniumException("Table row shouldn't be null or empty");
     }
     foreach (var row in table.Rows)
     {
         GetElement(row[fieldName]).SendKeys(row[valueName]);
     }
 }
Example #3
0
        public SelfRegistrationPage EnterUserDetails(Table table)
        {
            var user = table.CreateInstance <User>();

            GenericPage.GetTextFieldByxPath("firstName").WaitUntilElementIsDisplayed();
            GenericPage.GetTextFieldByxPath("firstName").IsDisplayed().ShouldBeTrue("Firstname field is not displayed");
            GenericPage.GetTextFieldByxPath("firstName").EnterText(user.FirstName);
            GenericPage.GetTextFieldByxPath("lastName").EnterText(user.LastName);
            GenericPage.GetTextFieldByxPath("email").EnterText(user.Email);
            GenericPage.GetTextFieldByxPath("mobile").EnterText(user.Mobile);
            return(new SelfRegistrationPage());
        }
Example #4
0
        public SelfRegistrationPage VerifyFields(Table table)
        {
            EntityNameField.WaitUntilElementVisible();
            var fields = table.CreateInstance <ABRSearch>();

            EntityNameField.Text.ShouldEqual(fields.EntityName);
            ABNField.Text.ShouldEqual(fields.ABN);
            EntityTypeField.Text.ShouldEqual(fields.EntityType);
            ASICField.Text.ShouldEqual(fields.ASICRegistration);
            BusinessState.Text.ShouldEqual(fields.BusinessLocationState);
            BusinessPostCode.Text.ShouldEqual(fields.BusinessPostcode);
            return(new SelfRegistrationPage());
        }
Example #5
0
        public static IDictionary<string, object> ToDictionary(this TechTalk.SpecFlow.Table data)
        {
            var result = new Dictionary<string, object>();

            if (
                    data.Header.Count == 2 &&
             					_acceptedHeaderFields.Any(a => a.Equals(data.Header.ElementAt(0), StringComparison.InvariantCultureIgnoreCase)) &&
                    data.Header.ElementAt(1).Equals("Value", StringComparison.InvariantCultureIgnoreCase))
            {
                var propertyHeader = data.Header.ElementAt(0);
                var valueHeader = data.Header.ElementAt(1);

                foreach (var row in data.Rows)
                {
                    var p = row[propertyHeader];
                    var v = TypeFactory.FromString(row[valueHeader]);

                    result[p] = v;
                }
            }
            else if (data.Rows.Count > 1)
            {
                int i = 0;
                var keys = data.Header.Select(h => h).ToArray();
                foreach (var row in data.Rows)
                {
                    var table = new TechTalk.SpecFlow.Table(keys);
                    table.AddRow(row);

                    result.Add(i.ToString(CultureInfo.InvariantCulture), table.ToDictionary());
                    i++;
                }
            }
            else
            {
                var keys = data.Header.Select(h => h);
                var values = data.Rows[0];

                foreach (var key in keys)
                {
                    result[key] = TypeFactory.FromString(values[key]);
                }
            }

            return result;
        }
        public static DataTable ToDataTable(this TechTalk.SpecFlow.Table table)
        {
            DataTable resultTable = new DataTable();

            foreach (var col in table.Header)
            {
                resultTable.Columns.Add(col, typeof(string));
            }

            foreach (var row in table.Rows)
            {
                var resRow = resultTable.NewRow();
                for (int i = 0; i < row.Count; i++)
                {
                    resRow[i] = row[i];
                }
                resultTable.Rows.Add(resRow);
            }

            return(resultTable);
        }