Skip to content
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

CP-2272 Implemented task that allows a user to run browser based dart unit tests on saucelabs #148

Merged
merged 6 commits into from
Sep 22, 2016

Conversation

jayudey-wf
Copy link
Contributor

Issue

  • There was no clear path that would allow a user to run their browser based unit tests across multiple browser configurations

Changes

Source:

Tests:

  • n/a (there is no real clear way to test this)

Areas of Regression

  • n/a (separate task)

Testing

  • Install into a project with browser based tests and verify that browser tests can be run on saucelabs

Code Review

@trentgrover-wf
@maxwellpeterson-wf
@evanweible-wf
@dustinlessard-wf

@@ -26,6 +26,7 @@ development requirements:
- Documentation generation
- Examples for manual testing/exploration
- Applying a LICENSE file to all source files
- Running dart unit tests on saucelabs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#nit

s/saucelabs/Sauce Labs

@greglittlefield-wf
Copy link
Contributor

Done with first pass. So glad to have this functionality in a common place!

@dustinlessard-wf
Copy link

I want this now! This is going to be awesome!

@codecov-io
Copy link

codecov-io commented Apr 8, 2016

Current coverage is 23.56% (diff: 100%)

Merging #148 into master will not change coverage

@@             master       #148   diff @@
==========================================
  Files             7          7          
  Lines           157        157          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits             37         37          
  Misses          120        120          
  Partials          0          0          

Powered by Codecov. Last update a2748c8...8ead89a

@rmconsole2-wf
Copy link
Contributor

@jayudey-wf This pull request has merge conflicts, please resolve.

@jayudey-wf jayudey-wf force-pushed the saucelab_tests_task branch 2 times, most recently from a6bcdf4 to 18a6355 Compare April 15, 2016 15:30
@jayudey-wf
Copy link
Contributor Author

@greglittlefield-wf this is ready for re-review

@greglittlefield-wf
Copy link
Contributor

@jayudey-wf Sorry that this fell off my radar! Looks great.

+1

@dustinlessard-wf
Copy link

+1 Let's do this!

@trentgrover-wf
Copy link
Contributor

+1 - let's get this moving

  • 1 random thought I had: would anyone be opposed to making the command just saucelabs instead of saucelabs-tests? It's possible in the future that we would have multiple saucelabs related tasks / configurations that we could root here

@dustinlessard-wf
Copy link

+1 to this change
+1 to naming it simply 'saucelabs'
+1 to a passing ci

