Question

I have a button that changes its caption on hover. Im kinda at a loss how to phrase the features to test for that default state.

At the moment Im using

    Scenario: show caption on hover
    Given I should not see an "Add Website" caption on the add new button
    When I hover over the add new button
    Then I should see an "Add Website" caption on the add new button

But it feels a bit weird to assert the default state in a Given sentence. Do I need to split this into two scenarios?

Should I even test for that? If not how do I test this GUI details?

Was it helpful?

Solution

I would write 2 scenarios.

Scenario: default caption when opening page
  When I open the XYZ page
  Then I should see the "My default" caption on the add new button

Scenario: change caption on hover
  Given I am on the XYZ page
  When I hover over the add new button
  Then I should see the "Add Website" caption on the add new button
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top