public static Employer Create(EmployerActor actorType)
        {
            Console.WriteLine($"Creating Employer: {actorType}");

            switch (actorType)
            {
            case EmployerActor.NonLevyEmployer:
                return(new Employer
                {
                    AccountId = 30060,
                    AccountLegalEntityId = 645,
                    Username = "******",
                    IsLevyPayer = false,
                    TransferSenderId = "7YRV9B"
                });

            case EmployerActor.LevyEmployer:
                return(new Employer
                {
                    AccountId = 8194,
                    AccountLegalEntityId = 2818,
                    Username = "******",
                    IsLevyPayer = true,
                    TransferSenderId = "",
                    HasMultipleLegalEntities = true
                });

            default:
                throw new ArgumentException();
            }
        }
        public async Task CreateCohortWithProvider(EmployerActor employerActor)
        {
            var employer = Actors.Employer.Create(employerActor);

            //Start on UseReservations
            var useReservationPage = new UseReservationPage(Page);
            await useReservationPage.GoToPage(employer.EncodedAccountId);

            var startPage = await useReservationPage.ClickContinue <AddApprenticeStartPage>();

            //Start page
            var selectProviderPage = await startPage.ClickContinue <SelectProviderPage>();

            //select/add provider
            await selectProviderPage.EnterProviderId(DefaultProvider.ProviderId.ToString());

            var confirmProvider = await selectProviderPage.ClickContinue <ConfirmProviderPage>();

            //confirm provider
            await confirmProvider.SelectConfirmationOption();

            var assign = await confirmProvider.ClickContinue();

            //Assign
            await assign.SelectProviderWillAddApprentices();

            var message = await assign.ClickContinue <MessagePage>();

            //Apprentice
            await message.EnterMessage("Hey there!");

            await message.ClickSend();

            //Assertions
        }
예제 #3
0
        public async Task CreateCohortWithProvider(EmployerActor employerActor, bool withTransferSender)
        {
            var employer = Actors.Employer.Create(employerActor);

            //Journey begins in v1, but jumps to v2 select provider page, so let's start here
            var selectProviderPage = new SelectProviderPage(Page);
            await selectProviderPage.GoToPage(employer.EncodedAccountId, employer.EncodedAccountLegalEntityId,
                                              withTransferSender?employer.TransferSenderId : "");

            //select/add provider
            await selectProviderPage.EnterProviderId(DefaultProvider.ProviderId.ToString());

            var confirmProvider = await selectProviderPage.ClickContinue <ConfirmProviderPage>();

            //confirm provider
            await confirmProvider.SelectConfirmationOption();

            var assign = await confirmProvider.ClickContinue();

            //Assign
            await assign.SelectProviderWillAddApprentices();

            var message = await assign.ClickContinue <MessagePage>();

            //Apprentice
            await message.EnterMessage("Hey there!");

            await message.ClickSend();

            //Assertions
        }
