Skip to content

Commit 2dc54fb

Browse files
committed
Add parameter tab component visible test
1 parent 54d5465 commit 2dc54fb

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

test/AzureOpenAIProxy.PlaygroundApp.Tests/Pages/PlaygroundPageConfigWindowTests.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,4 +368,64 @@ string expectedValue
368368
isApplyButtonEnabled.Should().NotBeNull();
369369
isResetButtonEnabled.Should().NotBeNull();
370370
}
371+
372+
[TestCase("slider-past-messages", "Past messages included")]
373+
[TestCase("slider-max-response", "Max response")]
374+
[TestCase("slider-temperature", "Temperature")]
375+
[TestCase("slider-top-p", "Top P")]
376+
[TestCase("slider-frequency-penalty", "Frequency penalty")]
377+
[TestCase("slider-presence-penalty", "Presence penalty")]
378+
public async Task Given_ParameterTab_When_Updated_Then_Parameter_Slider_Should_Be_Visible(string id, string label)
379+
{
380+
// Arrange
381+
var parameterTab = Page.Locator("div.config-grid")
382+
.Locator("fluent-tabs#config-tabs")
383+
.Locator("fluent-tab#parameters-tab");
384+
385+
await parameterTab.ClickAsync();
386+
387+
var component = Page.Locator("div.config-grid")
388+
.Locator("fluent-tabs#config-tabs")
389+
.Locator("fluent-tab-panel#parameters-tab-panel")
390+
.Locator($"div#{id}");
391+
392+
var labelComponent = component.Locator($"label[for='{id}-content']");
393+
394+
// Act
395+
var labelText = await labelComponent.TextContentAsync();
396+
var slider = component.Locator($"fluent-slider#{id}-slider");
397+
var textfield = component.Locator($"fluent-text-field#{id}-textfield");
398+
399+
// Assert
400+
labelText.Should().StartWith(label);
401+
await Expect(slider).ToBeVisibleAsync();
402+
await Expect(textfield).ToBeVisibleAsync();
403+
}
404+
405+
[Test]
406+
[TestCase("multiselect-stop-sequence", "Stop sequence")]
407+
public async Task Given_ParameterTab_When_Updated_Then_Parameter_MultiSelect_Should_Be_Visible(string id, string label)
408+
{
409+
// Arrange
410+
var parameterTab = Page.Locator("div.config-grid")
411+
.Locator("fluent-tabs#config-tabs")
412+
.Locator("fluent-tab#parameters-tab");
413+
414+
await parameterTab.ClickAsync();
415+
416+
var component = Page.Locator("div.config-grid")
417+
.Locator("fluent-tabs#config-tabs")
418+
.Locator("fluent-tab-panel#parameters-tab-panel")
419+
.Locator($"div#{id}");
420+
421+
var labelComponent = component.Locator($"label[for='{id}-content']");
422+
423+
// Act
424+
var labelText = await labelComponent.TextContentAsync();
425+
var multiselect = component.Locator($"fluent-text-field#{id}-textfield");
426+
427+
// Assert
428+
labelText.Should().StartWith(label);
429+
await Expect(multiselect).ToBeVisibleAsync();
430+
}
371431
}

0 commit comments

Comments
 (0)