@@ -38,15 +38,15 @@ test('should create a full simulation', async ({ page }) => {
3838 await page . getByRole ( 'tab' , { name : 'Method' } ) . click ( ) ;
3939 const currentTab = simulationPage . requestTabContentMethod ;
4040 await currentTab . getByRole ( 'button' , { name : 'Add first field matcher for method' } ) . click ( ) ;
41- await currentTab . locator ( simulationPage . getSelectMatcherType ( ) ) . selectOption ( 'glob ') ;
41+ await simulationPage . selectMatcherOption ( currentTab , 'Glob ') ;
4242 await currentTab . locator ( simulationPage . getMatcherInput ( ) ) . fill ( 'GET' ) ;
4343 } ) ;
4444
4545 await test . step ( 'Edit request HTTP Scheme' , async ( ) => {
4646 await page . getByRole ( 'tab' , { name : 'Scheme' } ) . click ( ) ;
4747 const currentTab = simulationPage . requestTabContentScheme ;
4848 await currentTab . getByRole ( 'button' , { name : 'Add first field matcher for scheme' } ) . click ( ) ;
49- await currentTab . locator ( simulationPage . getSelectMatcherType ( ) ) . selectOption ( 'glob ') ;
49+ await simulationPage . selectMatcherOption ( currentTab , 'Glob ') ;
5050 await currentTab . locator ( simulationPage . getMatcherInput ( ) ) . fill ( 'http' ) ;
5151 } ) ;
5252
@@ -56,15 +56,15 @@ test('should create a full simulation', async ({ page }) => {
5656 await currentTab
5757 . getByRole ( 'button' , { name : 'Add first field matcher for destination' } )
5858 . click ( ) ;
59- await currentTab . locator ( simulationPage . getSelectMatcherType ( ) ) . selectOption ( 'glob ') ;
59+ await simulationPage . selectMatcherOption ( currentTab , 'Glob ') ;
6060 await currentTab . locator ( simulationPage . getMatcherInput ( ) ) . fill ( 'mock.api.com' ) ;
6161 } ) ;
6262
6363 await test . step ( 'Edit request HTTP Path' , async ( ) => {
6464 await page . getByRole ( 'tab' , { name : 'Path' } ) . click ( ) ;
6565 const currentTab = simulationPage . requestTabContentPath ;
66- await currentTab . getByRole ( 'button' , { name : 'Add first field matcher for method ' } ) . click ( ) ;
67- await currentTab . locator ( simulationPage . getSelectMatcherType ( ) ) . selectOption ( 'glob ') ;
66+ await currentTab . getByRole ( 'button' , { name : 'Add first field matcher for path ' } ) . click ( ) ;
67+ await simulationPage . selectMatcherOption ( currentTab , 'Glob ') ;
6868 await currentTab . locator ( simulationPage . getMatcherInput ( ) ) . fill ( 'path1' ) ;
6969
7070 await currentTab . locator ( simulationPage . getAddMatcherButton ( ) ) . click ( ) ;
@@ -81,7 +81,7 @@ test('should create a full simulation', async ({ page }) => {
8181 await currentTab
8282 . locator ( page . getByRole ( 'button' , { name : "Add first field matcher for query 'param1'" } ) )
8383 . click ( ) ;
84- await currentTab . locator ( simulationPage . getSelectMatcherType ( ) ) . selectOption ( 'glob ') ;
84+ await simulationPage . selectMatcherOption ( currentTab , 'Glob ') ;
8585 await currentTab . locator ( simulationPage . getMatcherInput ( ) ) . fill ( 'value1' ) ;
8686
8787 await currentTab
@@ -91,10 +91,10 @@ test('should create a full simulation', async ({ page }) => {
9191 await currentTab
9292 . locator ( page . getByRole ( 'button' , { name : "Add first field matcher for query 'param2'" } ) )
9393 . click ( ) ;
94- await currentTab . locator ( simulationPage . getMatcherInput ( 1 ) ) . fill ( 'value2' ) ;
94+ await currentTab . locator ( simulationPage . getMatcherInput ( ) ) . fill ( 'value2' ) ;
9595
96- await currentTab . locator ( simulationPage . getAddMatcherButton ( 1 ) ) . click ( ) ;
97- await currentTab . locator ( simulationPage . getMatcherInput ( 2 ) ) . fill ( 'value3' ) ;
96+ await currentTab . locator ( simulationPage . getAddMatcherButton ( ) ) . click ( ) ;
97+ await currentTab . locator ( simulationPage . getMatcherInput ( 1 ) ) . fill ( 'value3' ) ;
9898 } ) ;
9999
100100 await test . step ( 'Edit request HTTP Headers' , async ( ) => {
@@ -109,16 +109,17 @@ test('should create a full simulation', async ({ page }) => {
109109 . click ( ) ;
110110
111111 await currentTab . locator ( simulationPage . getMatcherInput ( ) ) . fill ( 'valueheader1' ) ;
112- await currentTab . locator ( page . getByText ( 'Ignore Unknown' ) ) . click ( ) ;
113- await currentTab . locator ( page . getByText ( 'Ignore Order' ) ) . click ( ) ;
114- await currentTab . locator ( page . getByText ( 'Ignore Occurrences' ) ) . click ( ) ;
112+ await currentTab . getByLabel ( 'Advanced options' ) . click ( ) ;
113+ await page . getByText ( 'Ignore Unknown' ) . click ( ) ;
114+ await page . getByText ( 'Ignore Order' ) . click ( ) ;
115+ await page . getByText ( 'Ignore Occurrences' ) . click ( ) ;
115116 } ) ;
116117
117118 await test . step ( 'Edit request HTTP Body' , async ( ) => {
118119 await page . getByRole ( 'tab' , { name : 'Body' } ) . click ( ) ;
119120 const currentTab = simulationPage . requestTabContentBody ;
120121 await currentTab . getByRole ( 'button' , { name : 'Add first field matcher for body' } ) . click ( ) ;
121- await currentTab . locator ( simulationPage . getSelectMatcherType ( ) ) . selectOption ( 'jsonPartial ') ;
122+ await simulationPage . selectMatcherOption ( currentTab , 'JSON Partial ') ;
122123 await currentTab . locator ( simulationPage . getMatcherInput ( ) ) . fill ( '{ "field1": "value1" }' ) ;
123124 } ) ;
124125
@@ -127,8 +128,44 @@ test('should create a full simulation', async ({ page }) => {
127128 simulationPage . responseBodyEditor ,
128129 '{ "response": "body" }'
129130 ) ;
131+
130132 await page . getByText ( 'Prettify' ) . click ( ) ;
131- await page . getByTestId ( 'response-status-select' ) . selectOption ( '204' ) ;
133+ await page . getByLabel ( 'Status' ) . click ( ) ;
134+ await page . getByText ( '204' ) . click ( ) ;
135+
136+ await page . getByText ( 'Encoded body' ) . click ( ) ;
137+ await page . getByRole ( 'button' , { name : 'Delay' } ) . click ( ) ;
138+ await page . getByLabel ( 'Fixed Delay (ms)' ) . fill ( '500' ) ;
139+ } ) ;
140+
141+ await test . step ( 'Edit response HTTP headers' , async ( ) => {
142+ // Delete a header
143+ await page . getByRole ( 'button' , { name : 'Add header' } ) . click ( ) ;
144+ await page . getByLabel ( 'Header name' ) . fill ( 'a header to be' ) ;
145+ await page . getByLabel ( 'Header value' ) . fill ( 'removed' ) ;
146+ await page . getByText ( 'Submit' ) . click ( ) ;
147+ await page . getByLabel ( 'Delete response header' ) . click ( ) ;
148+
149+ // Add header (fill with keyboard)
150+ await page . getByRole ( 'button' , { name : 'Add header' } ) . click ( ) ;
151+ await page . getByLabel ( 'Header name' ) . fill ( 'Content-type' ) ;
152+ await page . getByLabel ( 'Header name' ) . press ( 'Tab' ) ;
153+ await page . getByLabel ( 'Header value' ) . fill ( 'application/json' ) ;
154+ await page . getByLabel ( 'Header value' ) . press ( 'Enter' ) ;
155+ await expect ( page . getByText ( 'Content-type: application/json' ) ) . toBeVisible ( ) ;
156+
157+ // Edit header
158+ await page . getByText ( 'Content-type: application/json' ) . click ( ) ;
159+ await page . getByLabel ( 'Header name' ) . last ( ) . fill ( 'Content-Type' ) ;
160+ await page . getByText ( 'Submit' ) . last ( ) . click ( ) ;
161+ await expect ( page . getByText ( 'Content-Type: application/json' ) ) . toBeVisible ( ) ;
162+
163+ // Add another header (with multiple values)
164+ await page . getByRole ( 'button' , { name : 'Add header' } ) . click ( ) ;
165+ await page . getByLabel ( 'Header name' ) . last ( ) . fill ( 'Cache-control' ) ;
166+ await page . getByLabel ( 'Header value' ) . last ( ) . fill ( 'max-age=604800&must-revalidate' ) ;
167+ await page . getByText ( 'Submit' ) . last ( ) . click ( ) ;
168+ await expect ( page . getByText ( 'Cache-control: max-age=604800,must-revalidate' ) ) . toBeVisible ( ) ;
132169 } ) ;
133170
134171 await test . step ( 'Assert text editor content is correct' , async ( ) => {
@@ -146,7 +183,8 @@ test('content-type headers should update when body change', async ({ page }) =>
146183 const simulationPage = new WebUiSimulationPage ( page ) ;
147184 await simulationPage . goto ( JSON . stringify ( simulationWithContentType ) ) ;
148185
149- await page . locator ( '.card-header' ) . click ( ) ;
186+ await page . getByRole ( 'button' , { name : '- →️ 200' } ) . click ( ) ;
187+
150188 await simulationPage . setTextEditorContent (
151189 simulationPage . responseBodyEditor ,
152190 ', how is it going ?'
0 commit comments