예제 #4
0
        public static Employer Create(EmployerActor actorType)
        {
            Console.WriteLine($"Creating Employer: {actorType}");

            switch (actorType)
            {
            case EmployerActor.NonLevyEmployer:
                return(new Employer
                {
                    AccountId = 30060,
                    AccountLegalEntityId = 645,
                    Username = "******",
                    Password = "******",
                    IsLevyPayer = false,
                    TransferSenderId = "7YRV9B"
                });

            case EmployerActor.LevyEmployer:
                return(new Employer
                {
                    AccountId = 8194,
                    AccountLegalEntityId = 2818,
                    Username = "******",
                    Password = "******",
                    IsLevyPayer = true,
                    TransferSenderId = ""
                });

            default:
                throw new ArgumentException();
            }
        }
        public async Task CreateCohort(EmployerActor employerActor, bool withTransferSender)
        {
            var employer = Actors.Employer.Create(employerActor);

            //Journey begins at legal entity selection page (for all intents and purposes)
            var chooseOrganisationPage = new ChooseOrganisationPage(Page);
            await chooseOrganisationPage.GoToPage(employer.EncodedAccountId);

            SelectProviderPage selectProviderPage;

            if (employer.HasMultipleLegalEntities)
            {
                await chooseOrganisationPage.SelectLegalEntity();

                selectProviderPage = await chooseOrganisationPage.ClickContinue <SelectProviderPage>();
            }
            else
            {
                //if only one legal entity, system will have automatically redirected to select provider page
                selectProviderPage = await chooseOrganisationPage.Redirect <SelectProviderPage>();
            }

            //select/add provider
            await selectProviderPage.EnterProviderId(DefaultProvider.ProviderId.ToString());

            var confirmProvider = await selectProviderPage.ClickContinue <ConfirmProviderPage>();

            //confirm provider
            await confirmProvider.SelectConfirmationOption();

            var assign = await confirmProvider.ClickContinue();

            //Assign
            await assign.SelectIWillAddApprentices();

            ApprenticePage apprentice;

            //Non-levy must select a reservation at this point, unless they have a transfer sender
            if (!employer.IsLevyPayer && !withTransferSender)
            {
                var selectReservation = await assign.ClickContinue <SelectReservationPage>();

                apprentice = await selectReservation.ClickContinue <ApprenticePage>();
            }
            else
            {
                apprentice = await assign.ClickContinue <ApprenticePage>();
            }

            //Apprentice
            await apprentice.EnterFirstName("Chris");

            await apprentice.EnterLastName("Foster");

            await apprentice.ClickContinue <CohortDetailsPage>();


            //Assertions
        }
        public async Task CreateCohortFromHomePage(EmployerActor employerActor)
        {
            ScenarioBuilder.Generator.Generator.Scenario_Cohort_NonLevyEmployer_ReadyForApproval();

            var employer = Actors.Employer.Create(employerActor);

            var landingPage = await LandingPage.Get(Page, employer.EncodedAccountId);
        }
예제 #7
0
        public async Task Draft_Cohorts_With_Provider_Should_Not_Be_Present(EmployerActor employerActor)
        {
            var cohortSize = RandomHelper.GetRandomNumber(9) + 1;

            ScenarioBuilder.Generator.Automation.Generator.Cohort_Provider_Draft(cohortSize, employerActor == EmployerActor.NonLevyEmployer);

            var employer = Actors.Employer.Create(employerActor);

            //get landing page
            var landingPage = await LandingPage.Get(Page, employer.EncodedAccountId);

            var cohorts = await landingPage.ClickYourCohorts <YourCohortsPage>();

            //todo: get count and assert zero (all)
        }
예제 #8
0
        public async Task CreateCohort(EmployerActor employerActor, bool withTransferSender)
        {
            var employer = Actors.Employer.Create(employerActor);

            //Journey begins in v1, but jumps to v2 select provider page, so let's start here
            var selectProviderPage = new SelectProviderPage(Page);
            await selectProviderPage.GoToPage(employer.EncodedAccountId, employer.EncodedAccountLegalEntityId,
                                              withTransferSender?employer.TransferSenderId : "");

            //select/add provider
            await selectProviderPage.EnterProviderId(DefaultProvider.ProviderId.ToString());

            var confirmProvider = await selectProviderPage.ClickContinue <ConfirmProviderPage>();

            //confirm provider
            await confirmProvider.SelectConfirmationOption();

            var assign = await confirmProvider.ClickContinue();

            //Assign
            await assign.SelectIWillAddApprentices();

            ApprenticePage apprentice;

            //Non-levy must select a reservation at this point, unless they have a transfer sender
            if (!employer.IsLevyPayer && !withTransferSender)
            {
                var selectReservation = await assign.ClickContinue <SelectReservationPage>();

                apprentice = await selectReservation.ClickContinue <ApprenticePage>();
            }
            else
            {
                apprentice = await assign.ClickContinue <ApprenticePage>();
            }

            //Apprentice
            await apprentice.EnterFirstName("Chris");

            await apprentice.EnterLastName("Foster");

            await apprentice.ClickContinue <CohortDetailsPage>();


            //Assertions
        }
