Commit Graph

19 Commits

Author SHA1 Message Date
Ryan Shaw e7d9b1150d remove qunitDependencyLoader now that nothing needs it
closes: CNVS-34770

because the previous commit renamed
‘module’ to ‘qunit.module’ in all our specs,
we don’t need this loader anymore

in an effort to get rid of vendor code that is just
copy/pasted into our repo, this also has us use
npm to get qunit, sinon, and AXE.

test plan:
* because this only touches stuff for specs,
  if js specs pass in both webpack and requireJS,
  this should be good.

Change-Id: I1d1cbf187211ad1d04d775fe4469913b3942d74a
Reviewed-on: https://gerrit.instructure.com/101101
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2017-02-10 21:07:45 +00:00
Ryan Shaw 6dc273617d [webpack] don’t do JS Code Coverage on patchset builds
this slows things down quite a bit so we’re going
to not run it on every patchset build and only
run it in a post-merge or nightly build

test plan:
* jenkins webpack build should be faster

Change-Id: I9a2b8da37ac3bc3c2e81ea9c225a51c9ea817435
Reviewed-on: https://gerrit.instructure.com/101706
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-02-10 17:34:20 +00:00
Ryan Shaw 5cc35bd13a don't include chunkhashes in webpack test file names
this will speed it up a tiny bit

test plan:
* webpack js tests should pass

Change-Id: I90b90efa340bc6b5738022c2706ae5887de4aeb3
Reviewed-on: https://gerrit.instructure.com/100645
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
2017-02-07 06:56:52 +00:00
Ryan Shaw 6ca8acffb8 s/module/QUnit.module/ in spec/coffeescripts
closes:  CNVS-34769

