ProgressBarElement
Playwright element wrapper for <vaadin-progress-bar> supporting value/min/max setters and assertions and indeterminate state.
Component Tag
vaadin-progress-bar
Implements
HasThemeElement - Theme variant support
HasStyleElement - CSS class and style management
Constructor
Playwright locator for the <vaadin-progress-bar> element
Property Methods
getValue
Current numeric value parsed from aria-valuenow.
Returns the current progress value.
setValue
Set the progress bar value.
void setValue(double value)
getMin
Get the minimum value.
Returns the min value, or null if not set.
setMin
Set the minimum value.
getMax
Get the maximum value.
Returns the max value, or null if not set.
setMax
Set the maximum value.
isIndeterminate
Whether the bar is indeterminate.
boolean isIndeterminate()
setIndeterminate
Set the indeterminate state.
void setIndeterminate(boolean indeterminate)
Whether to show indeterminate state
Assertion Methods
assertValue
Assert that the numeric value matches.
void assertValue(Double expected)
Expected value, or null to assert undefined
assertMin
Assert that min matches the expected value.
void assertMin(double min)
assertMax
Assert that max matches the expected value.
void assertMax(double max)
assertIndeterminate
Assert indeterminate state.
void assertIndeterminate()
assertNotIndeterminate
Assert not indeterminate.
void assertNotIndeterminate()
Usage Examples
Basic Progress Bar
ProgressBarElement progressBar = new ProgressBarElement(page.locator("#progress-bar"));
progressBar.assertVisible();
progressBar.assertValue(0.5);
progressBar.assertNotIndeterminate();
Indeterminate Progress Bar
ProgressBarElement progressBar = new ProgressBarElement(
page.locator("#indeterminate-progress-bar")
);
progressBar.assertVisible();
progressBar.assertIndeterminate();
Progress Bar with Min/Max
ProgressBarElement progressBar = new ProgressBarElement(
page.locator("#min-max-progress-bar")
);
progressBar.assertMin(10.50);
progressBar.assertMax(100);
progressBar.assertValue(50.0);
Update Progress Value
ProgressBarElement progressBar = new ProgressBarElement(page.locator("#progress-bar"));
progressBar.setValue(0.75);
progressBar.assertValue(0.75);
double currentValue = progressBar.getValue();
assertEquals(0.75, currentValue, 0.01);
Set Min and Max
ProgressBarElement progressBar = new ProgressBarElement(page.locator("#progress-bar"));
progressBar.setMin(0);
progressBar.assertMin(0.0);
progressBar.setMax(200);
progressBar.assertMax(200.0);
progressBar.setValue(100);
progressBar.assertValue(100.0);
Toggle Indeterminate State
ProgressBarElement progressBar = new ProgressBarElement(page.locator("#progress-bar"));
progressBar.assertNotIndeterminate();
progressBar.setIndeterminate(true);
progressBar.assertIndeterminate();
boolean isIndeterminate = progressBar.isIndeterminate();
assertTrue(isIndeterminate);
Check Progress State
ProgressBarElement progressBar = new ProgressBarElement(page.locator("#progress-bar"));
if (progressBar.isIndeterminate()) {
System.out.println("Progress is indeterminate");
} else {
double value = progressBar.getValue();
double max = progressBar.getMax();
double percent = (value / max) * 100;
System.out.println("Progress: " + percent + "%");
}
Progress Bar with Theme
ProgressBarElement progressBar = new ProgressBarElement(page.locator("#progress-bar"));
progressBar.assertTheme("success");
progressBar.assertValue(1.0);