Skip to content

Commit

Permalink
chore: densed the PlayerAnswerLog and added participants count to lobby
Browse files Browse the repository at this point in the history
  • Loading branch information
stoerti committed Sep 24, 2024
1 parent a48362e commit a7861cb
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions backend/src/main/resources/questions/axoniq_conf_2024.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"id": "axonconf_01",
"type": "CHOICE",
"phrase": "Which EventProcessor can process events in the same UnitOfWork as they are published?",
"correctAnswer": "SubscribingEventProcessor",
"answerOptions": ["PooledStreamingEventProcessor", "TrackingEventProcessor", "SubscribingEventProcessor"]
"correctAnswer": "Subscribing EventProcessor",
"answerOptions": ["PooledStreaming EventProcessor", "Tracking EventProcessor", "Subscribing EventProcessor"]
},
{
"id": "axonconf_02",
Expand Down
2 changes: 1 addition & 1 deletion e2e/codecept.conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const config: CodeceptJS.MainConfig = {
helpers: {
Playwright: {
browser: 'chromium',
url: 'http://localhost:5173',
url: 'http://localhost:8080',
show: true
}
},
Expand Down
4 changes: 2 additions & 2 deletions e2e/pages/lobby.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export function createGame(gameName: string, questionSet: string, moderated: boo

I.fillField({id: "gameName"}, gameName)
I.fillField({id: "maxPlayers"}, 50)
I.fillField({id: "numQuestions"}, 3)
I.fillField({id: "numSecondsToAnswer"}, 5)
I.fillField({id: "numQuestions"}, 5)
I.fillField({id: "numSecondsToAnswer"}, 300)

I.click({id: 'questionSet'})
I.click({xpath: '//ul//li[@data-value="'+questionSet+'"]'})
Expand Down
18 changes: 11 additions & 7 deletions e2e/test/multiplayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ Scenario('multiplayer', ({I, loginPage, lobbyPage, gameRoomPage}) => {

Scenario('multiplayer_moderated', ({I, loginPage, lobbyPage, gameRoomPage}) => {
let gameName = "Game " + Math.floor(Math.random() * 100000)
let moderator = "Moderator " + Math.floor(Math.random() * 100000)
let username1 = "User " + Math.floor(Math.random() * 100000)
let username2 = "User " + Math.floor(Math.random() * 100000)
let username3 = "User " + Math.floor(Math.random() * 100000)
// let moderator = "Moderator " + Math.floor(Math.random() * 100000)
// let username1 = "User " + Math.floor(Math.random() * 100000)
// let username2 = "User " + Math.floor(Math.random() * 100000)
// let username3 = "User " + Math.floor(Math.random() * 100000)
let moderator = "Moderator"
let username1 = "Alice"
let username2 = "Bob"
let username3 = "John Doe"

loginPage.logInWithUsername(moderator)
I.wait(1)

lobbyPage.createGame(gameName, "werkstatt", true)
lobbyPage.createGame(gameName, "axoniq_conf", true)
I.wait(1)

session('player1', () => {
Expand Down Expand Up @@ -131,7 +135,7 @@ Scenario('multiplayer_moderated', ({I, loginPage, lobbyPage, gameRoomPage}) => {

Scenario('many_multiplayer_moderated', ({I, loginPage, lobbyPage, gameRoomPage}) => {
const gameName = "Game " + Math.floor(Math.random() * 100000)
const numPlayers = 50
const numPlayers = 30

const moderator = "Moderator " + Math.floor(Math.random() * 100000)
const players = [...Array(numPlayers)].map((_, index) => { return "User "+index + Math.floor(Math.random() * 100000)})
Expand Down Expand Up @@ -162,7 +166,7 @@ Scenario('many_multiplayer_moderated', ({I, loginPage, lobbyPage, gameRoomPage})

players.forEach((player, index) => {
session('player'+index, () => {
gameRoomPage.answerChoiceQuestion(Math.random() < 0.5 ? "Banone" : "Gürkin")
gameRoomPage.answerChoiceQuestion(Math.random() < 0.5 ? "9" : "7")
})
})

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/game/GameLobby.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ export const GameLobbyPage = (props: GameLobbyPageProps) => {
</List>
{startButton}
<Typography variant="h6" component="div" sx={{pl: 2}}>
Participants
Participants ({props.game.players.length})
</Typography>
<List dense={false}>
<List dense={true}>
{props.game.players.map((row) => (
<ListItem key={row.id}>
<ListItemIcon>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/game/gameroom/PlayerAnswerLog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const PlayerAnswerLog = ({game}: PlayerAnswerLogProps) => {

const lastQuestion = game.currentQuestion!

return <Table aria-label="simple table">
return <Table aria-label="simple table" size={"small"}>
<TableHead>
<TableRow>
<TableCell></TableCell>
Expand All @@ -24,7 +24,7 @@ export const PlayerAnswerLog = ({game}: PlayerAnswerLogProps) => {
if (lastQuestion.hasPlayerAlreadyAnswered(player.id)) {
icon = <MarkEmailRead color='success'/>
} else {
icon = <QuestionMark color='info'/>
icon = <QuestionMark color='error'/>
}
return (
<TableRow key={player.id} sx={{'&:last-child td, &:last-child th': {border: 0}}}>
Expand Down

0 comments on commit a7861cb

Please sign in to comment.