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