| 1 | using NUnit.Framework;
|
|---|
| 2 | using WatiN.Core;
|
|---|
| 3 |
|
|---|
| 4 | namespace adMoto.Payments.Test.UI
|
|---|
| 5 | {
|
|---|
| 6 | [TestFixture]
|
|---|
| 7 | public class MerchantTests
|
|---|
| 8 | {
|
|---|
| 9 | private readonly UIHelper _uidata = new UIHelper();
|
|---|
| 10 |
|
|---|
| 11 | [Test]
|
|---|
| 12 | [Category("UI")]
|
|---|
| 13 | public void Redirects_To_Ecard_When_All_Details_Are_Correct()
|
|---|
| 14 | {
|
|---|
| 15 | //dodanie testowego rekordu do tabel: FAKTURY, FAKTURA_DETAILS
|
|---|
| 16 | var uiData = _uidata.CreateAndAddTestRecordToRepository(2);
|
|---|
| 17 |
|
|---|
| 18 | const string test = "test";
|
|---|
| 19 | uiData.Test_surname = test;
|
|---|
| 20 | uiData.Test_firstname = test;
|
|---|
| 21 |
|
|---|
| 22 | var ie = new IE("http://localhost:3646/pl/Account/LogOn");
|
|---|
| 23 | ie.TextField(Find.ByName("numerFaktury")).TypeText(uiData.Test_numer_faktury);
|
|---|
| 24 | ie.TextField(Find.ByName("nip")).TypeText(uiData.Test_nip);
|
|---|
| 25 | ie.Button(Find.ById("loguj")).Click();
|
|---|
| 26 |
|
|---|
| 27 | ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
|
|---|
| 28 | ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
|
|---|
| 29 | ie.Button(Find.ById("place")).Click();
|
|---|
| 30 | Assert.IsTrue(ie.ContainsText("Imię i nazwisko:" + test + " " + test));
|
|---|
| 31 | Assert.IsTrue(ie.Url.Contains("https://pay.ecard.pl/"));
|
|---|
| 32 | ie.ForceClose();
|
|---|
| 33 | ie.Close();
|
|---|
| 34 | ie.Dispose();
|
|---|
| 35 |
|
|---|
| 36 | //usuniecie rekordu z tabel: FAKTURY, FAKTURA_DETAILS
|
|---|
| 37 | _uidata.DeleteTestRecordsFromRepository(uiData);
|
|---|
| 38 |
|
|---|
| 39 | //usuniecie rekordu z tabeli PatnosciEcard
|
|---|
| 40 | _uidata.DeleteTestPaymentFromRepository(uiData);
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | [Test]
|
|---|
| 44 | [Category("UI")]
|
|---|
| 45 | public void Returns_ZlyHash_When_Invoice_Amount_Is_Zero()
|
|---|
| 46 | {
|
|---|
| 47 | // wartosc testowej faktury 1/SLJ/1 jest 0 (zero)
|
|---|
| 48 | // wowczas eCard powinien zwrocic zlyHash - stala informujaca, ze cos jest nie tak...
|
|---|
| 49 | var uiData = _uidata.CreateAndAddTestRecordToRepository(0);
|
|---|
| 50 |
|
|---|
| 51 | const string test = "test";
|
|---|
| 52 | uiData.Test_surname = test;
|
|---|
| 53 | uiData.Test_firstname = test;
|
|---|
| 54 |
|
|---|
| 55 | var ie = new IE("http://localhost:3646/pl/Account/LogOn");
|
|---|
| 56 | ie.TextField(Find.ByName("numerFaktury")).TypeText(uiData.Test_numer_faktury);
|
|---|
| 57 | ie.TextField(Find.ByName("nip")).TypeText(uiData.Test_nip);
|
|---|
| 58 | ie.Button(Find.ById("loguj")).Click();
|
|---|
| 59 |
|
|---|
| 60 | ie.TextField(Find.ByName("Payer.FirstName")).TypeText(test);
|
|---|
| 61 | ie.TextField(Find.ByName("Payer.LastName")).TypeText(test);
|
|---|
| 62 | ie.Button(Find.ById("place")).Click();
|
|---|
| 63 | Assert.IsTrue(ie.ContainsText("Wystąpił nieoczekiwany błąd"));
|
|---|
| 64 | ie.ForceClose();
|
|---|
| 65 | ie.Close();
|
|---|
| 66 | ie.Dispose();
|
|---|
| 67 |
|
|---|
| 68 | //usuniecie rekordu z tabel: FAKTURY, FAKTURA_DETAILS
|
|---|
| 69 | _uidata.DeleteTestRecordsFromRepository(uiData);
|
|---|
| 70 | }
|
|---|
| 71 | }
|
|---|
| 72 | } |
|---|