Skip to content

Commit

Permalink
add new selecting-test with test.step reproduces the bug Asvarox#318
Browse files Browse the repository at this point in the history
  • Loading branch information
RenBabiuch committed Aug 30, 2024
1 parent 2b5fa90 commit e3adab7
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion tests/remote-song-list.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { expect, test } from '@playwright/test';
import { txtfile } from './fixtures/newsongtxt';
import { initTestMode, mockSongs } from './helpers';
import { connectRemoteMic, openAndConnectRemoteMicDirectly, openRemoteMic } from './steps/openAndConnectRemoteMic';
import {
connectRemoteMic,
openAndConnectRemoteMicDirectly,
openAndConnectRemoteMicWithCode,
openRemoteMic,
} from './steps/openAndConnectRemoteMic';

import initialise from './PageObjects/initialise';

Expand Down Expand Up @@ -226,3 +231,50 @@ test('Filtering all and favourites by song language ', async ({ page, browser })
await expect(remoteMic.remoteMicSongListPage.getSongElement(songs.spanish.ID)).toBeVisible();
});
});

test('Selecting a song using the `select` button on the remoteMic, when selected languages on desktop and remoteMic apps are the same - works', async ({
page,
browser,
}) => {
const player1 = {
num: 0,
name: 'Player 1 - Ren',
};

await page.goto('/?e2e-test');
await pages.landingPage.enterTheGame();
await pages.inputSelectionPage.selectSmartphones();

const remoteMic = await openAndConnectRemoteMicWithCode(page, browser, player1.name);

await pages.smartphonesConnectionPage.expectPlayerNameToBe(player1.num, player1.name);

await test.step('On the desktop app - ensure all languages are selected', async () => {
await pages.smartphonesConnectionPage.goToMainMenu();
await pages.mainMenuPage.goToSingSong();
await pages.songLanguagesPage.ensureAllLanguagesAreSelected();
await pages.songLanguagesPage.continueAndGoToSongList();
});

await test.step('On the remoteMic app - ensure all languages are selected too', async () => {
await remoteMic.remoteMicMainPage.goToSongList();
await remoteMic.remoteMicSongListPage.goToSelectSongLanguage();
await remoteMic.remoteMicSongLanguagesPage.ensureAllSongLanguagesAreDeselected(); // = selected
await remoteMic.remoteMicSongLanguagesPage.goBackToSongList();
});

await test.step('Select a few songs on the remoteMic - they should open as a preview on the desktop app', async () => {
await remoteMic.remoteMicSongListPage.chooseSongForPreview(songs.polish1.ID);
test.fail(true, 'Select button does not work for first position on the song list');
await expect.soft(pages.songPreviewPage.songPreviewElement).toHaveAttribute('data-song', songs.polish1.ID);

await remoteMic.remoteMicSongListPage.chooseSongForPreview(songs.french.ID);
await pages.songPreviewPage.expectPreviewSongToBe(songs.french.ID);

await remoteMic.remoteMicSongListPage.chooseSongForPreview(songs.spanish.ID);
await pages.songPreviewPage.expectPreviewSongToBe(songs.spanish.ID);

await remoteMic.remoteMicSongListPage.chooseSongForPreview(songs.english1.ID);
await pages.songPreviewPage.expectPreviewSongToBe(songs.english1.ID);
});
});

0 comments on commit e3adab7

Please sign in to comment.