11import React from "react"
22
3- import { OpenAiCodexServiceTier } from "@roo-code/types/model"
4-
53import { expect , test } from "../../../../../playwright/coverage-fixture"
64import { OpenAICodexFixture } from "./OpenAICodex.visual.fixture"
75
@@ -24,54 +22,49 @@ const themes = [
2422 } ,
2523] as const
2624
27- const tiers = [
28- { name : "standard" , value : OpenAiCodexServiceTier . Default } ,
29- { name : "priority" , value : OpenAiCodexServiceTier . Priority } ,
30- ] as const
31-
3225for ( const theme of themes ) {
33- for ( const tier of tiers ) {
34- test ( `renders the ${ tier . name } OpenAI Codex speed in the VS Code ${ theme . name } theme` , async ( { mount } ) => {
35- const component = await mount ( < OpenAICodexFixture value = { tier . value } /> )
36- const selector = component . getByTestId ( "openai-codex-service-tier" )
26+ test ( `renders both OpenAI Codex speeds in the VS Code ${ theme . name } theme` , async ( { mount } ) => {
27+ const component = await mount ( < OpenAICodexFixture /> )
28+ const selectors = component . getByTestId ( "openai-codex-service- tier" )
29+ const selector = selectors . first ( )
3730
38- await selector . evaluate ( ( element , { bodyClass, themeId } ) => {
39- const { document } = element . ownerDocument . defaultView !
31+ await expect ( selectors ) . toHaveCount ( 2 )
32+ await selector . evaluate ( ( element , { bodyClass, themeId } ) => {
33+ const { document } = element . ownerDocument . defaultView !
4034
41- document . documentElement . className = bodyClass
42- document . body . className = bodyClass
43- document . body . dataset . vscodeThemeId = themeId
44- } , theme )
45- await expect
46- . poll ( ( ) =>
47- selector . evaluate ( ( element ) => {
48- const body = element . ownerDocument . body
49- const styles = getComputedStyle ( body )
50- const trigger = element . querySelector ( "button" ) !
35+ document . documentElement . className = bodyClass
36+ document . body . className = bodyClass
37+ document . body . dataset . vscodeThemeId = themeId
38+ } , theme )
39+ await expect
40+ . poll ( ( ) =>
41+ selector . evaluate ( ( element ) => {
42+ const body = element . ownerDocument . body
43+ const styles = getComputedStyle ( body )
44+ const trigger = element . querySelector ( "button" ) !
5145
52- return {
53- documentClass : element . ownerDocument . documentElement . className ,
54- bodyClass : body . className ,
55- editorBackground : styles . getPropertyValue ( "--vscode-editor-background" ) . trim ( ) ,
56- dropdownBackground : styles . getPropertyValue ( "--vscode-dropdown-background" ) . trim ( ) ,
57- triggerBackground : getComputedStyle ( trigger ) . backgroundColor ,
58- }
59- } ) ,
60- )
61- . toEqual ( {
62- documentClass : theme . bodyClass ,
63- bodyClass : theme . bodyClass ,
64- editorBackground : theme . editorBackground ,
65- dropdownBackground : theme . dropdownBackground ,
66- triggerBackground : theme . triggerBackground ,
67- } )
68-
69- await selector . evaluate ( async ( ) => {
70- await document . fonts . ready
71- await new Promise < void > ( ( resolve ) => requestAnimationFrame ( ( ) => resolve ( ) ) )
46+ return {
47+ documentClass : element . ownerDocument . documentElement . className ,
48+ bodyClass : body . className ,
49+ editorBackground : styles . getPropertyValue ( "--vscode-editor-background" ) . trim ( ) ,
50+ dropdownBackground : styles . getPropertyValue ( "--vscode-dropdown-background" ) . trim ( ) ,
51+ triggerBackground : getComputedStyle ( trigger ) . backgroundColor ,
52+ }
53+ } ) ,
54+ )
55+ . toEqual ( {
56+ documentClass : theme . bodyClass ,
57+ bodyClass : theme . bodyClass ,
58+ editorBackground : theme . editorBackground ,
59+ dropdownBackground : theme . dropdownBackground ,
60+ triggerBackground : theme . triggerBackground ,
7261 } )
7362
74- await expect ( selector ) . toHaveScreenshot ( `openai-codex-speed-selector-${ tier . name } -${ theme . name } .png` )
63+ await component . evaluate ( async ( ) => {
64+ await document . fonts . ready
65+ await new Promise < void > ( ( resolve ) => requestAnimationFrame ( ( ) => resolve ( ) ) )
7566 } )
76- }
67+
68+ await expect ( component ) . toHaveScreenshot ( `openai-codex-speed-selector-states-${ theme . name } .png` )
69+ } )
7770}
0 commit comments