コード例 #1
0
        public void UserHaveNickAndPasswordThenClickHostButtonThenClickAbortRoomButton_UserCanSeeRoomIdAndNickAndPasswordThenRoomIsAborted()
        {
            using (var driver = _getNewInstanceOfRequiredDriver())
            {
                LogIn(driver);

                var lobbyPage = new LobbyPage(driver);
                lobbyPage.Navigate();

                lobbyPage.PlayerNickInput.SendKeys("nick");
                lobbyPage.PasswordInput.SendKeys("password");
                lobbyPage.HostButton.Click();

                _waitForElement(driver, By.ClassName(LobbyPage.modalContentClassName));

                Assert.Greater(lobbyPage.ModalHostedRoomId.Text.Length, 0);
                Assert.AreEqual("nick", lobbyPage.ModalHostNick.Text);
                Assert.AreEqual("password", lobbyPage.ModalHostedRoomPassword.Text);

                lobbyPage.ModalAbortButton.Click();

                _waitForElement(driver, By.ClassName("logout"));
                LogOut(driver);
            }
        }
コード例 #2
0
        public LobbyPageViewModel(LobbyPage page)
        {
            _page = page;
            _page.DisplayPlayers();

            DisplayGameCreationDialogCommand = new RelayCommand <object>((o) => DisplayGameCreationDialog(), (o) => true);
            JoinLobbyCommand = new RelayCommand <object>(async(o) => await JoinLobby(), (o) => true);

            Messenger.Default.Register(this, delegate(string msg)
            {
                if (!msg.StartsWith(nameof(GameGridElementViewModel.IsSelectedGame)))
                {
                    return;
                }

                foreach (GameGridElement g in Lobbies.Where(g => msg.EndsWith(((GameGridElementViewModel)g.DataContext).WaitingRoom.Channel.id)))
                {
                    foreach (GameGridElement gg in Lobbies)
                    {
                        ((GameGridElementViewModel)gg.DataContext).UnSelectGame();
                    }

                    IsGameSelected = true;
                    _currentSelectedWaitingRoom = ((GameGridElementViewModel)g.DataContext).WaitingRoom;
                }
            });
        }
コード例 #3
0
        /// <summary>
        ///  Should redirect multiplayerGame.
        ///  We dont want navigate using MultiplayerGamePagen
        ///  because game itself cannot create valid match
        /// </summary>
        private void _startGameUsingLobby(
            RemoteWebDriver hostDriver,
            RemoteWebDriver guestDriver,
            out LobbyPage hostLobbyPage,
            out LobbyPage guestLobbyPage,
            out MultiplayerGamePage hostGamePage,
            out MultiplayerGamePage guestGamePage)
        {
            LogIn(hostDriver);
            LogIn(guestDriver);
            hostLobbyPage  = new LobbyPage(hostDriver);
            guestLobbyPage = new LobbyPage(guestDriver);
            hostLobbyPage.Navigate();
            guestLobbyPage.Navigate();

            hostLobbyPage.HostButton.Click();
            _waitForElement(hostDriver, By.ClassName(LobbyPage.modalContentClassName));

            guestLobbyPage.RefreshButton.Click();
            _waitForElement(guestDriver, By.CssSelector(LobbyPage.firstRoomInLobbySelector));
            guestLobbyPage.FirstRoom.Click();

            hostGamePage  = new MultiplayerGamePage(hostDriver);
            guestGamePage = new MultiplayerGamePage(guestDriver);

            _waitUntilUserIsRedirected("multiplayerGame", hostDriver);
            _waitUntilUserIsRedirected("multiplayerGame", guestDriver);
        }
コード例 #4
0
 private void _logoutBothPlayers(LobbyPage hostLobbyPage, LobbyPage guestLobbyPage)
 {
     hostLobbyPage.Navigate();
     LogOut(hostLobbyPage.Driver);
     guestLobbyPage.Navigate();
     LogOut(guestLobbyPage.Driver);
 }
コード例 #5
0
 private void _loginBothPlayersAndNavigateThemToLobby(RemoteWebDriver hostDriver, RemoteWebDriver guestDriver, out LobbyPage hostLobbyPage, out LobbyPage guestLobbyPage)
 {
     LogIn(hostDriver);
     LogIn(guestDriver);
     hostLobbyPage = new LobbyPage(hostDriver);
     hostLobbyPage.Navigate();
     guestLobbyPage = new LobbyPage(guestDriver);
     guestLobbyPage.Navigate();
 }
コード例 #6
0
        private void _startGameUsingLobby(RemoteWebDriver hostDriver, RemoteWebDriver guestDriver, out LobbyPage hostLobbyPage, out LobbyPage guestLobbyPage)
        {
            hostLobbyPage  = new LobbyPage(hostDriver);
            guestLobbyPage = new LobbyPage(guestDriver);
            hostLobbyPage.Navigate();
            guestLobbyPage.Navigate();

            hostLobbyPage.HostButton.Click();
            _waitForElement(hostDriver, By.ClassName(LobbyPage.modalContentClassName));

            guestLobbyPage.RefreshButton.Click();
            _waitForElement(guestDriver, By.CssSelector(LobbyPage.firstRoomInLobbySelector));
            guestLobbyPage.FirstRoom.Click();
        }
コード例 #7
0
        public void UserClickMenuButton_UserIsRedirectedToMenu()
        {
            using (var driver = _getNewInstanceOfRequiredDriver())
            {
                LogIn(driver);

                var lobbyPage = new LobbyPage(driver);
                lobbyPage.Navigate();

                lobbyPage.MenuButton.Click();

                _verifyUserIsRedirected("", driver);

                LogOut(driver);
            }
        }
コード例 #8
0
 protected override void OnElementChanged(ElementChangedEventArgs <Page> e)
 {
     base.OnElementChanged(e);
     page = e.NewElement as LobbyPage;
     var activity = this.Context as Activity;
 }
コード例 #9
0
 public LobbyViewModel(bool skipUi = false)
 {
     memberIdList = new ObservableCollection <ChatSessionID>();
     lobbyModel   = new Model.LobbyModel(this);
     lobbyView    = skipUi ? null : new LobbyPage(this);
 }
コード例 #10
0
 private void _logoutBothPlayers(RemoteWebDriver hostDriver, RemoteWebDriver guestDriver, LobbyPage hostLobbyPage, LobbyPage guestLobbyPage)
 {
     hostLobbyPage.Navigate();
     LogOut(hostDriver);
     guestLobbyPage.Navigate();
     LogOut(guestDriver);
 }
コード例 #11
0
 protected override void OnElementChanged(VisualElementChangedEventArgs e)
 {
     base.OnElementChanged(e);
     page = e.NewElement as LobbyPage;
 }
コード例 #12
0
 public override void OnInstance()
 {
     base.OnInstance();
     panel = lobbyPage = LobbyPage.Instance;
 }