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