| 1 | using NUnit.Framework;
|
|---|
| 2 | using WatiN.Core;
|
|---|
| 3 |
|
|---|
| 4 | namespace adMoto.Payments.Test.UI
|
|---|
| 5 | {
|
|---|
| 6 | [TestFixture]
|
|---|
| 7 | public class ValidationTests
|
|---|
| 8 | {
|
|---|
| 9 | private readonly UIHelper _uiHelper = new UIHelper();
|
|---|
| 10 | private static string adres = UIHelper.LoginSite;
|
|---|
| 11 |
|
|---|
| 12 | [Test]
|
|---|
| 13 | [Category("UI")]
|
|---|
| 14 | public void Validates_When_Firstname_Is_Too_Long()
|
|---|
| 15 | {
|
|---|
| 16 | var uiData = _uiHelper.CreateAndAddTestRecordToRepository(2);
|
|---|
| 17 |
|
|---|
| 18 | const string test = "test";
|
|---|
| 19 |
|
|---|
| 20 | var ie = new IE(adres);
|
|---|
| 21 | ie.TextField(Find.ByName("numerFaktury")).TypeText(uiData.Test_numer_faktury);
|
|---|
| 22 | ie.TextField(Find.ByName("nip")).TypeText(uiData.Test_nip);
|
|---|
| 23 | ie.Button(Find.ById("loguj")).Click();
|
|---|
| 24 |
|
|---|
| 25 | ie.TextField(Find.ByName("Payer.FirstName")).TypeText("12345678901234567890123456");
|
|---|
| 26 | ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
|
|---|
| 27 | ie.Button(Find.ById("place")).Click();
|
|---|
| 28 | Assert.IsTrue(ie.ContainsText("Zbyt długa nazwa"));
|
|---|
| 29 | _uiHelper.CloseWebBrowser(ie);
|
|---|
| 30 |
|
|---|
| 31 | //usuniecie rekordu z tabel: FAKTURY, FAKTURA_DETAILS
|
|---|
| 32 | _uiHelper.DeleteTestRecordsFromRepository(uiData);
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | [Test]
|
|---|
| 36 | [Category("UI")]
|
|---|
| 37 | public void Validates_When_Surname_Is_Too_Long()
|
|---|
| 38 | {
|
|---|
| 39 | var uiData = _uiHelper.CreateAndAddTestRecordToRepository(2);
|
|---|
| 40 |
|
|---|
| 41 | const string test = "test";
|
|---|
| 42 |
|
|---|
| 43 | var ie = new IE(adres);
|
|---|
| 44 | ie.TextField(Find.ByName("numerFaktury")).TypeText(uiData.Test_numer_faktury);
|
|---|
| 45 | ie.TextField(Find.ByName("nip")).TypeText(uiData.Test_nip);
|
|---|
| 46 | ie.Button(Find.ById("loguj")).Click();
|
|---|
| 47 |
|
|---|
| 48 | ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
|
|---|
| 49 | ie.TextField(Find.ByName("Payer.LastName")).TypeText("1234567890123456789012345678901");
|
|---|
| 50 | ie.Button(Find.ById("place")).Click();
|
|---|
| 51 | Assert.IsTrue(ie.ContainsText("Zbyt długa nazwa"));
|
|---|
| 52 | _uiHelper.CloseWebBrowser(ie);
|
|---|
| 53 |
|
|---|
| 54 | //usuniecie rekordu z tabel: FAKTURY, FAKTURA_DETAILS
|
|---|
| 55 | _uiHelper.DeleteTestRecordsFromRepository(uiData);
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | [Test]
|
|---|
| 59 | [Category("UI")]
|
|---|
| 60 | public void Validates_When_LastName_Is_Empty()
|
|---|
| 61 | {
|
|---|
| 62 | var uiData = _uiHelper.CreateAndAddTestRecordToRepository(2);
|
|---|
| 63 |
|
|---|
| 64 | const string test = "test";
|
|---|
| 65 |
|
|---|
| 66 | var ie = new IE(adres);
|
|---|
| 67 | ie.TextField(Find.ByName("numerFaktury")).TypeText(uiData.Test_numer_faktury);
|
|---|
| 68 | ie.TextField(Find.ByName("nip")).TypeText(uiData.Test_nip);
|
|---|
| 69 | ie.Button(Find.ById("loguj")).Click();
|
|---|
| 70 |
|
|---|
| 71 | ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
|
|---|
| 72 | ie.TextField(Find.ByName("Payer.LastName")).TypeText("");
|
|---|
| 73 | ie.Button(Find.ById("place")).Click();
|
|---|
| 74 | Assert.IsTrue(ie.ContainsText("Proszę podać"));
|
|---|
| 75 | _uiHelper.CloseWebBrowser(ie);
|
|---|
| 76 |
|
|---|
| 77 | //usuniecie rekordu z tabel: FAKTURY, FAKTURA_DETAILS
|
|---|
| 78 | _uiHelper.DeleteTestRecordsFromRepository(uiData);
|
|---|
| 79 | }
|
|---|
| 80 | }
|
|---|
| 81 | } |
|---|