示例#1
0
        public async Task JoinRetrospectivePage_KnownRetrospective_JoinAsFacilitatorUpdatesParticipantListInRealtime()
        {
            // Given
            string retroId = await this.CreateRetrospective("scrummaster", "secret");

            string myName = Name.Create();

            this.Page.Navigate(this.App, retroId);

            var secondInstance = this.App.CreatePageObject <JoinRetrospectivePage>().RegisterAsTestDisposable();

            secondInstance.Navigate(this.App, retroId);

            // When
            this.Page.NameInput.SendKeys(myName);
            new SelectElement(this.Page.ColorSelect).SelectByIndex(2);
            this.Page.IsFacilitatorCheckbox.Click();
            this.Page.WebDriver.Retry(_ => {
                this.Page.FacilitatorPassphraseInput.SendKeys("scrummaster");
                return(true);
            });
            this.Page.Submit();

            Thread.Sleep(500);

            using IServiceScope scope = this.App.CreateTestServiceScope();
            scope.SetNoAuthenticationInfo();
            ParticipantsInfoList participants = await scope.Send(new GetParticipantsInfoQuery(retroId));

            ParticipantInfo facilitator = participants.Participants.First(x => x.Name == myName);

            // Then
            Assert.That(() => secondInstance.OnlineList.OnlineListItems.Select(x => x.Text), Has.One.Contains(myName));
            Assert.That(() => secondInstance.OnlineList.GetListItem(facilitator.Id).FindElements(By.ClassName("fa-crown")), Is.Not.Empty.Retry());
        }
示例#2
0
        public async Task JoinRetrospectivePage_KnownRetrospective_JoinParticipantUpdatesColorListInRealtime()
        {
            // Given
            string retroId = await this.CreateRetrospective("scrummaster", "secret");

            string myName = Name.Create();

            this.Page.Navigate(this.App, retroId);

            JoinRetrospectivePage secondInstance = this.App.CreatePageObject <JoinRetrospectivePage>().RegisterAsTestDisposable();

            secondInstance.Navigate(this.App, retroId);

            IList <AvailableParticipantColorModel> availableColors;
            {
                using IServiceScope scope = this.App.CreateTestServiceScope();
                scope.SetNoAuthenticationInfo();
                availableColors = await scope.Send(new GetAvailablePredefinedParticipantColorsQuery(retroId));
            }
            AvailableParticipantColorModel colorToSelect = availableColors[TestContext.CurrentContext.Random.Next(0, availableColors.Count)];

            // When
            var selectList = new SelectElement(this.Page.ColorSelect);

            Assert.That(() => selectList.Options.Select(x => x.GetProperty("value")).Where(x => !String.IsNullOrEmpty(x)), Is.EquivalentTo(availableColors.Select(x => "#" + x.HexString)).Retry(),
                        "Cannot find all available colors in the selection list");
            selectList.SelectByValue("#" + colorToSelect.HexString);

            this.Page.NameInput.SendKeys(myName);
            this.Page.ParticipantPassphraseInput.SendKeys("secret");
            this.Page.Submit();

            // Then
            Assert.That(() => new SelectElement(secondInstance.ColorSelect).Options.Select(x => x.GetAttribute("value")), Does.Not.Contains("#" + colorToSelect.HexString).And.Not.EquivalentTo(availableColors.Select(x => "#" + x.HexString)).Retry());
        }
示例#3
0
        public static async Task <string> CreateRetrospective(this IServiceScope scope, string facilitatorPassphrase)
        {
            scope.SetNoAuthenticationInfo();

            var command = new CreateRetrospectiveCommand {
                Title = TestContext.CurrentContext.Test.FullName,
                FacilitatorPassphrase = facilitatorPassphrase
            };

            CreateRetrospectiveCommandResponse result = await scope.Send(command);

            return(result.Identifier.StringId);
        }
        public static async Task <string> CreatePokerSession(this IServiceScope scope, string facilitatorPassphrase)
        {
            scope.SetNoAuthenticationInfo();

            var command = new CreatePokerSessionCommand {
                Title = TestContext.CurrentContext.Test.FullName,
                FacilitatorPassphrase = facilitatorPassphrase,
                SymbolSetId           = (await scope.ServiceProvider.GetRequiredService <IPokerTimeDbContext>().SymbolSets.FirstAsync()).Id
            };

            CreatePokerSessionCommandResponse result = await scope.Send(command);

            return(result.Identifier.StringId);
        }
        public void InitializeBaseData()
        {
            // Create a scope to obtain a reference to the database
            using IServiceScope scope = this.Services.CreateScope();

            IServiceProvider scopedServices = scope.ServiceProvider;
            var context = scopedServices.GetRequiredService <PokerTimeDbContext>();
            var logger  = scopedServices.
                          GetRequiredService <ILogger <CustomWebApplicationFactory <TStartup> > >();

            // Ensure the database is created.
            context.Database.EnsureCreated();

            // ... Base seeding
            try {
                scope.SetNoAuthenticationInfo();

                scope.Send(new SeedBaseDataCommand()).ConfigureAwait(false).GetAwaiter().GetResult();
            }
            catch (Exception ex) {
                logger.LogError(ex, "An error occurred while migrating or initializing the database.");
            }
        }