Пример #1
0
        public void Can_renew_expired_licensee_contract()
        {
            var licenseeName            = "Licensee-" + TestDataGenerator.GetRandomString(5);
            var companyName             = "Company-" + TestDataGenerator.GetRandomString(5);
            var contractStartDate       = DateTime.UtcNow.AddMonths(-2).ToString("yyyy'/'MM'/'dd");
            var contractEndDate         = DateTime.UtcNow.AddDays(2).ToString("yyyy'/'MM'/'dd");
            var email                   = TestDataGenerator.GetRandomEmail();
            var numberOfAllowedBrands   = TestDataGenerator.GetRandomNumber(10).ToString(CultureInfo.InvariantCulture);
            var numberOfAllowedWebsites = numberOfAllowedBrands;

            // create a licensee
            var newLicenseeForm       = _licenseeManagerPage.OpenNewLicenseeForm();
            var submittedLicenseeForm = newLicenseeForm.Submit(licenseeName, companyName, contractStartDate, contractEndDate, numberOfAllowedBrands, numberOfAllowedWebsites, email);

            submittedLicenseeForm.CloseTab("View Licensee");

            _driver.Logout();
            _dashboardPage = _driver.LoginToAdminWebsiteAsSuperAdmin();
            _dashboardPage.BrandFilter.SelectAll();
            _licenseeManagerPage = _dashboardPage.Menu.ClickLicenseeManagerItem();

            //activate
            var activateDialog          = _licenseeManagerPage.OpenActivateLicenseeDialog(licenseeName);
            var submittedActivateDialog = activateDialog.Activate("test");

            _licenseeManagerPage = submittedActivateDialog.Close();

            //edit end date
            var editLicenseePage = _licenseeManagerPage.OpenEditLicenseeForm(licenseeName);
            var viewLicenseePage = editLicenseePage.Submit(new LicenseeData
            {
                ContractEnd = DateTime.UtcNow.AddDays(-3).ToString("yyyy'/'MM'/'dd"),
                Remarks     = "test"
            });

            viewLicenseePage.CloseTab("View Licensee");

            //renew
            var newContractDate   = DateTime.UtcNow.AddDays(-1).ToString("yyyy'/'MM'/'dd");
            var newContractEnd    = DateTime.UtcNow.AddMonths(11).ToString("yyyy'/'MM'/'dd");
            var renewContractForm = _licenseeManagerPage.OpenRenewContractForm(licenseeName);

            var submittedForm  = renewContractForm.Submit(newContractDate, newContractEnd);
            var contractStatus = submittedForm.GetStatus(newContractDate);

            Assert.AreEqual("The licensee contract has been renewed successfully", submittedForm.ConfirmationMessage);
            Assert.AreEqual("Active", contractStatus);
        }