예제 #9
0
        public async Task Draft_Cohorts(EmployerActor employerActor)
        {
            var cohortSize = RandomHelper.GetRandomNumber(9) + 1;

            ScenarioBuilder.Generator.Automation.Generator.Cohort_Employer_Draft(cohortSize, employerActor == EmployerActor.NonLevyEmployer);

            var employer = Actors.Employer.Create(employerActor);

            //get landing page
            var landingPage = await LandingPage.Get(Page, employer.EncodedAccountId);

            var cohorts = await landingPage.ClickYourCohorts <YourCohortsPage>();

            var draft = await cohorts.ClickDraft <DraftPage>();

            var actualNumberOfApprentices = await draft.GetNumberOfApprentices("JRML7V"); //todo: capture cohort reference from scenario?

            Assert.AreEqual(cohortSize, actualNumberOfApprentices);
        }
        public async Task CreateCohort(EmployerActor employerActor)
        {
            var employer = Actors.Employer.Create(employerActor);

            //Start on UseReservations
            var useReservationPage = new UseReservationPage(Page);
            await useReservationPage.GoToPage(employer.EncodedAccountId);

            var startPage = await useReservationPage.ClickContinue <AddApprenticeStartPage>();

            //Start page
            var selectProviderPage = await startPage.ClickContinue <SelectProviderPage>();

            //select/add provider
            await selectProviderPage.EnterProviderId(DefaultProvider.ProviderId.ToString());

            var confirmProvider = await selectProviderPage.ClickContinue <ConfirmProviderPage>();

            //confirm provider
            await confirmProvider.SelectConfirmationOption();

            var assign = await confirmProvider.ClickContinue();

            //Assign
            await assign.SelectIWillAddApprentices();

            var apprentice = await assign.ClickContinue <ApprenticePage>();

            //Apprentice
            await apprentice.EnterFirstName("Chris");

            await apprentice.EnterLastName("Foster");

            var cohortDetails = await apprentice.ClickContinue <CohortDetailsPage>();

            //Assertions

            await cohortDetails.ClickSendToProvider();

            var sentPage = await cohortDetails.ClickSubmit <SentPage>();
        }
        public async Task GoBack(EmployerActor employerActor)
        {
            var employer = Actors.Employer.Create(employerActor);

            //Start on UseReservations
            var useReservationPage = new UseReservationPage(Page);
            await useReservationPage.GoToPage(employer.EncodedAccountId);

            var startPage = await useReservationPage.ClickContinue <AddApprenticeStartPage>();

            //Start page
            var selectProviderPage = await startPage.ClickContinue <SelectProviderPage>();

            //select/add provider
            await selectProviderPage.EnterProviderId(DefaultProvider.ProviderId.ToString());

            var confirmProvider = await selectProviderPage.ClickContinue <ConfirmProviderPage>();

            //confirm provider
            await confirmProvider.SelectConfirmationOption();

            var assign = await confirmProvider.ClickContinue();

            //Assign
            await assign.SelectIWillAddApprentices();

            var apprentice = await assign.ClickContinue <ApprenticePage>();

            //Now we go back
            var back1 = await apprentice.ClickBack <AssignPage>();

            var back2 = await back1.ClickBack <ConfirmProviderPage>();

            var back3 = await back2.ClickBack <SelectProviderPage>();

            var back4 = await back3.ClickBack <AddApprenticeStartPage>();

            var back5 = await back4.ClickBack <UseReservationPage>();
        }
        public async Task AddDetails(EmployerActor employerActor)
        {
            const int cohortSize = 10;

            var employer = Actors.Employer.Create(employerActor);

            ScenarioBuilder.Generator.Automation.Generator.Cohort_Employer_Draft(cohortSize, !employer.IsLevyPayer);

            var cohortReference = "JRML7V"; //todo : get this, or something

            var page = new CohortDetailsPage(Page);
            await page.GoToPage(employer.EncodedAccountId, cohortReference);

            AddDraftApprenticeshipPage addPage;

            //Non-levy payers (TODO: also transfer receivers!) have to select a reservation too
            if (!employer.IsLevyPayer)
            {
                var selectReservationPage = await page.ClickAddApprentice <SelectReservationPage>();

                addPage = await selectReservationPage.ClickContinue <AddDraftApprenticeshipPage>();
            }
            else
            {
                addPage = await page.ClickAddApprentice <AddDraftApprenticeshipPage>();
            }

            await addPage.EnterFirstName("Jed");

            await addPage.EnterLastName("Springfield");

            var detailsPage = await addPage.ClickContinue <CohortDetailsPage>();

            //todo: this doesn't work for some reason.
            //var actual = detailsPage.GetCohortSize();
            //Assert.AreEqual(cohortSize + 1, actual);

            //todo: make some assertions now
        }