this is the result of running this find & replace
(^\s+)(module)(\s[\"\']|\()
\1QUnit.module\3

s/module/qunit.module/ in spec/coffeescripts

and the result of running this find & replace
(^\s+)(module)(\s*\()
\1qunit.module\3

in canvas-lms/spec/javascripts/

test plan:
* automated js specs should pass in requireJS and webpack 

Change-Id: I65188cce4bd5e6e5caa199dc108393a93f400a67
Reviewed-on: https://gerrit.instructure.com/101100
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2017-02-06 15:46:51 +00:00
Clay Diffrient 0ca6f62cb2 Add enzyme testing to Canvas
closes CNVS-33623

Test Plan:
  - Automated tests pass

Change-Id: I0e76082e8dfc2f695717c94819de3999dd23000a
Reviewed-on: https://gerrit.instructure.com/96510
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
2017-01-04 20:21:36 +00:00
Ryan Shaw d9390fb3f1 only load istambul-instrumenter-loader on jenkins or if asked
closes: CNVS-34126

this is so it is easier to debug things in the
browser dev tools for karma tests. Because with it,
it adds a ton of cruft to the files so you don’t
actually see what’s going on.

test plan:
* automated webpack tests should pass
* make a change to a js spec file locally that will cause an error,
* when you see the error in the console, it should show actual filenames
  and line numbers instead of just all being from one webpack.specs.js file

Change-Id: Icbc95541c445041543b6645836e00feb73f16abd
Reviewed-on: https://gerrit.instructure.com/98606
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2017-01-04 18:18:49 +00:00
Ryan Shaw e116bb0d90 Webpack: better handling of chunks and cdn stuff
fixes: CNVS-31779 [webpack] bundle file size
test plan:
* using webpack, look at the network panel in
  the chrome developer console.
* the total ammount of javascript loaded for any
  given page should be much less than before this commit
  and about on par with what requireJS loads for the same page.
* use chrome network panel to throttle to "Regular 3G"
* from both a clean cache and a primed cache:
* make sure that the total time to render the page
  is about on par with requireJS

first change: load webpack chunks from CDN

fixes: CNVS-32261

test plan:
* run `npm run webpack-production`
* check your page, it should load js files and chunks
  from the same hostname the page is served from.
* now set a host: in config/canvas_cdn.yml
  (for testing locally, I just set it to http://127.0.0.1:3000,
* restart rails and reload the page, now the scripts and
  chucks should come from that new hostname

second change:include fingerprints in webpack bundle and chunk filenames

closes: CNVS-28628

with this change we don't need to run `gulp rev`
after running webpack and we can load both the bundle
and chunk files safely from the cdn, since they will
have content-based fingerprints so we can tell
browsers to cache them forever. (we set those
http caching headers in lib/canvas/cdn/s3_uploader.rb:53)

test plan:
* for both dev and production
* run `npm run webpack` (or `npm run wepack-production`)
* with a cdn configured in canvas_cdn.yml, run:
  RAILS_ENV=<dev or prod> bundle exec rake canvas:cdn:upload_to_s3
* check to make sure that the page loads the webpack js,
  that there are no errors, and it all came from the cdn

third change: properly handle moment locale & timezone in webpack

test plan:
 (see application_helper_spec.rb)
 * set a non-default user timezone, context timezone
   and locale
* dates should show up in your timezone and and
  the date helper strings should be in your language

better handling of moment custom locales

closes: CNVS-33811

since we now have hatian and maori, we need to do this in
a way that is not just a one-off for maori

test plan:
* set your locale to maori
* in webpack & requireJS make sure dates show up right

Change-Id: I34dbff7d46a1047f9b459d5e1c0d141f435d42fb
Reviewed-on: https://gerrit.instructure.com/95737
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2017-01-03 22:50:31 +00:00
Derek Bender b64afd7a1d duplicate gradebook view hierarchy
This patchset duplicates the gradebook view hierarchy so that we can
develop gradebook enhancements side by side with the current gradebook.
A feature flag has been created called "Gradezilla" (this name is for
internal purposes only and should never be used in production) that is
only allowed in development and defaults to on. With this feature flage
enabled a button now appears next to the "individual view" button in
gradebook to navigate to Gradezilla. The page also has a header of
"Gradezilla" as to further distinguish the page since they look
identical at the start of this project.

In the future, we'll replace Gradezilla with something else but while in
development we wanted an easy term to search for to know which part of
the gradebook we were in.

closes: CNVS-33684

Listed below are the paths for which a corresponding gradezilla file was
created. See the git diff for full details.

app/coffeescripts/bundles/gradebook.coffee
app/coffeescripts/gradebook/*.coffee
app/coffeescripts/views/gradebook/*.coffee
app/jsx/gradebook/*.jsx
app/stylesheets/bundles/gradebook.scss
app/stylesheets/pages/gradebook/*.scss
app/views/gradebooks/gradezilla.html.erb
app/views/jst/gradebook/*.handlebars
spec/coffeescripts/gradebook/*.coffee
spec/coffeescripts/jsx/gradebook/*.coffee
spec/javascripts/jsx/gradebook/*.jsx
spec/selenium/grades/gradebook/*.rb
spec/selenium/outcomes/outcome_gradebook_spec.rb
spec/selenium/helpers/gradebook_common.rb
spec/selenium/grades/page_objects/gradebook_page.rb
spec/selenium/grades/setup/gradebook_setup.rb
spec/views/gradebooks/gradebook.html.erb_spec.rb

Test plan:
 - Ensure that the feature flag for Gradezilla is enabled
 - On the Gradebook page, there is now a button to take you to
 Gradezilla
 - Once selected, Gradezilla should become your default Gradebook until
 the "Gradebook" button is clicked.
 - Everything in Gradezilla should appear just as it does in Gradebook.
 - Having selected Gradezilla, disabled the feature flag
 - Ensure that upon returning to /gradebook, that the current Gradebook
   is selected
 - If the feature is disabled, you should not see the Gradezilla button.

Change-Id: I6f1391a4264a8d0e6016a9a91f8055010f1c36d1
Reviewed-on: https://gerrit.instructure.com/98498
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Shahbaz Javeed <sjaveed@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-12-28 22:35:04 +00:00
Jeremy Neander 4c6d3a6601 support requiring spec files into other spec files
Spec helper files are very useful, but are not supported via absolute
path requires.

test plan:
* ensure tests pass all builds

Change-Id: Ibdbe6939d95c77cd5149ab874189011d0e3d4aab
Reviewed-on: https://gerrit.instructure.com/96930
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Jeremy Neander <jneander@instructure.com>
QA-Review: Jeremy Neander <jneander@instructure.com>
2016-12-07 15:18:54 +00:00
Felix Milea-Ciobanu 61218a3e8a fix running all js specs
test plan:
- builds pass?

Change-Id: I504b632bf8dfd3024bb1d8529bcc9c894bd2c12d
Reviewed-on: https://gerrit.instructure.com/96390
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-11-30 22:01:17 +00:00
Felix Milea-Ciobanu 03e93802fb add npm script that can run specific js specs
example usage: `npm run jspec spec/javascripts/jsx/files`

refs CNVS-33223

test plan:
- current webpack test build should work exactly the same
- `npm run jspec` should build + run all specs
- `npm run jspec path/to/stuff` should build + run only specified
 specs
- should work with both directories and individual files
- `jspec-watch` should watch + build a path, but not run specs

Change-Id: I788dd38a6c69a4c36a1300fcecf43678bc7f5327
Reviewed-on: https://gerrit.instructure.com/94625
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Product-Review: Felix Milea-Ciobanu <fmileaciobanu@instructure.com>
QA-Review: Felix Milea-Ciobanu <fmileaciobanu@instructure.com>
2016-11-30 18:37:23 +00:00
Ryan Shaw 64218182cd don't pass frontend build files through babel
since we're on node 6.6 now, we don't need
babel for anything we were using it for in our
frontend build/webpack code that runs on node.
(except for es6 import/export)

Change-Id: I41352fdc8adb06fe1585565f63d808d249f92864
Reviewed-on: https://gerrit.instructure.com/91573
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2016-11-08 20:29:29 +00:00
Ryan Shaw ad34b40c32 make it so you can use es6 in the webpack config stuff
refs: CNVS-27679

if you name your config files *.config.babel.js
webpack knows to run them through babel. this change
makes it so use es6 stuff in the webpack.config files
(including everything in /frontend_build)

test plan:
run webpack
it should work

Change-Id: I6ceda3386227c30e106339f744f18dc61bbab54b
Reviewed-on: https://gerrit.instructure.com/73241
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2016-03-11 21:18:43 +00:00
Ethan Vizitei d32465ecd5 make web pack specs pick up jsx specs
closes CNVS-27835

TEST PLAN:
  1) aux builds should pass

Change-Id: I882c89fba1240037bbda11f321a5afd85e854ced
Reviewed-on: https://gerrit.instructure.com/73971
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2016-03-08 19:08:14 +00:00
Jennifer Stern 337a882536 Add automated a11y testing helper for qunit tests
refs SD-743
fixes CNVS-26721

This adds a qunit assertion helper that wraps the aXe library. Rules can
be ignored by passing an array of rules in the options argument to the
helper.

e.g.
`assertions.isAccessible $html, done, { ignores: 'aria-valid-attr-value'}`

Test plan:

Undo the changes that I made to the DashboardCard.jsx component.
You should get a warning about invalid aria attributes because the
aria-controls attribute is referring to an element that doesn't exist.

To fix this, I modified the component to hide/show the color picker so that
the aria attribute value is valid.

If you add the ignores option as described above, the test should pass
without my changes.

To verify the dashboard card color picker changes:

- Verify that you can click or use the ENTER key on a dashboard card
cog button to bring up the color picker
- Verify that you can select a color and apply it to the card.
- Verify that you can click outside the color picker to close it
- Verify that you can hit the ESC key to close the color picker
- When the color picker is closed, focus should return to the the cog
button trigger
- After selecting a color you should be able to open the color picker again
and select a different color

The color picker in the Calendar should be regression tested as well.

Change-Id: I5d5bfdaf39df1e0cb8776144771baeb1ed31ff2a
Reviewed-on: https://gerrit.instructure.com/70638
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Tested-by: Jenkins
2016-02-02 17:39:11 +00:00
Ethan Vizitei 0a66b7f42a make web pack able to run ember quit
closes CNVS-25792

TEST PLAN: jenkins web pack should get better

Change-Id: Ie2187d069cfd6d055c425038dba24637bf0ded3f
Reviewed-on: https://gerrit.instructure.com/68724
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Tested-by: Jenkins
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2015-12-11 17:07:10 +00:00
Ethan Vizitei 765507f63e several things to help webpack compile speed
closes CNVS-25714

TEST PLAN:
web pack should compile in like 60 seconds rather than 600

Change-Id: I74716d9cccfd0253693660c0b4ad4368e91b72e7
Reviewed-on: https://gerrit.instructure.com/68497
Tested-by: Jenkins
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2015-12-09 19:25:30 +00:00
Simon Williams a1e7f57c56 webpack tests
closes CNVS-24966

change js specs to work with web pack.
update some dependency references, make some aliases
for external dependencies to get the right version,
and clean up a bunch of leaky state.

TEST PLAN:
js tests should pass in web pack _and_ requires

Change-Id: If37fbce93e7e67021d90bacb470ffc4f1b17402d
Reviewed-on: https://gerrit.instructure.com/66309
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-11-24 18:40:58 +00:00
Ethan Vizitei d7f61d1820 use web pack
closes CNVS-24124

makes working with web pack possible in canvas
instead of require-js.  See doc/working_with_webpack.md
for instructions.

TEST PLAN:
Nothing should change in non-webpack'd behavior
Things should mostly work when you use the
USE_WEBPACK environment variable, but make sure to document
and ticket things that don't

Change-Id: I493a259a609e9e183950bc57aa5876df70108547
Reviewed-on: https://gerrit.instructure.com/64386
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2015-11-02 16:27:14 +00:00