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