|
| 1 | +import test, { ConsoleMessage, expect } from "@playwright/test"; |
| 2 | + |
| 3 | +const minutes10 = 1000 * 60 * 10; |
| 4 | +const WIDTH = 1080; |
| 5 | +const HEIGHT = 1920; |
| 6 | +const visualConfig = { |
| 7 | + SCREEN_WIDTH: WIDTH, |
| 8 | + SCREEN_HEIGHT: HEIGHT, |
| 9 | + TICKER_SMALL_SIZE: "50%", |
| 10 | + TICKER_LIVE_ICON_SIZE: "70px", |
| 11 | + SCOREBOARD_CELL_PLACE_SIZE: "50px", |
| 12 | + SCOREBOARD_CELL_TEAMNAME_SIZE: "304px", |
| 13 | + SCOREBOARD_CELL_POINTS_SIZE: "50px", |
| 14 | + SCOREBOARD_CELL_PENALTY_SIZE: "92px", |
| 15 | + FULL_SCREEN_CLOCK_FONT_SIZE: "300px", |
| 16 | + FULL_SCREEN_CLOCK_COLOR: "#eeeeee33", |
| 17 | + BACKGROUND: "#691930" |
| 18 | +}; |
| 19 | +const widgets = [ |
| 20 | + { |
| 21 | + type: "ScoreboardWidget", |
| 22 | + widgetId: "scoreboard", |
| 23 | + location: { |
| 24 | + positionX: 16, |
| 25 | + positionY: 148, |
| 26 | + sizeX: 1048, |
| 27 | + sizeY: 1756, |
| 28 | + }, |
| 29 | + statisticsId: "scoreboard", |
| 30 | + settings: { |
| 31 | + scrollDirection: "FirstPage", |
| 32 | + optimismLevel: "normal", |
| 33 | + group: "all", |
| 34 | + }, |
| 35 | + }, |
| 36 | + { |
| 37 | + type: "TickerWidget", |
| 38 | + widgetId: "ticker", |
| 39 | + location: { |
| 40 | + positionX: 540, |
| 41 | + positionY: 46, |
| 42 | + sizeX: 524, |
| 43 | + sizeY: 86, |
| 44 | + }, |
| 45 | + statisticsId: "ticker", |
| 46 | + settings: {}, |
| 47 | + }, |
| 48 | + { |
| 49 | + type: "FullScreenClockWidget", |
| 50 | + widgetId: "fullScreenClock", |
| 51 | + location: { |
| 52 | + positionX: 16, |
| 53 | + positionY: 148, |
| 54 | + sizeX: 1048, |
| 55 | + sizeY: 1756, |
| 56 | + }, |
| 57 | + statisticsId: "fullScreenClock", |
| 58 | + settings: { |
| 59 | + globalTimeMode: false, |
| 60 | + quietMode: false, |
| 61 | + contestCountdownMode: false, |
| 62 | + }, |
| 63 | + }, |
| 64 | +]; |
| 65 | +test.describe("Instagram story", async () => { |
| 66 | + test.setTimeout(minutes10); |
| 67 | + test("Instagram story", async ({ browser }) => { |
| 68 | + const context = await browser.newContext({ |
| 69 | + recordVideo: { dir: "videos/", size: { width: WIDTH, height: HEIGHT } }, |
| 70 | + viewport: { width: WIDTH, height: HEIGHT }, |
| 71 | + }); |
| 72 | + const page = await context.newPage(); |
| 73 | + // const messages: ConsoleMessage[] = []; |
| 74 | + // page.on('console', m => messages.push(m)); |
| 75 | + const url = `localhost:8080/overlay?forceWidgets=${encodeURIComponent( |
| 76 | + JSON.stringify(widgets) |
| 77 | + )}&forceVisualConfig=${encodeURIComponent(JSON.stringify(visualConfig))}`; |
| 78 | + console.log(url); |
| 79 | + await page.goto(url); |
| 80 | + const selector = await page.waitForSelector( |
| 81 | + '[data-widget-id="scoreboard"]' |
| 82 | + ); |
| 83 | + const locator = await page.locator('[data-widget-id="scoreboard"]'); |
| 84 | + await page.waitForTimeout(4 * 60 * 1000 + 15 * 1000); |
| 85 | + // await expect(locator).toHaveText('OVER', { timeout: 100000000}) |
| 86 | + await context.close(); |
| 87 | + // expect(messages).toEqual([]); |
| 88 | + }); |
| 89 | +}); |
0 commit comments