Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

test(toh-[234]): add e2e for Dart and TS #1785

Closed
wants to merge 2 commits into from

Conversation

chalin
Copy link
Contributor

@chalin chalin commented Jun 29, 2016

From the user's perspective toh-2 to -4 all have the same behavior.
This PR introduces e2e tests for all these parts by sharing test suites.

3 minor bugs were detected by the tests and are fixed in this PR.

The toh-1 tests introduced in #1620 are

  • Refactored so as to be easier to reuse for the other parts.
  • Rewritten to benefit from the availability of async/await.

Suites passed:

  • public/docs/_examples/toh-1/dart
  • public/docs/_examples/toh-1/ts
  • public/docs/_examples/toh-2/dart
  • public/docs/_examples/toh-2/ts
  • public/docs/_examples/toh-3/dart
  • public/docs/_examples/toh-3/ts
  • public/docs/_examples/toh-4/dart
  • public/docs/_examples/toh-4/ts

Contributes to #1619.

Fixes #1609.
Now the toh-4 index.html is identical to those of the previous parts.

@chalin
Copy link
Contributor Author

chalin commented Jun 29, 2016

@Foxandxss @filipesilva @kwalrath @thso : ready for review.

@chalin chalin force-pushed the chalin-toh-2-to-4-e2e-0629 branch from fa01120 to e321be7 Compare June 30, 2016 20:52
@Foxandxss
Copy link
Member

I have mixed feelings about this. I understand that the tests shares a lot, but I feel like the tests are now a bit overkill for what they should accomplish.

But that is just me :/

@chalin
Copy link
Contributor Author

chalin commented Jul 1, 2016

Do you mean "overkill" in the sense that too much functionality is being tested?

@chalin
Copy link
Contributor Author

chalin commented Jul 1, 2016

On the good side, the tests did uncover (minor) problems with the apps. :)

@Foxandxss
Copy link
Member

Overkill in terms that we are creating too many files for something that should be simple.

And yes, that is the good side of tests.

I want the tests, that for sure. I also understand that toh is an special case for this.

@chalin
Copy link
Contributor Author

chalin commented Jul 1, 2016

Right, this is a special case. The given module breakdown allows toh-2, -3, and -4 to reuse the same tests (because the app changes are only internal). This makes for DRY tests.

@chalin
Copy link
Contributor Author

chalin commented Jul 1, 2016

The alternative would be to copy-paste tests, which I think we prefer not doing.

@filipesilva
Copy link
Contributor

All for tests factoring and reusability. The other option is to use Page Objects with some kind of extention/inheritance but would still imply a fair bit of copy paste so I don't think it's ideal.

@chalin
Copy link
Contributor Author

chalin commented Jul 1, 2016

Thanks for pointing out page objects (the getPageElts() was a crude approximation of using a page object); it is nice to know about that idiom.

Is there any chance that this might get reviewed and merged before the long week-end? :)

@filipesilva
Copy link
Contributor

It lgtm tbh.

@chalin chalin force-pushed the chalin-toh-2-to-4-e2e-0629 branch 2 times, most recently from 399cf30 to 79799a8 Compare July 1, 2016 22:41
@chalin chalin force-pushed the chalin-toh-2-to-4-e2e-0629 branch 3 times, most recently from d773b66 to 9c1094c Compare July 4, 2016 21:17
@wardbell
Copy link
Contributor

wardbell commented Jul 6, 2016

Sorry but I have a different perspective on this.

I'm generally in favor of DRY. But not when it comes to sharing content-specific material/tests across samples. Test infrastructure? Of course we do! But specific tests? I'm uncomfortable with that.

Why? Because it binds the toh parts together. Now I can break tests for toh-2 when I make changes to toh-4. I don't like that kind of vulnerability.

I DO like that you uncovered some bugs. Let's fix those independently.

Otherwise, ... sorry ... I'm declining this PR.

Leaving it open (briefly) to allow comments and so you can mine the bug fixes in a separate PR.

@chalin
Copy link
Contributor Author

chalin commented Jul 6, 2016

@wardbell : thanks for the feedback. Allow me to defend this approach one last time (in case it might waver your opinion). I generally agree with you points (e.g., if this were test infrastructure sharing between unrelated chapters), but:

  • The toh parts are semantically bound; they are a progression by design.
  • If ever a scenario like the one you described occurs (making changes to tests for toh-x breaks the tests for toh-y), then the fix is easy:
    • copy-paste shared files to break the coupling between toh-x and toh-y.

Given the tight coupling between the toh parts, by design, I believe that sharing some test infrastructure has more benefits than risks. And essentially what you are asking me to do now is to proactively ditch the DRYness rather than do it down the line if/when it is needed. My 2 cents. Let me know what you think.

@chalin chalin force-pushed the chalin-toh-2-to-4-e2e-0629 branch 4 times, most recently from 6d5fe5b to 8ec4012 Compare July 12, 2016 23:41
@chalin chalin force-pushed the chalin-toh-2-to-4-e2e-0629 branch 2 times, most recently from df6e178 to fad944f Compare July 17, 2016 12:39
@wardbell
Copy link
Contributor

I'm sorry, Patrice, but I'm going to have to insist on the "non-DRY" part. I hate doing that. I hate it more because my instincts align with yours. But that just isn't how ToH is set up.

Observe that the ToH code samples do not share code. They too are far from DRY. Your argument in favor of DRY would apply equally there. And yet we didn't do it. Why?

Because we decided - rightly or wrongly - to insulate each ToH tutorial for its comrades. If we change that, we can change the tests. I don't think we should be DRY in the tests and WET in the code.

We don't have time to revisit that decision now.

I'm sorry. Hate to be heavy handed. Please forgive me.

@chalin
Copy link
Contributor Author

chalin commented Jul 19, 2016

I understand your reasons. Will split this up into two PRs (fixes vs e2e tests) and make the e2e tests independent as you recommend. Thanks for hearing me out.

chalin added 2 commits July 20, 2016 07:59
From the user's perspective toh-2 to -4 all have the same behavior.
This PR introduces e2e tests for all these parts by sharing test suites.

**3 minor bugs** were detected by the tests and are fixed in this PR.

The toh-1 tests introduced in angular#1620 are
- Refactored so as to be easier to reuse for the other parts.
- Rewritten to benefit from the availability of async/await.

Suites passed:
 - public/docs/_examples/toh-1/dart
 - public/docs/_examples/toh-1/ts
 - public/docs/_examples/toh-2/dart
 - public/docs/_examples/toh-2/ts
 - public/docs/_examples/toh-3/dart
 - public/docs/_examples/toh-3/ts
 - public/docs/_examples/toh-4/dart
 - public/docs/_examples/toh-4/ts

Contributes to angular#1619.

Fixes angular#1609.
Now the toh-4 index.html is identical to those of the previous parts.
@chalin chalin force-pushed the chalin-toh-2-to-4-e2e-0629 branch from fad944f to 06b68dc Compare July 20, 2016 14:59
chalin added a commit to IdeaBlade/angular.io that referenced this pull request Jul 20, 2016
Note: tests are identical to those of toh-2.

Contributes to angular#1619.
Supersedes angular#1785.

Suites passed:
- public/docs/_examples/toh-4/dart
- public/docs/_examples/toh-4/ts
@chalin chalin mentioned this pull request Jul 20, 2016
@chalin
Copy link
Contributor Author

chalin commented Jul 20, 2016

Superseded by #1934, #1936, #1938, #1939, #1940.

@chalin chalin closed this Jul 20, 2016
chalin added a commit to IdeaBlade/angular.io that referenced this pull request Jul 20, 2016
Note: tests are identical to those of toh-2.

Contributes to angular#1619.
Supersedes angular#1785.

Suites passed:
- public/docs/_examples/toh-4/dart
- public/docs/_examples/toh-4/ts
wardbell pushed a commit that referenced this pull request Jul 21, 2016
closes #1940
Note: tests are identical to those of toh-2.

Contributes to #1619.
Supersedes #1785.

Suites passed:
- public/docs/_examples/toh-4/dart
- public/docs/_examples/toh-4/ts
@chalin chalin deleted the chalin-toh-2-to-4-e2e-0629 branch July 29, 2016 22:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Dart][example] tutorial/toh-4: styles look wrong
5 participants