コード例 #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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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.");
            }
        }
コード例 #6
0
        public async Task RetrospectiveLobby_GroupingStage_CanMoveNote()
        {
            // Given
            int note1Id = 0, note2Id = 0, noteGroupId = 0, bossId = 0;

            using (IServiceScope scope = this.App.CreateTestServiceScope()) {
                await scope.TestCaseBuilder(this.RetroId).
                WithParticipant("Boss", true, "scrummaster").
                OutputId(id => bossId = id).
                WithParticipant("Josh", false).
                WithParticipant("Foo", false).
                WithParticipant("Bar", false).
                WithParticipant("Baz", false).
                WithRetrospectiveStage(RetrospectiveStage.Writing).
                WithNote(KnownNoteLane.Start, "Josh").
                OutputId(id => note1Id = id).
                WithNote(KnownNoteLane.Continue, "Boss").
                WithNote(KnownNoteLane.Continue, "Bar").
                WithNote(KnownNoteLane.Continue, "Baz").
                WithNote(KnownNoteLane.Stop, "Foo").
                WithNote(KnownNoteLane.Start, "Foo").
                OutputId(id => note2Id = id).
                WithNote(KnownNoteLane.Start, "Boss").
                WithRetrospectiveStage(RetrospectiveStage.Grouping).
                WithNoteGroup("Boss", KnownNoteLane.Continue, "Cont name").
                WithNoteGroup("Boss", KnownNoteLane.Start, "Some name").
                OutputId(id => noteGroupId = id).
                Build();
            }

            await Task.WhenAll(
                Task.Run(() => this.Join(this.Client1, true, "Boss", alreadyJoined: true)),
                Task.Run(() => this.Join(this.Client2, false, "Josh", true))
                );

            this.WaitNavigatedToLobby();

            // When

            /*{
             *  NoteLaneComponent noteLane = this.Client1.GetLane(KnownNoteLane.Start);
             *  NoteComponent note1 = noteLane.Notes.First(x => x.Id == note1Id);
             *  NoteComponent note2 = noteLane.Notes.First(x => x.Id == note2Id);
             *  NoteGroupComponent noteGroup = noteLane.NoteGroups.First(x => x.Id == noteGroupId);
             *
             *  this.Client1.WebDriver.ExecuteDragAndDrop(note1.WebElement, noteGroup.WebElement);
             *  this.Client1.WebDriver.ExecuteDragAndDrop(note2.WebElement, noteGroup.WebElement);
             * }*/// Disable while: https://bugs.chromium.org/p/chromedriver/issues/detail?id=2695

            using (IServiceScope scope = this.App.CreateTestServiceScope()) {
                scope.SetAuthenticationInfo(new CurrentParticipantModel(bossId, "Boss", true));
                await scope.Send(new MoveNoteCommand(note1Id, noteGroupId));

                await scope.Send(new MoveNoteCommand(note2Id, noteGroupId));
            }

            // Then
            this.MultiAssert(client => {
                NoteLaneComponent noteLane   = client.GetLane(KnownNoteLane.Start);
                NoteGroupComponent noteGroup = noteLane.NoteGroups.First(x => x.Id == noteGroupId);

                Assert.That(() => noteGroup.Notes.Select(x => x.Id).ToArray(), Contains.Item(note1Id).And.Contain(note2Id).Retry());
            });
        }