Commit Graph

45 Commits

Author SHA1 Message Date
Bobby Buten 93c6b2a79e remove coverage skip for deleted test
refs DE-989
flag=none

TEST PLAN:
  confirm build still completes and coverage builds

Change-Id: I4a75704de82668445c75484bdda187ff8f585608
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/288472
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Bobby Buten <bobby.buten@instructure.com>
Product-Review: Bobby Buten <bobby.buten@instructure.com>
2022-03-30 12:24:46 +00:00
Bobby Buten 6c56e38559 add jest coverage in js coverage report
refs DE-989
flag=none

TEST PLAN:
  confirm https://code-coverage.inseng.net/ is updated with new report

Previous versions of the JS coverage report we not including jest
tests, so this tweak adds them

Change-Id: Ic780ab9df0ab97eaf3d49cda5c6dbc8cebbb7607
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/288044
Reviewed-by: James Butters <jbutters@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Bobby Buten <bobby.buten@instructure.com>
Product-Review: Bobby Buten <bobby.buten@instructure.com>
2022-03-29 19:50:14 +00:00
Bobby Buten 92e1839e88 optimize javascript build times
refs DE-1070
flag=none

TEST PLAN:
  Confirm build still runs
  Compare build times of pre/post changes

Change-Id: I9364314b8e5f99ea8f29cc69c0f711bf959c8fa3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286171
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Bobby Buten <bobby.buten@instructure.com>
Product-Review: Bobby Buten <bobby.buten@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
2022-03-23 16:22:04 +00:00
Brian Watson cae55d4611 Identify JS and Ruby skipped specs
flag=none
Test-plan:
- manually run ruby coverage / js coverage / axe builds
- ensure artifacts are updated in s3

Change-Id: I2bd4e51eedecf5a10e5d96bdc8727abb17bac034
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286063
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
Reviewed-by: James Butters <jbutters@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Brian Watson <bwatson@instructure.com>
2022-03-18 16:57:43 +00:00
Ahmad Amireh 677f0e06a2 clean up i18n! stragglers
refs FOO-2696
flag = none

jest needs to explicitly load the _core_en translation file since its
i18nTransformer is no longer a thing (and it's what was doing that
before)

otherwise, this just cleans up the remaining references to i18n! in the
code, aside of eslintrc which we'll address in FOO-2738

Change-Id: Ie0a74b46c4d0a48188ba86765b46b2793eed94d7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/286763
Tested-by: James Butters <jbutters@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2022-03-10 21:38:19 +00:00
Ahmad Amireh 901fffe9ef babel independence(3): jest
refs FOO-2697
flag = none

on "babel-plugin-transform-imports": the behavior of this plugin was
surprising to me in that it not only rewrote the specifiers to point to
the CommonJS instead of the ESM variants, but it actually changed the
specifiers to point to the exact file that exports the symbol through a
mixture of fs globbing and guesses.

Consider the following import:

    import { DateTime } from '@instructure/ui-i18n'

Normally, you'd think we'll be loading the {main,module,browser} file of
the @instructure/ui-i18n package and refer to the `DateTime` symbol
exported by that file. With the plugin activated, however, the import
*itself* changes to:

    import DateTime from '@instructure/ui-i18n/lib/DateTime.js'

This is no longer merely a variant rewrite in any way as we're no longer
loading the same file. This caused new problems to surface that up to
this point were not encountered, as now we're actually loading the
entrypoints as specified.

An example of this is in that specific package where it (its entrypoint)
loads a package `decimal.js` whose ESM variant doesn't work as-is but
its CJS variant does -- something neither we nor the InstUI team were
privy to as the plugin was simply clobbering this piece of information.

~ test plan ~

- jest suite runs and passes

Change-Id: I55d7db1ede742e0f588a84d54a761b7aba03729f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283543
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
QA-Review: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2022-02-09 17:20:24 +00:00
Weston Dransfield bdb74d5404 Detect B&I on File upload
refs MAT-364
flag=rce_buttons_and_icons

This commit causes the File upload UI to tag button and icons
that are uploaded as button and icons.

Note that this change does not yet apply the correct cateagory
if an image is uploaded via the "documents" tool in RCE

Test Plan:

Note that this test plan involves a fair amount of regression
testing because this change touches the upload code used in
/files

1. Rebuild canvas-rce JS and canvas-lms webpack. Run DB
   migrations if it's been a bit
2. Make sure you've pulled down the latest canvas-rce-api
   code and have it running
3. Enable buttons & icons in if you've not already
4. Create a button & icon
6. Navigate to to the course files and download the
   buton and icon to your computer
7. Delete the button and icon from the "Buttons and Icons"
   folder in the course files
8. In an RCE in the same course, open the "saved buttons & icons"
   tray. Note that the button & icon you previously downloaded
   and deleted is not listed.
9. Navigte to course files and create a new folder. It can
   be named anything, just make sure not to nest it in the
   "Buttons and Icons" folder.
10. Upload the image downloaded in step 6 into the new
    folder
11. Navigate to an RCE and open the "saved buttons & icons"
    tray
12. validate the image you uploaded in step 10 is listed \o/
13. Verify you can upload non-images to course files still
14. Verify you can upload a zipped file to course files still.
    This should give the option of unzipping or leaving zipped.
    make sure both paths work
15. Upload a file and then attempt to upload the same file. This
    should result in a collision of names. Verify you can choose
    the option to replace the file with success. Do the same thing
    again, but verify you can rename the file with success
16. Verify you can upload files in batches with success

Change-Id: I0fc0ffa45f5b4757a347ebe631461eb3e00bb25e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284085
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob DeWar <jacob.dewar@instructure.com>
QA-Review: Jacob DeWar <jacob.dewar@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2022-02-03 22:15:25 +00:00
Jeff Largent c01113638b Initial pace plans import
This change brings in the basic pace plans frontend with
styled-components and several other smaller libraries replaced with
InstUI 7 components. It also adds the 'reselect' library as a direct
dependency (which we already had through @instructure/outcomes-ui) and
'tsc-files' for type-checking of staged TS files on commit. There were
also some tweaks to typescript and eslint configs, mostly to get both
up to speed with the typescript code.

Finally, this also adds a `pace_plans` endpoint to
`courses_controller` to bootstrap the frontend-- this will get moved
to `pace_plans_controller` once it has been merged.

It's also worth noting that no frontend tests are included with this
change-- the existing tests were written with enzyme and are heavily
snapshot-based, so we will be replacing those with
@testing-library/react tests in later updates (in keeping with current
testing best practices at Instructure).

closes LS-2431, LS-2432, LS-2433, LS-2434, LS-2452
flag = pace_plans

Test plan:
  - Set up a course with at least one module and several module items
  - Turn on the pace_plans feature flag in the account associated with
    that course
  - Turn on the "Enable pace plans" setting in course settings
  - Create a pace plan for the course via the Rails console:
    c = Course.find<id>
    pp = c.pace_plans.create! workflow_state: 'active'
    c.context_module_tags.each_with_index do |t, i|
      pp.pace_plan_module_items.create! module_item: t, duration: i*2
    end

  - Go to the course as a teacher or admin
  - Expect to see a "Pace Plans" link in the course navigation
  - Click it, expect the pace plan you created earlier to load and
    render
  - Expect to be able to pick dates, change durations, and toggle
    checkboxes (although saves will fail, since there is no API yet).

  - Expect to not see the "Pace Plans" course nav link when the feature
    flag or course setting is off
  - Expect /courses/<id>/pace_plans to return a 404 when the feature
    flag or course setting is off
  - Expect to not see the "Pace Plans" course nav link as a student
  - Expect /courses/<id>/pace_plans to display an "Unauthorized" page
    as a student

Change-Id: If4dc5d17f2c6a2109d4b4cb652c9e9ef00d7cc33
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271650
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
Product-Review: Jeff Largent <jeff.largent@instructure.com>
2021-09-01 19:58:33 +00:00
Jeff Largent 4fe9f01972 Add typescript support
This change adds support for typescript transpilation to our frontend
build via babel, and also updates eslint and canvas_i18nliner to be
able to understand typescript as well. The main goal of this PS is to
enable developers to add typescript code to the Canvas codebase but to
be unopinionated about how type-checking is done; at this stage types
will only be checked by running the new `check:ts` or `check:js`
scripts (which run the typescript compiler directly), or via
integration with an IDE like RubyMine or VS Code.

closes LS-2430
flag = none

Test plan:
  BUILD STEPS:
  - FE build, i18n build, and tests pass Jenkins
  - `bin/rails canvas:compile_assets` still works
  - `RAILS_ENV=production bin/rails convas:compile_assets` still works

  SPOT CHECKING:
  - Starting up rails and run `yarn build:js:watch`
  - Click around Canvas and make sure the frontend still loads as
    normal

Change-Id: I8bb1a0f065e09496a924708dead6fa4518b59496
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270401
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Jeff Largent <jeff.largent@instructure.com>
2021-08-18 18:21:17 +00:00
Ahmad Amireh 83e4f6d4ab extract date-time-moment-parser
refs FOO-1891

this is the start of a series to break apart the inter-dependencies
between timezone and moment.js

the formatting that is done by moment now stands alone in
packages/date-time-moment-parser and is used by ui/shared/timezone. The
formatter depends on phrases coming from the locale files, which are
available to ui/* but not to packages/*, so in an initializer we inject
our custom formats into the package, allowing it to make use of them.

there should be no breaking API changes, even though several APIs were
dropped, as they were all used in test but not in the app code. To
minimize the changes, a specHelpers.js file is now provided by the
timezone package that maintains backwards compat to a reasonable extent.

TEST PLAN
==== ====

although the tests should be covering this, it wouldn't hurt to manually
exercise any of the date picker widgets

Change-Id: I0c59ad2df8f7392425debb6ec448ec1b4fb029c6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265313
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
2021-08-05 21:53:25 +00:00
Ed Schiebel 04fe2556c3 Reorganize some of the CanvasRce properties
closes MAT-328
flag=rce_enhancements

It was very confusing having 2 components named CanvasRce, so
the one in the canvas-rce package was renamed to simply RCE.

That the props for menu, toolbar, and plugins were not consistent
between canvas' CanvasRce and the RCE's CanvasRce was a source
of confusion (and just wrong). This moves them into the editorOptions
property where are all the way through the component hierarchy.

test plan:
  - from the canvas-rce directory run yarn demo:dev
  > expect the custom toolbar and menu options to work
  > expect the readonly prop to work (something was broken there too)

  - enable the site_admin feature "Assignment Enhancements - Student"
  - create a text entry assignment
  - as a student, go to the assignment and submit you work
  > expect the page to work like before

Change-Id: I982c7c54750e7a3d9e230e0ab6d16bd078ce9030
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268505
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-07-10 13:23:49 +00:00
Jeffrey Johnson 6ad16025b6 DiscussionRCE Plugin Hookup and MentionDropdown
refs VICE-1683

Test Plan
1. Build and compile all JS assets
2. Launch Canvas
3. Make sure Discussion Redesign FF is enabled
4. Navigate to discussions and observe the dev console
5. Should be able to tell mentions loaded from console
6. Should see console message when @ key is pressed inside discussions

Change-Id: I08b722d05885cb98c83f57620f5b7ea67fd05f54
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268574
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Matthew Lemon <mlemon@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2021-07-07 20:10:34 +00:00
Ed Schiebel c7af7b7e02 Necessary tweaks I discovered adding the CanvasRce component to a page
closes MAT-277
flag=rce_enhancements

Factored these changes out of the changes I had to make for MAT-253 where
the CanvasRce component was put on a real page and tested.

1. update jest.config.js to mock the tinymce-react Editor component
2. add a missing dependency to package.json
3. tweak tests to use the new mock
4. use safe-dereference operator in places where specs might
   not have a fully formed ENV

test plan:
  - this is a tough one. It has to pass jenkins, but beyond
    that it will take the changes for MAT-253 to prove these
    changes do all we need

Change-Id: I5804d1a1f13dbfbc21a3213db92d7afe74e576e6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/267427
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Gary Mei <gmei@instructure.com>
QA-Review: Gary Mei <gmei@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2021-06-22 21:11:02 +00:00
Aaron Ogata 55442143fd align all JS output directories to single directory on Jenkins
refs DE-687

As part of our work on EKS, we need to align the EC2 / EKS paths to pull artifacts from the same path on the container and host. As a step towards that, ensure that all containers output their test files to the same directory.

Change-Id: I312fb5f8505122c68ba5aaba30730aa5c1887177
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265370
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2021-05-20 17:28:03 +00:00
Ahmad Amireh 4243097b21 rename some things
fixes FOO-1265

[skip-eslint=true]
[pin-commit-analytics=7e49eefd7f59cbf43fd03bf8957bbbfa76f8d9d5]
[pin-commit-demo_site=adade2e38e46a358a4643cd3db2fe5ccffe39ec5]
[pin-commit-instructure_misc_plugin=47a3161102b0611af56d134fbd0c828ddc1b8abf]
[pin-commit-migration_tool=0dbac2f5b421d894395605ce4b583ef0f7d60b22]
[pin-commit-multiple_root_accounts=cc96d28c0d59bbe47acc64de4fdd8e1d2b029805]

Change-Id: I14c07f20bd260cf0de1f48ceb70b3c2313edf2d2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258807
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-04-06 01:12:49 +00:00
Pat Renner b10df2ba65 hide the file drop zone unless the user can manage files
closes OUT-4223
flag=files_dnd

test-plan:
- enable the flag at the root account level
- within a course, upload a file using the file drop zone
and create a folder
- view the course as a student
- view the folder you just created
- verify that you don't see the FileDrop billboard
on the page or when you try to drag something into the
file area

Change-Id: Ic744842781274c0d8e68a774fdce8b27e07b77ff
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258213
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Brewer-Davis <mbd@instructure.com>
Reviewed-by: Augusto Callejas <acallejas@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2021-02-08 22:19:55 +00:00
Michael Brewer-Davis addd35f280 add conference ui to calendar details page
refs CAL-4
flag=calendar_conferences

Test plan:
- enable FF "Add Conferences from Calendar"
  and "Allow Conference Selection..."
- enable BigBlueButton with dummy settings at
  /plugins/big_blue_button
- create two courses, one with multiple sections
- add LTI tool for conference selection to one course
- open add calendar event dialog at /calendar
- switch context to one of the courses
- verify that conferencing options appear (two options
  if in course with LTI; one option otherwise)
- click more options to open detailed edit page
- verify that conferencing options appear the same
  way
- add a conference
- save the conference
- verify that conference appears on the calendar
- repeat in the other context to verify other select UI
- add a conference before clicking "more options" and
  verify that it is included in the more options page
- verfy that updating the conference and then cancelling
  on the more options page does not save the update
- in the course with multiple sections, select "use a different
  date for each section"
- verify that the conference for the parent event is shown
  for each of the child events in the calendar
- verify that the conference can't be edited from the child events
- verify that updating the parent event conference from the More
  Details page also updates the child events (as seen in
  the calendar)

Change-Id: I9a7dccc9962d3c056f6a6a5fdb8a501ce8960c18
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/235298
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ken McGrady <kmcgrady@instructure.com>
QA-Review: Steve Shepherd <sshepherd@instructure.com>
Product-Review: Michael Brewer-Davis <mbd@instructure.com>
2020-04-30 18:06:11 +00:00
Landon Gilbert-Bland a30dc6e1b2 Allow running jest tests from plugins
Test Plan:
  - Jenkins passes when a successful test exists in gems/plugins
  - Jenkins fails when a failure test exists in gems/plugins

refs USERS-28

flag = none

Change-Id: I295fdaa5b89ed32dfa89418b86a19e28b2071154
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/219040
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Landon Gilbert-Bland <lbland@instructure.com>
Product-Review: Landon Gilbert-Bland <lbland@instructure.com>
2019-12-03 16:55:17 +00:00
Ryan Shaw 9d54094803 upgrade @testing-library npm deps
Change-Id: I5438f3895173d4b2b417835c6ac937dc65d160d3
Reviewed-on: https://gerrit.instructure.com/205774
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-08-27 14:49:48 +00:00
Clint Furse 8d9dc9c06d add postMessage listener to launch tool in new win
closes PLAT-4791

Test Plan:
- Launch a tool that is setup to require a cookie and
  will send the required postMessage
- Verify that a new window opens and the cookie is set
  correctly

Change-Id: I9eb17c219dfce2da060e82829a19c0e24504b406
Reviewed-on: https://gerrit.instructure.com/205712
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2019-08-23 16:12:14 +00:00
Jon Willesen bd060bc291 start of direct share course selection tray
This includes some general utilities

Note: There is a bug in the instui Tray that mounts the contents of the
Tray twice, which results in multiple fetches for the managed courses.
We're going to ignore this for now since the right fix is to fix Tray
and not work around it.

flag=direct_share
refs ADMIN-2811

test plan:
- On the discussions index page, click on the kabob menu for a
  discussion and choose "Copy To...".
- A tray should open and load a list of the courses you are allowed to
  manage. There is no other functionality in the tray yet.

Change-Id: Ic0f5e841f61cd3cdaef7b681db2907089c561665
Reviewed-on: https://gerrit.instructure.com/204331
Tested-by: Jenkins
QA-Review: Carl Kibler <ckibler@instructure.com>
Product-Review: Jon Willesen <jonw+gerrit@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
2019-08-20 16:05:09 +00:00
Ryan Shaw 10a4516082 Use jsdom 14 instead of 11 in jest tests
Test plan:
* `yarn jest` should pass

Change-Id: I157a55be009bae71e574ed0e9b9ff18f9e2c048b
Reviewed-on: https://gerrit.instructure.com/203860
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-08-05 20:36:16 +00:00
Ryan Shaw 8ae3033745 Update testing-library to use packages w/ @scoped names
See: 
github.com/testing-library/dom-testing-library/releases/tag/v4.0.0
For the reason behind why the specs had to change to findAllByText

Test plan:
* js tests should pass

Change-Id: Idc5b217a0923cf7d702f94dfd4f3393beaa14a19
Reviewed-on: https://gerrit.instructure.com/202009
Tested-by: Jenkins
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-07-22 16:26:15 +00:00
Ryan Shaw 772d1f6994 don’t count unread_count or dashcard indicators against newRelic load time
closes: CORE-3187

AKA:
Revert "Revert "don’t count unread_count or dashcard indicators 
against newRelic load time""

This reverts commit d754ff5ed1.

Test plan:
* the little badges that show unread discussion counts and stuff
  on each dashcard should work the same as before
* the badge on the global nav that shows how many unread inbox messages
  You have should work the same as before
  * if you have newRelic set up, neither should count against page load
  metrics

Change-Id: I3b869e7fb650f40f16f514db9d8b9f558443db5b
Reviewed-on: https://gerrit.instructure.com/201202
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-07-16 20:38:06 +00:00
gbeckmann d754ff5ed1 Revert "don’t count unread_count or dashcard indicators against newRelic load time"
This reverts commit aa977ecd2a.

Reverting based on belief that this is surfacing errors in the build:

"something went wrong updating unread count" TypeError: Failed to fetch

Change-Id: I842ad732d75c6ca83f31e140ddf5edb6f10e45fe
Reviewed-on: https://gerrit.instructure.com/201108
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
2019-07-13 01:06:56 +00:00
Ryan Shaw aa977ecd2a don’t count unread_count or dashcard indicators against newRelic load time
closes: CORE-3084

Test plan:
* the little badges that show unread discussion counts and stuff
  on each dashcard should work the same as before
* the badge on the global nav that shows how many unread inbox messages
  You have should work the same as before
* if you have newRelic set up, neither should count against page load
  metrics

Change-Id: I03f81c30223355ce3e1a2632ba17bfd6f1ae658f
Reviewed-on: https://gerrit.instructure.com/197823
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-07-11 22:09:37 +00:00
Jon Willesen 605fc86ec9 add apollo graphql query validation tools
These tools allow unit tests to validate that the graphql queries being
run using Apollo are valid according to the server's schema. This
includes validating the variables.

This commit includes a fix that the validator found with overrides where
a Section requires a name (String!), but a Group does not (String). To
fix the validation error, we have to have separate names for these
fields and handle the possibility that the group might have a null name.

closes ADMIN-2561

test plan:
- specs pass
- can still display the "Everyone" override (when there are no overrides)
- can still display the "Everyone Else" override

Change-Id: Ic19605e5ee12075e9abb5bb089e0285639957b69
Reviewed-on: https://gerrit.instructure.com/188602
Reviewed-by: Mysti Lilla <mysti@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Jon Willesen <jonw+gerrit@instructure.com>
2019-04-23 19:51:10 +00:00
Ryan Shaw ed46527652 Upgrade to babel 7 & allow any js file to be themeable
closes: CORE-2699 CORE-2700 UIDEV-99

This commit gets canvas-lms itself upgraded to babel 7. To do that we
also had to upgrade jest to v24. We had already got canvas-rce and
canvas-planner on jest24/babel7 but now this gets everything to babel 7.
so you will see a lot of things removed from yarn.lock since we don’t
don’t have to have different versions of everything for babel and jest

The other major thing this does is make it so any JS file in canvas
can become an @instructure/ui-themeable themeable component. This means
you no longer should have to put your css in app/stylesheets for any new
react components that you are writing.

Test plan:
1. Make sure that the perf of `yarn build:js` is on-par with what it was
   before. We pass everything through the themeable babel transform now
   so there is a chance it is slower. If it is majorly slower, we’ll have
   to figure something out.
2. run a production weback build. The common (or any bundle for that
   matter should get output exactly the same as it did before)

things to manually qa check:
* in a NODE_ENV=production enviornment, go to
  /accounts/site_admin/developer_keys
* click the "+ Developer Key" button, it should open the modal.
  (there are selenium tests that do this, but it was one thing that had
  to be fixed to get jenkins to pass)

* on a course that is set up as a master course, click on the thing that
  opens the blueprint courses tray.
* verify that when you click "Associations" and "Sync History" links in
  that tray, that they dynamically load the webpack chunk for the
  modal contents for that thing and then the modal is shown
  (again, there are selenium specs that test that exact thing but it
  is always good to manually test it too)

Change-Id: I802584228962b54480a500f8fe422f45c2dcac4c
Reviewed-on: https://gerrit.instructure.com/183965
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2019-04-02 14:59:20 +00:00
Brent Burgoyne a7b07e869e make jest support files that import handlebars
Change-Id: I073ea3f8b54cf46cd2b4c2437aad5ee13c95dc7c
Reviewed-on: https://gerrit.instructure.com/186286
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2019-03-22 15:38:23 +00:00
Brent Burgoyne 96315b8626 support testing coffeescript with jest
Change-Id: I540ad44c033e489ff49c251256263d547ca258cd
Reviewed-on: https://gerrit.instructure.com/182600
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Brent Burgoyne <bburgoyne@instructure.com>
2019-02-25 17:57:15 +00:00
Landon Gilbert-Bland 56f9882e41 Make core translations and svg imports available in jest
Refs COMMS-1751

Test Plan:
  - Jenkins is happy

Change-Id: Ibe3e7ce2b22f7acd4ba7a80a84eb5a4fff5bf645
Reviewed-on: https://gerrit.instructure.com/173628
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: Landon Gilbert-Bland <lbland@instructure.com>
Product-Review: Landon Gilbert-Bland <lbland@instructure.com>
2018-11-29 16:09:47 +00:00
Steven Burnett 80b76607c6 fix timezone core import in jest
Test Plan:
- tests pass
- brent is happy

Change-Id: I26c021bd50e2cf63aec96aedd987f6b8c6370c62
Reviewed-on: https://gerrit.instructure.com/173592
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Burnett <sburnett@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2018-11-28 21:27:42 +00:00
Jon Willesen 1898f2aa06 A2: teacher toolbox and code reorg
This is the first stab at implementing the teacher toolbox.

It also moves code toward the desired organization and frameworks.

closes ADMIN-1507

test plan:
- assignments 2 teacher view shows data on the right side of the header
  -> "X" is used as a placeholder value for values we don't have yet
- "X to grade" goes to the speedgrader for the assignment
- clicking on "Published" toggle shows a placeholder alert for the
  action
- clicking on "X unsubmitted" shows a placeholder alert for the action

Change-Id: I45f51789e2c3722f14482ab57d8d12244cff31b4
Reviewed-on: https://gerrit.instructure.com/170766
Tested-by: Jenkins
Reviewed-by: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Ed Schiebel <eschiebel@instructure.com>
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: Jon Willesen <jonw+gerrit@instructure.com>
2018-11-12 22:09:31 +00:00
Ryan Shaw d86d69015c Opt our js build tooling dirs into prettier
I guess since our team owns these we can opt them in now


Test plan:
* nothing should change

Change-Id: Ic7207e1033869ef60644c41bd5c80a3e8532a6dd
Reviewed-on: https://gerrit.instructure.com/171471
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2018-11-07 22:46:16 +00:00
Jon Willesen 3fddcf98e2 add enzyme snapshot serializer to jest
converts all the existing
`expect(component.debug()).toMatchSnapshot()`
to:
`expect(component).toMatchSnapshot()`
which creates more detailed and more diff-able snapshots

test plan:
- specs pass -- this only affects js test code

Change-Id: Ib6dbcc1e3f87e61a251e4635dc68353aca57aeac
Reviewed-on: https://gerrit.instructure.com/167651
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2018-10-09 21:16:59 +00:00
Ryan Shaw e1454a761c add jest-canvas-mock to silence a bunch of warnings
without this we get a bunch of warnings from our jest tests like:
Error: Not implemented: HTMLCanvasElement.prototype.getContext …

test plan:
you shouldn’t see those ^ messages in the jest logs

Change-Id: Ib257d4a6b40f4b4118f273729080e722afa3432a
Reviewed-on: https://gerrit.instructure.com/163515
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-09-07 15:18:15 +00:00
Clay Diffrient 2dc1d7fa86 Add a way to generate better js coverage
This should pick up coverage from both karma and jest
in Canvas proper.  It should also pick up coverage from anything under
packages/*

closes CORE-1265

Test Plan:
  - Run `COVERAGE=true yarn test`
     - Coverage reports (coverage-final.json) should generate in all
       packages such as (canvas-planner) as well as in coverage-karma
       and coverage-jest
  - Run `yarn run test:coverage`
     - coverage-js folder should be generated.  Opening index.html
       should show the full coverage report
  - Remove coverage-{js, karma, jest} and
    packages/canvas-planner/coverage as well as .nyc_output to get back
    to a clean state
  - Run `RUN_TESTS_FIRST=true yarn run test:coverage`
     - All tests should run and generate the appropriate report just
       like the last time in coverage-js

Change-Id: I50744b8977e0683e079af5bdd2865dbcd6ad9066
Reviewed-on: https://gerrit.instructure.com/146098
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2018-07-17 14:19:03 +00:00
Frank Murphy 3b937041fc Fix jest deprecation warning.
Test Plan:
- With freshly installed npm modules,
- Verify "testResultsProcessor support is deprecated" is no longer
  displayed when running jest tests locally.
- Open the jenkins job from this PS.
- Go to the test report > (root)
- Verify "Free-form Rubric with a custom criterion by default renders
  the root component as expected" is present in the report

Change-Id: I921138e2a9a1025a3ed665693a6223819bf76392
Reviewed-on: https://gerrit.instructure.com/156778
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
Product-Review: Neil Gupta <ngupta@instructure.com>
QA-Review: Neil Gupta <ngupta@instructure.com>
2018-07-10 22:06:00 +00:00
Jeremy Neander d370ed21b7 spec: restrict jest filename matching
By default, jest uses the following matchers:

  '**/__tests__/**/*.js?(x)'
  '**/?(*.)(spec|test).js?(x)'

It looks for .js and .jsx files inside of __tests__ folders, as well as
any files with a suffix of .test or .spec (e.g. Component.test.js or
Component.spec.js). It will also find files called test.js or spec.js.

This means that ANY file in the __tests__ folders is considered to be a
test file and will fail if it does not contain any specs. The prohibits
the use of supporting helper files and/or other such code to aid in
testing.

The change in this commit restricts the matcher to only files contained
within __tests__ paths with names ending in spec.js or test.js
(e.g., thing.test.js, spec.js)

Change-Id: Ied771b9e8dd5ad8fd24a9de70f1edb9a272ed3c1
Reviewed-on: https://gerrit.instructure.com/142657
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Jeremy Neander <jneander@instructure.com>
QA-Review: Jeremy Neander <jneander@instructure.com>
2018-03-06 20:24:50 +00:00
Clay Diffrient 928f334cfb Convert theme editor sidebar to use instui
closes CORE-1017

Test Plan:
  - Enable Theme Editor Refactor feature flag
  - The sidebar tabs (Edit/Upload) should use InstUI
  - On the Edit tab, the accordions should use InstUI
  - When the feature flag is off the jQuery UI stuff
    should be used.

Change-Id: Ic8bfac91d644fc75618f1f0898afbcfcf411c3fd
Reviewed-on: https://gerrit.instructure.com/140561
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
2018-02-22 20:31:59 +00:00
Ryan Shaw 8d2d33489e Restore ThemeEditor to how it was before InstUI conversion
Fixes: CORE-856

This is to fix the bug that was found on beta, once we figure out a way
around that we can revert this revert and move forward

this is the result of `git revert 2fce80fe6d 96bfe1f8c2 72ca2dcacb

Test Plan:
  - Go to the theme editor for a theme
  - Make changes to the theme (including stuff inside each of the
    different hidden areas) on the Edit tab
  - Preview changes, after change those fields should reflect the
    new changes
  - Enable global css/js on the account
  - Do the same test as done previously, modifying fields, etc.
  - Switch to the Upload tab and preview changes, changes should
    still apply
  - Upload CSS/JS and preview, changes should apply
  - Upload different CSS/JS, switch to the Edit tab
  - Preview and notice that changes still apply

Revert "Convert Theme Editor Accordion to use Inst UI"
This reverts commit 2fce80fe6d.

Revert "Convert ThemeEditorAccordion to ES class"
This reverts commit 96bfe1f8c2.

Revert "Convert theme editor sidebar to use InstUI"
This reverts commit 72ca2dcacb.

Change-Id: I0ac36b144c325eaa5ae7d8c4ba86b7807aa3431b
Reviewed-on: https://gerrit.instructure.com/139594
Reviewed-by: Tucker McKnight <tmcknight@instructure.com>
QA-Review: Tucker McKnight <tmcknight@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
Product-Review: Gentry Beckmann <gbeckmann@instructure.com>
2018-01-31 01:25:26 +00:00
Ryan Shaw d8259be7cc speed up JS tests by running them concurrently
closes: CORE-865

In order to get accurate coverage reports (ie: so the coverage numbers 
don’t only reflect a fraction of the total tests), when the COVERAGE 
environment variable is set, it does not split them out into groups to
run concurrently. That way our linters-and-js-master build (which sets
that environment variable) will run the same as it always has and our 
patch-set builds (which run the linters-and-js) will be faster.

Test plan:
* run ‘yarn test’
* it should be a lot faster than it used to be

* look at the linters-and-js build in jenkins for this commit
* it should have test reports for all both groups (coffee, js)
  Of karma tests as well as for the jest tests.

* look at the coverage report after this gets merged. It should be
  the same as it was before

Change-Id: I35147cc84df4afae92c1a73c201667d4d44b5518
Reviewed-on: https://gerrit.instructure.com/136373
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Tested-by: Jenkins
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Ryan Shaw <ryan@instructure.com>
2018-01-16 19:32:28 +00:00
Ryan Shaw a33231cf0a let jest know about some of our aliases
…and prevent a giant error from being logged from ui-themable


test plan:
* the “Add Ability To Add External RSS Feeds…” commit that is based
  on top of this should pass jest
* you should not see an errors like this when jest runs:
console.error node_modules/@instructure/ui-themeable/lib/registry.js:342
      TypeError: Cannot read property 'porcelain' of undefined


Change-Id: I8a9583a3d16394a919a223cedfd577aef7f70ec1
Reviewed-on: https://gerrit.instructure.com/137778
Product-Review: Steven Burnett <sburnett@instructure.com>
QA-Review: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
2018-01-12 19:16:18 +00:00
Clay Diffrient 2fce80fe6d Convert Theme Editor Accordion to use Inst UI
closes CORE-691

Test Plan:
  - Edit tab works as expected
  - You can move between "accordion" pieces in an
    accessible manner
  - Testing this also proves g/135762 is good as well
Change-Id: Iee447bc97ad5392e74b033b072179f20984e3f6e
Reviewed-on: https://gerrit.instructure.com/135893
Tested-by: Jenkins
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Nathan Rogowski <nathan@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2018-01-08 21:39:24 +00:00
Ryan Shaw f2240b0985 move jest config to it’s own file
Change-Id: I0071e39fdde33a7c14e7360e31751e5329be5fff
Reviewed-on: https://gerrit.instructure.com/136372
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-12-28 21:02:03 +00:00