' please review the output above and the test report located at'
' ${config.saucelabsTests.testReportPath}.');
} else {
return new CliResult.success('Success, your tests completely successfully'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*completed

@evanweible-wf
Copy link
Contributor

I agree with the change to the shorter saucelabs

@rmconsole-wf
Copy link
Contributor

@jayudey-wf This pull request has merge conflicts, please resolve.

@evanweible-wf
Copy link
Contributor

evanweible-wf commented May 12, 2016

QA

Manual Testing

  • task fails and warns about sauce credentials when they are missing
  • task fails and warns when missing files to test
  • task fails and warns when the file to test is not an HTML file
    • It would be nice if it could automatically generate an HTML file like the test task does
  • task successfully runs tests on saucelabs
    • The tests to run and complete on saucelabs, but I see the following issues:

      • I'm seeing this in the dart2js logs:
      [Warning from Dart2JS]:
      test/integration/browser_integration_test.dart.sauce_browser_test.dart:44:11:
      'SauceBrowserEnvironment' doesn't implement the getter 'supportsDebugging' declared in 'Environment'.
      Try adding an implementation of 'supportsDebugging' or declaring 'SauceBrowserEnvironment' to be 'abstract'.
                class SauceBrowserEnvironment implements Environment {
                ^^^^^
      
      • saw this during the shutdown:
      Error quitting driver: InvalidRequestException (404): ERROR The test with session id 49dacf525c3c4e4cb0412488d579ae6d has already finished, and can't receive further commands.
      You can learn more at https://saucelabs.com/jobs/49dacf525c3c4e4cb0412488d579ae6d
      For help, please check https://docs.saucelabs.com/reference/troubleshooting-common-error-messages
      
      • at the end, the task RTE'd with this:
      Unhandled exception:
      The null object does not have a method '[]'.
      
      NoSuchMethodError: method not found: '[]'
      Receiver: null
      Arguments: ["failed"]
      #0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
      #1      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
      #2      SauceRunnerCli.run.<run_async_body> (package:dart_dev/src/tasks/saucelabs/cli.dart:81:43)
      #3      _RootZone.runUnary (dart:async/zone.dart:1137)
      #4      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:553)
      #5      _Future._propagateToListeners (dart:async/future_impl.dart:639)
      #6      _Future._complete (dart:async/future_impl.dart:416)
      #7      _SyncCompleter.complete (dart:async/future_impl.dart:52)
      #8      run.<run_async_body> (package:dart_dev/src/tasks/saucelabs/sauce_runner.dart:126:5)
      #9      _RootZone.runUnary (dart:async/zone.dart:1137)
      #10     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:553)
      #11     _Future._propagateToListeners (dart:async/future_impl.dart:639)
      #12     _Future._completeWithValue (dart:async/future_impl.dart:426)
      #13     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:481)
      #14     _microtaskLoop (dart:async/schedule_microtask.dart:41)
      #15     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
      #16     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
      #17     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)
      
      • additionally, the tests are not showing is saucelabs up as successful/failed after completing
      screen shot 2016-05-12 at 3 46 51 pm

      this can be a future improvement (see CP-2118 Report build status to Sauce Labs #154)

Manual CI

  • ddev format
  • ddev analyze
  • ddev test --integration

@evanweible-wf
Copy link
Contributor

@jayudey-wf once you resolve merge conflicts, I'll put my QA stamp on it.

@evanweible-wf
Copy link
Contributor

@jayudey-wf actually, I just found one issue. The sauceConnectTunnelIdentifier config option doesn't work - when you set it, the task fails with this:

Starting tests...
Failure starting Chrome on Windows - saucelabs_test.html (null).
UnknownException (13): Sauce could not start your job. For more information on what happened, please visit https://saucelabs.com/jobs/d285b29ffb9f473796d4dac26587bcf2

Waiting for tests to complete... (See https://saucelabs.com/tests for overall status.)
Error quitting driver: The null object does not have a method 'then'.

NoSuchMethodError: method not found: 'then'
Receiver: null
Arguments: [Closure: (dynamic) => dynamic]
- Finished: Chrome on Windows - saucelabs_test.html (null)

Test Results:
- Chrome on Windows - saucelabs_test.html: test error

Cleaning up...
- Shutting down Pub server...
Unhandled exception:
The null object does not have a method '[]'.

NoSuchMethodError: method not found: '[]'
Receiver: null
Arguments: ["failed"]
#0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
#1      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#2      SauceRunnerCli.run.<run_async_body> (package:dart_dev/src/tasks/saucelabs/cli.dart:81:43)
#3      _RootZone.runUnary (dart:async/zone.dart:1137)
#4      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:553)
#5      _Future._propagateToListeners (dart:async/future_impl.dart:639)
#6      _Future._complete (dart:async/future_impl.dart:416)
#7      _SyncCompleter.complete (dart:async/future_impl.dart:52)
#8      run.<run_async_body> (package:dart_dev/src/tasks/saucelabs/sauce_runner.dart:126:5)
#9      _RootZone.runUnary (dart:async/zone.dart:1137)
#10     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:553)
#11     _Future._propagateToListeners (dart:async/future_impl.dart:639)
#12     _Future._completeWithValue (dart:async/future_impl.dart:426)
#13     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:481)
#14     _microtaskLoop (dart:async/schedule_microtask.dart:41)
#15     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
#16     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#17     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)

@evanweible-wf
Copy link
Contributor

Also, as a side note, the requirement of a transformer means that this task can't be used by any projects that are also a dependency of dart_dev. That's fairly low risk, I just happened to run into it trying to test this out with fluri, but since dart_dev now depends on fluri, there's a circular dependency. Normally that's fine, but with transformers it's not allowed.

@evanweible-wf evanweible-wf modified the milestone: 1.3.0 Jun 10, 2016
@evanweible-wf
Copy link
Contributor

@rmconsole-wf

@trentgrover-wf
Copy link
Contributor

+1

@trentgrover-wf trentgrover-wf changed the title Implemented task that allows a user to run browser based dart unit tests on saucelabs CP-2272 Implemented task that allows a user to run browser based dart unit tests on saucelabs Aug 1, 2016
@rmconsole-wf
Copy link
Contributor

@jayudey-wf This pull request has merge conflicts, please resolve.

greglittlefield-wf and others added 4 commits September 21, 2016 11:42
- updated documentation
- renamed saucelabs-tests to saucelabs
- utilized TaskProcess
- reducing default browser config
- added implementation of supportsDebugging
- updating logic around using existing sauce tunnels and tunnel identifiers
- better error handling when a test errors on sauce labs
Future<CliResult> run(ArgResults parsedArgs, {bool color: true}) async {
if (sauceUserName == null || sauceAccessKey == null) {
return new CliResult.fail('Sauce Labs credentials must be available via '
'the `SAUCE_ACCESS_KEY` and `SAUCE_USERNAME` SauceRunnerConfig instance.');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message is confusing - it sounds like the key and username should be available on an instance of some Dart object, but it is actually looking for them from the shell environment via dart:io.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed ^

@maxwellpeterson-wf
Copy link
Member

QA +10

  • task fails and warns about sauce credentials when they are missing
  • task fails and warns when missing files to test
  • task fails and warns when the file to test is not an HTML file
    • it would be nice if the task could generate a default HTML file if a .dart file is given
    • currently this failure results in an uncaught exception and the stack trace gets printed to the console - it would be better to just print the error and exit early
  • task successfully runs tests on saucelabs
    • w_session tests passed with the default configuration of just Chrome
    • w_session tests passed with a custom set of platforms (firefox + IE11)

@evanweible-wf
Copy link
Contributor

+1 to the last commit

@maxwellpeterson-wf
Copy link
Member

+10

  • see previous comment

@trentgrover-wf
Copy link
Contributor

+1

@trentgrover-wf trentgrover-wf merged commit 76d2cd0 into master Sep 22, 2016
@maxwellpeterson-wf maxwellpeterson-wf deleted the saucelab_tests_task branch September 22, 2016 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants