Horizontal Slider
Pratique testes de sliders horizontais e valores dinâmicos. Esta página é ideal para testar automação de controle deslizante, validação de valores mínimos e máximos, e interações com elementos range input.
Sobre esta Seção
Atividades do Dia a Dia:
- Testar movimentação de slider (arrastar e soltar)
- Validar valores mínimo e máximo do slider
- Praticar automação de definição de valores específicos
- Testar incrementos e decrementos de valores
- Validar atualização de valores em tempo real
- Testar sliders com diferentes ranges e steps
- Validar feedback visual de mudança de valor
Como Utilizar:
- Arraste o slider horizontal abaixo para alterar o valor
- Observe que o valor é atualizado em tempo real
- Teste valores mínimo (0) e máximo (100)
- Use os botões de atalho para definir valores específicos
- Use os
data-testidpara criar testes automatizados
Slider Horizontal
Arraste o slider para alterar o valor.
0
50
100
Valores Rápidos:
Informações para Testes
Cenários de Teste:
- Mover slider para valores específicos
- Validar valores mínimo (0) e máximo (100)
- Testar arrastar e soltar do slider
- Validar atualização do valor em tempo real
- Testar incrementos e decrementos
Elementos identificáveis:
data-testid="slider"- Slider principaldata-testid="slider-value"- Valor exibidodata-testid="btn-set-0"- Botão definir 0data-testid="btn-set-100"- Botão definir 100
Exemplos de Teste Automatizado:
// Cypress - Testar slider
cy.get('[data-testid="slider"]').invoke('val', 75).trigger('input')
cy.get('[data-testid="slider-value"]').should('contain', '75')
cy.get('[data-testid="slider"]').invoke('val', 0).trigger('input')
cy.get('[data-testid="slider-value"]').should('contain', '0')
cy.get('[data-testid="slider"]').invoke('val', 100).trigger('input')
cy.get('[data-testid="slider-value"]').should('contain', '100')
// Playwright - Testar slider
await page.getByTestId('slider').fill('75')
await expect(page.getByTestId('slider-value')).toContainText('75')
await page.getByTestId('slider').fill('0')
await expect(page.getByTestId('slider-value')).toContainText('0')
await page.getByTestId('slider').fill('100')
await expect(page.getByTestId('slider-value')).toContainText('100')
// Selenium Java - Testar slider
WebElement slider = driver.findElement(By.cssSelector("[data-testid='slider']"));
slider.sendKeys(Keys.ARROW_RIGHT.repeat(25));
WebElement value = driver.findElement(By.cssSelector("[data-testid='slider-value']"));
assert value.getText().contains("75");
// Ou usar Actions para arrastar
Actions actions = new Actions(driver);
actions.dragAndDropBy(slider, -75, 0).perform();
# Capybara (Ruby) - Testar slider
find('[data-testid="slider"]').set('75')
expect(find('[data-testid="slider-value"]')).to have_content('75')
find('[data-testid="slider"]').set('0')
expect(find('[data-testid="slider-value"]')).to have_content('0')
find('[data-testid="slider"]').set('100')
expect(find('[data-testid="slider-value"]')).to have_content('100')
*** Test Cases ***
Testar slider
Set Value css:[data-testid="slider"] 75
Element Should Contain css:[data-testid="slider-value"] 75
Set Value css:[data-testid="slider"] 0
Element Should Contain css:[data-testid="slider-value"] 0
Set Value css:[data-testid="slider"] 100
Element Should Contain css:[data-testid="slider-value"] 100