In this spec, we can observe the following improvements that can be made:
- Move hard-coded selectors to constants
- Move hard-coded texts to constants
- Move hard-coded credentials to environment variables
- Use proper step blocks
Let's refactor the spec based on these best practices.
In the code above we did one additional refactoring. In the nested
describe block for the "Starring tasks feature"
tests, we removed the
test for verifying the starring feature. This is because starring a task
is a part of the unstarring task test which makes it redundant to have a
dedicated test just for that feature. This additionally allows us to
remove the serial configuration and the describe block since there is
only a single test coming under the suite.