A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
TypeScript amazon-primeelectronepic-games-launcherepic-games-storeepic-storegaminggoggog-galaxyheroic-games-launcherlinuxplay-gamesprotonsteamwine
import { useState } from 'react'
import { expect, fn, userEvent } from 'storybook/test'
import type { Meta, StoryObj } from '@storybook/react-vite'
import type { EnviromentVariable } from 'common/types'
import SideloadAdvanced from '.'
function Controlled(args: React.ComponentProps<typeof SideloadAdvanced>) {
const [environmentOptions, setEnvironmentOptions] = useState<
EnviromentVariable[]
>([{ key: 'DXVK_HUD', value: 'fps' }])
const [umuGameId, setUmuGameId] = useState('')
return (
<div style={{ width: 720, maxWidth: '95vw' }}>
<SideloadAdvanced
{...args}
environmentOptions={environmentOptions}
onEnvironmentOptionsChange={setEnvironmentOptions}
umuGameId={umuGameId}
onUmuGameIdChange={setUmuGameId}
/>
</div>
)
}
const meta = {
title: 'Overlays/SideloadAdvanced',
component: SideloadAdvanced,
args: {
canRunWinetricks: true,
onOpenWinetricks: fn(),
environmentOptions: [],
onEnvironmentOptionsChange: fn(),
umuGameId: '',
onUmuGameIdChange: fn(),
showUmuOptions: true
},
render: (args) => <Controlled {...args} />,
parameters: {
docs: {
description: {
component:
'Optional advanced settings shown while adding a sideloaded game: Winetricks, the UMU GAMEID and environment variables are applied to the installer and to the app.'
}
}
}
} satisfies Meta<typeof SideloadAdvanced>
export default meta
type Story = StoryObj<typeof meta>
export const Default: Story = {}
export const OpensWinetricks: Story = {
play: async ({ canvas, args }) => {
await userEvent.click(canvas.getByText('Advanced'))
const winetricksButton = await canvas.findByRole('button', {
name: /Run winetricks/i
})
await expect(winetricksButton).toBeEnabled()
await expect(
canvas.getByRole('textbox', { name: /UMU GAMEID/i })
).toBeVisible()
await userEvent.click(winetricksButton)
await expect(args.onOpenWinetricks).toHaveBeenCalled()
}
}
export const WithoutUmuOptions: Story = {
args: { showUmuOptions: false }
}