Skip to content

Commit

Permalink
Add parameter tab component visible test
Browse files Browse the repository at this point in the history
  • Loading branch information
juhangil committed Sep 20, 2024
1 parent 484ac3e commit 6c6fc70
Showing 1 changed file with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,4 +368,64 @@ string expectedValue
isApplyButtonEnabled.Should().NotBeNull();
isResetButtonEnabled.Should().NotBeNull();
}

[TestCase("slider-past-messages", "Past messages included")]
[TestCase("slider-max-response", "Max response")]
[TestCase("slider-temperature", "Temperature")]
[TestCase("slider-top-p", "Top P")]
[TestCase("slider-frequency-penalty", "Frequency penalty")]
[TestCase("slider-presence-penalty", "Presence penalty")]
public async Task Given_ParameterTab_When_Updated_Then_Parameter_Slider_Should_Be_Visible(string id, string label)
{
// Arrange
var parameterTab = Page.Locator("div.config-grid")
.Locator("fluent-tabs#config-tabs")
.Locator("fluent-tab#parameters-tab");

await parameterTab.ClickAsync();

var component = Page.Locator("div.config-grid")
.Locator("fluent-tabs#config-tabs")
.Locator("fluent-tab-panel#parameters-tab-panel")
.Locator($"div#{id}");

var labelComponent = component.Locator($"label[for='{id}-content']");

// Act
var labelText = await labelComponent.TextContentAsync();
var slider = component.Locator($"fluent-slider#{id}-slider");
var textfield = component.Locator($"fluent-text-field#{id}-textfield");

// Assert
labelText.Should().StartWith(label);
await Expect(slider).ToBeVisibleAsync();
await Expect(textfield).ToBeVisibleAsync();
}

[Test]
[TestCase("multiselect-stop-sequence", "Stop sequence")]
public async Task Given_ParameterTab_When_Updated_Then_Parameter_MultiSelect_Should_Be_Visible(string id, string label)
{
// Arrange
var parameterTab = Page.Locator("div.config-grid")
.Locator("fluent-tabs#config-tabs")
.Locator("fluent-tab#parameters-tab");

await parameterTab.ClickAsync();

var component = Page.Locator("div.config-grid")
.Locator("fluent-tabs#config-tabs")
.Locator("fluent-tab-panel#parameters-tab-panel")
.Locator($"div#{id}");

var labelComponent = component.Locator($"label[for='{id}-content']");

// Act
var labelText = await labelComponent.TextContentAsync();
var multiselect = component.Locator($"fluent-text-field#{id}-textfield");

// Assert
labelText.Should().StartWith(label);
await Expect(multiselect).ToBeVisibleAsync();
}
}

0 comments on commit 6c6fc70

Please sign in to comment.