diff --git a/lua/snapshot.mjs b/lua/snapshot.mjs index 3fa12ebdf81..b30c21d6748 100644 --- a/lua/snapshot.mjs +++ b/lua/snapshot.mjs @@ -30,7 +30,7 @@ const PIXELMATCH_OPTIONS = { threshold: 0.1 }; args: ['--disable-web-security'] }); const page = await browser.newPage({ viewport: VIEWPORT }); - await page.goto(`file://${htmlPath}`); + await page.goto(`file://${htmlPath}`, {waitUntil: "networkidle"}); const newScreenshotBuffer = await page.screenshot({ animations: 'disabled' }); await browser.close(); diff --git a/lua/spec/helpers/test_helper.lua b/lua/spec/helpers/test_helper.lua index 68725b07cf0..9974e9ba82f 100644 --- a/lua/spec/helpers/test_helper.lua +++ b/lua/spec/helpers/test_helper.lua @@ -12,7 +12,8 @@ function allwikis(name, funcToRun, wikiArgs) error('SOMETHING WENT WRONG') end --- @param testname string --- @param actual string -function GoldenTest(testname, actual) error('SOMETHING WENT WRONG') end +--- @param extraHTML string? +function GoldenTest(testname, actual, extraHTML) error('SOMETHING WENT WRONG') end return function(busted, helper, options) -- Copy from commons/lua.lua @@ -145,13 +146,14 @@ return function(busted, helper, options) return text end - local function GoldenTest(testName, actual) + local function GoldenTest(testName, actual, extraHTML) -- Currently we're only running snapshots tests while updating them too if os.getenv('UPDATE_SNAPSHOTS') ~= 'true' then return end local generatedHtml = simpleMediaWikiParser(tostring(actual)) + .. (extraHTML or '') local template = readFile('spec/helpers/template.html') assert(template, 'Could not read template.html') diff --git a/lua/spec/snapshots/team_participant.png b/lua/spec/snapshots/team_participant.png index 63a252eab22..df2d460dbf0 100644 Binary files a/lua/spec/snapshots/team_participant.png and b/lua/spec/snapshots/team_participant.png differ diff --git a/lua/spec/team_participant_spec.lua b/lua/spec/team_participant_spec.lua index 2a5634f8bb6..5b4f97dc540 100644 --- a/lua/spec/team_participant_spec.lua +++ b/lua/spec/team_participant_spec.lua @@ -8,46 +8,67 @@ insulate('Team Participant', function() local TeamParticipantsController = require('Module:TeamParticipants/Controller') - GoldenTest('team_participant', tostring(TeamParticipantsController.fromTemplate{ - { - 'Team Liquid', - players = { - {'alexis'}, - {'dodonut'}, - {'meL'}, - {'Noia'}, - {'sarah'}, - {'effys', role = 'Head Coach', type = 'staff'}, - {'Veer', role = 'Coach', type = 'staff'}, + GoldenTest('team_participant', + tostring(TeamParticipantsController.fromTemplate{ + { + 'Team Liquid', + players = { + {'alexis'}, + {'dodonut'}, + {'meL'}, + {'Noia'}, + {'sarah'}, + {'effys', role = 'Head Coach', type = 'staff'}, + {'Veer', role = 'Coach', type = 'staff'}, + }, + qualification = { + method = 'qual', + url = 'https://google.com', + text = 'FooBar', + }, + notes = { + {'SOME TEXT HERE'}, + } }, - qualification = { - method = 'qual', - url = 'https://google.com', - text = 'FooBar', + { + 'bds', + qualification = { + method = 'invite', + text = 'Invited', + }, + players = { + {'ElectricalBoy'}, + {'hjpalpha'}, + {'Eetu'}, + {'SyntacticSugar'}, + {'SyntacticSalt'}, + {'Rathoz', role = 'Coach', type = 'staff'}, + }, + notes = { + {'Best Team in the World!', highlighted = true}, + } }, - notes = { - {'SOME TEXT HERE'}, - } - }, - { - 'bds', - qualification = { - method = 'invite', - text = 'Invited', + { + 'mouz', + qualification = { + method = 'invite', + page = 'Testpage', + text = 'Invited', + }, + players = {}, }, - players = { - {'ElectricalBoy'}, - {'hjpalpha'}, - {'Eetu'}, - {'SyntacticSugar'}, - {'SyntacticSalt'}, - {'Rathoz', role = 'Coach', type = 'staff'}, - }, - notes = { - {'Best Team in the World!', highlighted = true}, - } - }, - })) + }), + [[]] + ) LpdbQuery:revert() LpdbPlacementStore:revert()