Skip to content

StepDefinitions.seriesAddedToCollection(): modify test logic #645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
php-coder opened this issue Sep 25, 2017 · 1 comment
Closed

StepDefinitions.seriesAddedToCollection(): modify test logic #645

php-coder opened this issue Sep 25, 2017 · 1 comment

Comments

@php-coder
Copy link
Owner

I suggest to improve the following method:

public void seriesAddedToCollection() {
driver.get("http://127.0.0.1:8080/series/1");
String actual = driver.findElement(
By.xpath("//*[@id='series-danger']//ancestor::form/p[1]")
).getText();
String expected = "Series is part of your collection";
assertEquals(expected, actual);

Instead of what it is doing now, it should:

  • check that the message Series has been added to your collection is presented on the current page (hint: find an element with this message by a class name)
  • find a link near the label "new" and inspect its href attribute (is should equal to /series/1)

This also give us a couple benefits:

  • xpath will gone
  • we'll get a little speed improvements

Also our code will test collection page instead of a series page, that is more logical for a test of collection :)

Tech debt for f72c87d (#46)

@php-coder php-coder added this to the next milestone Sep 25, 2017
@php-coder php-coder changed the title StepDefinitions.seriesAddedToCollection(): StepDefinitions.seriesAddedToCollection(): modify logic Sep 26, 2017
@php-coder php-coder changed the title StepDefinitions.seriesAddedToCollection(): modify logic StepDefinitions.seriesAddedToCollection(): modify test logic Sep 26, 2017
@php-coder php-coder self-assigned this Jul 15, 2019
@php-coder php-coder modified the milestones: next, 0.4.1 Jul 15, 2019
@php-coder
Copy link
Owner Author

Won't fix as we're going get rid of Cucumber JVM (#1019).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants