Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -296,58 +296,3 @@ jobs:
run: |
diff $GENERATOR_OUTPUT_DIR_CI $GENERATOR_OUTPUT_DIR_VC \
|| { echo "OpenAPI spec is out of date. Please regenerate via ./scripts/generate_openapi.sh"; exit 1; }

e2e-tests:
# Disabling the E2E tests for now
if: false
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4

- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4
with:
node-version: "^20"
cache: yarn
cache-dependency-path: e2e_testing/yarn.lock

- name: Install frontend dependencies
run: yarn install --immutable

- name: Build frontend
run: NODE_ENV=production yarn build

- name: Build exported components
run: NODE_ENV=production yarn workspace mit-learn build-exports

- name: Build services
run: docker compose -f docker-compose-e2e-tests.yml build

- name: Start services
run: docker compose -f docker-compose-e2e-tests.yml up nginx web --detach --wait

- name: Apply test data
run: ./e2e_testing/scripts/apply-fixtures.sh

- name: Install E2E test dependencies
working-directory: e2e_testing
run: yarn install --immutable

- name: Install Playwright browsers
working-directory: e2e_testing
run: yarn playwright install --with-deps chromium

- name: Run E2E tests
working-directory: e2e_testing
run: BASE_URL=http://localhost:8063 CI=true yarn test

- name: Setup Pages
if: always()
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5

- name: Upload artifact
if: always()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4
with:
name: playwright-report
path: e2e_testing/playwright-report
7 changes: 0 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,5 @@ github-pages/public
# Storybook
storybook-static/

/e2e_testing/test-results/
/e2e_testing/playwright-report/
/e2e_testing/blob-report/
/e2e_testing/playwright/.cache/
!/e2e_testing/.env

/**/.yarn/cache
e2e_testing/.yarn/cache
.swc
36 changes: 0 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,42 +251,6 @@ Personal API keys only need read permission to Query. When creating a personal A

Once these are set (and you've restarted the app), you should see events flowing into the PostHog dashboard.

## Exported Components

A Javascript bundle of exported frontend components can be generated for use in external websites that have CORS allowance into a given instance of `mit-learn`. There are a few settings you might want to change in order to get the expected results.

- `MITOL_AXIOS_WITH_CREDENTIALS` - This sets `withCredentials: true` when initializing the Axios API, which tells the end user's browser to send along any browser level cookies for the current domain when making CORS requests
- `MITOL_API_BASE_URL` - This sets the base url used for API requests, which will need to be set to a fully qualified url pointing to an instance of `mit-learn` (i.e. https://learn.mit.edu) in order for requests from the external site to reach the proper destination
- `CORS_ALLOWED_ORIGINS`, `CSRF_TRUSTED_ORIGINS` - On the instance of `mit-learn` that the externally hosted components will access via the API, the domains of any sites that need CORS access need to be here as a list of strings

To build the bundle of exported components, run:

```
yarn workspace mit-learn build-exports
```

The bundle will build out to `frontends/mit-learn/build-exports/`

### `initMitOpenDom`

This function takes an argument of an `HTMLElement` with which `mit-learn` components will mount into.

### `openAddToUserListDialog`

This function opens a modal for adding a given `LearningResource` to a `UserList`, given the `readable_id` of the `LearningResource` object. Given a div with an ID of `mit-learn-components` and a button with the ID for `add-to-user-list-button`, you would use it in combination with `initMitOpenDom` like this:

```javascript
import { initMitOpenDom, openAddToUserListDialog } from "mit-learn-components"

$("#add-to-user-list-button").on("click", async (event) => {
event.preventDefault()
await initMitOpenDom($("#mit-learn-components"))
await openAddToUserListDialog("18.700+fall_2013")
})
```

This is just an example, and you could input any `readable_id` to bring up a dialog to add any given `LearningResource` object to a `UserList`.

## GitHub Pages Storybook

Demos and documentation of reusable UI components in this repo are published as a [storybook](https://storybook.js.org/) at https://mitodl.github.io/mit-learn/.
2 changes: 1 addition & 1 deletion channels/views_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def test_patch_channel_image(client, channel, attribute):
os.path.dirname(__file__), # noqa: PTH120
"..",
"frontends",
"mit-learn",
"main",
"public",
"images",
"blank.png",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added a blank.png at this path, but do we actually need it for this test? It's not used in the frontend.

Copy link
Contributor

@ChristopherChudzicki ChristopherChudzicki Oct 23, 2024

Choose a reason for hiding this comment

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

It's "supposed" to be the fallback for embedly. See frontends/ol-utilities/src/learning-resources/learning-resources.ts

That said:

  • we don't need the /static version
  • The version we do have set isn't working right now (https://rc.learn.mit.edu/static/images/blank.png) ... unsure why
    • EDIT: I forgot I was on your branch. The link I posted does not work, but should after this release, I think.

Expand Down
10 changes: 0 additions & 10 deletions config/static-app.conf

This file was deleted.

94 changes: 0 additions & 94 deletions docker-compose-e2e-tests.yml

This file was deleted.

4 changes: 0 additions & 4 deletions e2e_testing/.env

This file was deleted.

Binary file removed e2e_testing/.yarn/install-state.gz
Binary file not shown.
12 changes: 0 additions & 12 deletions e2e_testing/Dockerfile

This file was deleted.

96 changes: 0 additions & 96 deletions e2e_testing/README.md

This file was deleted.

28 changes: 0 additions & 28 deletions e2e_testing/fixtures/002_carousel.json

This file was deleted.

14 changes: 0 additions & 14 deletions e2e_testing/package.json

This file was deleted.

Loading
Loading