Skip to content

Commit

Permalink
Merge branch 'master' of github.com:NDLANO/ndla-frontend into e2e-fol…
Browse files Browse the repository at this point in the history
…der-page
  • Loading branch information
MaPoKen committed Mar 12, 2024
2 parents c8d866f + 407d243 commit 6d0da5a
Show file tree
Hide file tree
Showing 204 changed files with 7,057 additions and 11,299 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
runs-on: ubuntu-latest
env:
DEFAULT_TIMEOUT: 5000
JEST_TIMEOUT: 15000
NDLA_PERSONAL_CLIENT_ID: ${{ secrets.NDLA_PERSONAL_CLIENT_ID }}
steps:
- uses: actions/checkout@v3
Expand All @@ -64,7 +63,7 @@ jobs:
- name: 'Enable yarn v4'
run: |
corepack enable
yarn set version 4.1.0
yarn set version 4.1.1
- name: 'Login to ECR repo'
run:
RES=$(aws sts assume-role --role-arn $CI_RELEASE_ROLE --role-session-name github-actions-ecr-login)
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ WORKDIR $APP_PATH
RUN yarn install --immutable

# Copy necessary source files for server and client build
COPY babel.config.cjs tsconfig.json .eslintrc.cjs postcss.config.cjs $APP_PATH/
COPY webpack $APP_PATH/webpack
COPY babel.config.cjs tsconfig.json vite.config.ts .eslintrc.cjs postcss.config.cjs $APP_PATH/
COPY iframe-article.html iframe-embed.html index.html lti.html error.html $APP_PATH/
COPY scripts $APP_PATH/scripts

COPY src $APP_PATH/src
Expand All @@ -36,4 +36,4 @@ COPY --from=builder /home/app/ndla-frontend/build build

ENV NODE_ENV=production

CMD ["/run-ndla-frontend.sh", "node build/server.js '|' bunyan"]
CMD ["/run-ndla-frontend.sh", "node build/server.mjs"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ What's in the box?
- React
- GraphQL
- Express
- Webpack + Babel (ES6)
- Vite + Babel (ES6)

### Dependencies

Expand All @@ -43,7 +43,7 @@ To use a different api set the `NDLA_ENVIRONMENT` environment variable.

### Unit tests

Test framework: [Jest](https://github.com/facebook/jest)
Test framework: [Vitest](https://github.com/vitest-dev/vitest/)

```yarn
yarn test
Expand Down
25 changes: 1 addition & 24 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
module.exports = {
presets: [
'@babel/preset-typescript',
[
'@babel/preset-react',
{ runtime: 'automatic', importSource: '@emotion/react' },
],
[
'@babel/preset-env',
{
targets: {
browsers: ['> 0.25%', 'supports es6-module', 'not dead'],
},
},
],
],

plugins: [
['@emotion', { autoLabel: 'always' }],
'graphql-tag',
process.env.BABEL_ENV === 'development' &&
process.env.BUILD_TARGET === 'client'
? 'react-refresh/babel'
: false,
].filter((e) => !!e),
plugins: [["@emotion", { autoLabel: "always" }], "graphql-tag"],
};
2 changes: 1 addition & 1 deletion e2e/apiMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import { readFile, writeFile, mkdir } from "fs/promises";
import isEqual from "lodash/isEqual";
import isEqual from "lodash/isEqual.js";
import { Page } from "@playwright/test";
const mockDir = "e2e/apiMocks/";

Expand Down
2 changes: 1 addition & 1 deletion e2e/apiMocks/minndla_home_arena.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[{"data":{"arenaCategoriesV2":[{"__typename":"ArenaCategoryV2","id":1,"title":"Test kategori","description":"Testorama","topicCount":1,"postCount":11,"visible":true}]}}
[{"data":{"arenaCategoriesV2":[{"__typename":"ArenaCategoryV2","id":10,"title":"dette er en ny kategori","description":"tut tut","topicCount":1,"postCount":4,"visible":false},{"__typename":"ArenaCategoryV2","id":1,"title":"Test kategori","description":"Testorama","topicCount":19,"postCount":37,"visible":true},{"__typename":"ArenaCategoryV2","id":3,"title":"Comments & Feedback","description":"Got a question? Ask away!","topicCount":10,"postCount":32,"visible":true},{"__typename":"ArenaCategoryV2","id":4,"title":"Digitalpedagoger","description":"","topicCount":4,"postCount":15,"visible":true},{"__typename":"ArenaCategoryV2","id":5,"title":"Historie","description":"Stedet å dele gode historier","topicCount":3,"postCount":9,"visible":true},{"__typename":"ArenaCategoryV2","id":6,"title":"Kunstig intelligens og prateroboter","description":"","topicCount":3,"postCount":12,"visible":true},{"__typename":"ArenaCategoryV2","id":7,"title":"Lærerrommet","description":"","topicCount":0,"postCount":0,"visible":true},{"__typename":"ArenaCategoryV2","id":8,"title":"Norsk","description":"","topicCount":5,"postCount":25,"visible":true},{"__typename":"ArenaCategoryV2","id":9,"title":"Prøverom","description":"Her kan du øve deg på forumets funksjoner og prøve deg fram med svar og innlegg.","topicCount":7,"postCount":21,"visible":true}]}}
]
4 changes: 2 additions & 2 deletions e2e/apiMocks/minndla_home_data.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[{"data":{"folderResourceMetaSearch":[{"__typename":"ArticleFolderResourceMeta","id":"11039","title":"Bakerens eget språk","description":"Film om faguttrykk som brukes i bakeprosessen.","type":"article","metaImage":{"url":"https://api.test.ndla.no/image-api/raw/id/2984","alt":"Baker som former brød. Foto. ","__typename":"MetaImage"},"resourceTypes":[{"id":"urn:resourcetype:subjectMaterial","name":"Fagstoff","__typename":"FolderResourceResourceType"},{"id":"urn:resourcetype:movieAndClip","name":"Film og filmklipp","__typename":"FolderResourceResourceType"}]},{"__typename":"ArticleFolderResourceMeta","id":"26008","title":"Produkt som konkurransemiddel","description":"Markedsførere må ha en strategi for hvordan produkter kan få en posisjon i markedet og gi inntjening.","type":"article","metaImage":{"url":"https://api.test.ndla.no/image-api/raw/id/52358","alt":" Converse-sko med tydelig logo. Foto.","__typename":"MetaImage"},"resourceTypes":[{"id":"urn:resourcetype:subjectMaterial","name":"Fagstoff","__typename":"FolderResourceResourceType"},{"id":"urn:resourcetype:academicArticle","name":"Fagartikkel","__typename":"FolderResourceResourceType"}]},{"__typename":"ArticleFolderResourceMeta","id":"27615","title":"Eksponentialfunksjonen som modell","description":"Her viser vi et eksempel der vi bruker en eksponentialfunksjon som matematisk modell.","type":"article","metaImage":{"url":"https://api.test.ndla.no/image-api/raw/id/56905","alt":"Eksponentialfunksjon som modell. Illustrasjon.","__typename":"MetaImage"},"resourceTypes":[{"id":"urn:resourcetype:subjectMaterial","name":"Fagstoff","__typename":"FolderResourceResourceType"},{"id":"urn:resourcetype:academicArticle","name":"Fagartikkel","__typename":"FolderResourceResourceType"}]},{"__typename":"ArticleFolderResourceMeta","id":"34653","title":"Trafikkreglene","description":"Forskrift om kjørende og gående trafikk, eller trafikkreglene, som vi kaller det i dagligtale, gjelder all trafikk på vei.","type":"article","metaImage":{"url":"https://api.test.ndla.no/image-api/raw/id/25143","alt":"Myndighetspyramiden i veitrafikk. Illustrasjon.","__typename":"MetaImage"},"resourceTypes":[{"id":"urn:resourcetype:subjectMaterial","name":"Fagstoff","__typename":"FolderResourceResourceType"},{"id":"urn:resourcetype:academicArticle","name":"Fagartikkel","__typename":"FolderResourceResourceType"}]},{"__typename":"ArticleFolderResourceMeta","id":"5796435380001","title":"Bakerens eget språk","description":"","type":"video","metaImage":{"url":"https://cf-images.eu-west-1.prod.boltdns.net/v1/static/4806596774001/2bfb2209-b225-4548-baf4-610114c73735/6c696bf6-e07d-4206-8abb-9e54e3d2b451/1280x720/match/image.jpg","alt":"","__typename":"MetaImage"},"resourceTypes":[{"id":"video","name":"video","__typename":"FolderResourceResourceType"}]}]}}
,{"data":{"arenaRecentTopicsV2":{"__typename":"PaginatedTopics","totalCount":1,"page":1,"pageSize":5,"items":[{"__typename":"ArenaTopicV2","id":1,"postCount":11,"created":"2024-01-26T12:36:15.449Z","updated":"2024-01-26T12:36:15.449Z","title":"Larver","isFollowing":true,"categoryId":1}]}}}
,{"data":{"arenaNotificationsV2":{"__typename":"PaginatedArenaNewPostNotificationV2","totalCount":0,"page":1,"pageSize":10,"items":[]}}}
,{"data":{"arenaRecentTopicsV2":{"__typename":"PaginatedTopics","totalCount":52,"page":1,"pageSize":5,"items":[{"__typename":"ArenaTopicV2","id":55,"postCount":2,"created":"2024-02-20T12:41:52.471Z","updated":"2024-02-20T12:41:52.471Z","title":"sfsfsef","isFollowing":false,"categoryId":10,"isLocked":false},{"__typename":"ArenaTopicV2","id":56,"postCount":2,"created":"2024-02-21T11:27:45.402Z","updated":"2024-02-21T11:27:45.402Z","title":"Forskjellig fra prod? Er noe annerledes? Testefjas. ","isFollowing":false,"categoryId":1,"isLocked":false},{"__typename":"ArenaTopicV2","id":47,"postCount":2,"created":"2024-02-08T09:30:36.483Z","updated":"2024-02-08T09:30:36.483Z","title":"Playwright test tittel","isFollowing":true,"categoryId":1,"isLocked":false},{"__typename":"ArenaTopicV2","id":53,"postCount":2,"created":"2024-02-13T13:40:39.561Z","updated":"2024-02-14T05:28:11.656Z","title":"dette er meg","isFollowing":false,"categoryId":1,"isLocked":false},{"__typename":"ArenaTopicV2","id":52,"postCount":1,"created":"2024-02-13T13:03:09.393Z","updated":"2024-02-13T14:16:38.874Z","title":"adwadaw","isFollowing":false,"categoryId":1,"isLocked":true}]}}}
,{"data":{"arenaNotificationsV2":{"__typename":"PaginatedArenaNewPostNotificationV2","totalCount":4,"page":1,"pageSize":10,"items":[{"__typename":"ArenaNewPostNotificationV2","id":20,"topicId":47,"topicTitle":"Playwright test tittel","notificationTime":"2024-02-21T11:26:07.052Z","isRead":false,"post":{"__typename":"ArenaPostV2","content":"Her er det moderert noe av moderator. Eller modern' burde ha rydda. Men nå skal jaffalll moderator kanskje se at jeg har svara på greia. ","contentAsHTML":"<p>Her er det moderert noe av moderator. Eller modern' burde ha rydda. Men nå skal jaffalll moderator kanskje se at jeg har svara på greia.</p>\n","id":172,"created":"2024-02-21T11:26:07.048Z","updated":"2024-02-21T11:26:07.048Z","topicId":47,"owner":{"displayName":"Sverre Skjold","id":29,"groups":[],"location":"Vardafjell videregående skole","username":"[email protected]","__typename":"ArenaUserV2"},"flags":[]}},{"__typename":"ArenaNewPostNotificationV2","id":18,"topicId":13,"topicTitle":"Playwright test tittel","notificationTime":"2024-02-08T10:53:43.437Z","isRead":true,"post":{"__typename":"ArenaPostV2","content":"asd asd ","contentAsHTML":"<p>asd asd</p>\n","id":161,"created":"2024-02-08T10:53:43.429Z","updated":"2024-02-08T11:05:16.326Z","topicId":13,"owner":{"displayName":"Frank Foreleser Føllesen","id":3,"groups":["ADMIN"],"location":"Universitetet i Rogn","username":"[email protected]","__typename":"ArenaUserV2"},"flags":[]}},{"__typename":"ArenaNewPostNotificationV2","id":4,"topicId":5,"topicTitle":"Playwright test tittle","notificationTime":"2024-02-02T09:44:06.968Z","isRead":true,"post":{"__typename":"ArenaPostV2","content":"*title","contentAsHTML":"<p>*title</p>\n","id":18,"created":"2024-02-02T09:44:06.965Z","updated":"2024-02-02T09:44:06.965Z","topicId":5,"owner":{"displayName":"Frank Foreleser Føllesen","id":3,"groups":["ADMIN"],"location":"Universitetet i Rogn","username":"[email protected]","__typename":"ArenaUserV2"},"flags":[]}},{"__typename":"ArenaNewPostNotificationV2","id":3,"topicId":1,"topicTitle":"Larver","notificationTime":"2024-02-02T09:30:54.885Z","isRead":true,"post":{"__typename":"ArenaPostV2","content":"Svar fra bruker som skal slettes","contentAsHTML":"<p>Svar fra bruker som skal slettes</p>\n","id":17,"created":"2024-02-02T09:30:54.876Z","updated":"2024-02-02T09:30:54.876Z","topicId":1,"owner":null,"flags":[]}}]}}}
]
2 changes: 1 addition & 1 deletion e2e/apiMocks/minndla_home_folder.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion e2e/apiMocks/minndla_home_myndladata.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[{"data":{"examLockStatus":{"key":"MY_NDLA_WRITE_RESTRICTED","value":true,"__typename":"ConfigMetaBoolean"},"personalData":{"__typename":"MyNdlaPersonalData","id":2,"username":"[email protected]","email":"[email protected]","displayName":"Anne LærerVGS Haugen","groups":[{"id":"fc:org:testusers.feide.no","displayName":"Rogn fylkeskommune","isPrimarySchool":false,"parentId":null,"__typename":"MyNdlaGroup"},{"id":"fc:org:testusers.feide.no:unit:NO856326501","displayName":"Lerk VGS","isPrimarySchool":true,"parentId":"fc:org:testusers.feide.no","__typename":"MyNdlaGroup"}],"organization":"Rogn fylkeskommune","favoriteSubjects":["urn:subject:1:09410bfa-5b0d-470b-8727-5006e711bc1f","urn:subject:1:f9eb2b20-1c83-4292-8ad2-0fa8522da7cd"],"role":"employee","arenaEnabled":true,"arenaGroups":[],"shareName":true}}}
[{"data":{"frontpage":{"articleId":38140,"hideLevel":false,"article":{"id":38140,"title":"Forside","slug":"forside","__typename":"Article"},"__typename":"FrontpageMenu","menu":[{"articleId":38253,"hideLevel":false,"article":{"id":38253,"title":"Hvem er vi?","slug":"hvem-er-vi","__typename":"Article"},"__typename":"FrontpageMenu","menu":[{"articleId":38002,"hideLevel":false,"article":{"id":38002,"title":"Kontakt oss","slug":"tittel-p-forsideartikkel","__typename":"Article"},"__typename":"FrontpageMenu","menu":[{"articleId":38253,"hideLevel":false,"article":{"id":38253,"title":"Hvem er vi?","slug":"hvem-er-vi","__typename":"Article"},"__typename":"FrontpageMenu","menu":[{"articleId":38259,"hideLevel":true,"article":{"id":38259,"title":"Jobb hos oss","slug":"jobb-hos-oss","__typename":"Article"},"__typename":"FrontpageMenu"},{"articleId":38479,"hideLevel":true,"article":{"id":38479,"title":"Om NDLA-film","slug":"om-ndl-film","__typename":"Article"},"__typename":"FrontpageMenu"}]},{"articleId":38260,"hideLevel":false,"article":{"id":38260,"title":"Utlysninger","slug":"utlysninger","__typename":"Article"},"__typename":"FrontpageMenu","menu":[{"articleId":38207,"hideLevel":true,"article":{"id":38207,"title":"Tester bilde i grid","slug":"tester-bilde-i-grid","__typename":"Article"},"__typename":"FrontpageMenu"},{"articleId":38488,"hideLevel":true,"article":{"id":38488,"title":"NDLAFILMen","slug":"ndlafilmen","__typename":"Article"},"__typename":"FrontpageMenu"}]},{"articleId":38528,"hideLevel":false,"article":{"id":38528,"title":"Test av grid","slug":"test-av-grid","__typename":"Article"},"__typename":"FrontpageMenu","menu":[]}]}]},{"articleId":38247,"hideLevel":false,"article":{"id":38247,"title":"Om NDLA","slug":"om-ndla","__typename":"Article"},"__typename":"FrontpageMenu","menu":[]}]}}}
,{"data":{"examLockStatus":{"key":"MY_NDLA_WRITE_RESTRICTED","value":true,"__typename":"ConfigMetaBoolean"},"personalData":{"__typename":"MyNdlaPersonalData","id":2,"username":"[email protected]","email":"[email protected]","displayName":"Anne LærerVGS Haugen","groups":[{"id":"fc:org:testusers.feide.no","displayName":"Rogn fylkeskommune","isPrimarySchool":false,"parentId":null,"__typename":"MyNdlaGroup"},{"id":"fc:org:testusers.feide.no:unit:NO856326501","displayName":"Lerk VGS","isPrimarySchool":true,"parentId":"fc:org:testusers.feide.no","__typename":"MyNdlaGroup"}],"organization":"Rogn fylkeskommune","favoriteSubjects":["urn:subject:1:09410bfa-5b0d-470b-8727-5006e711bc1f","urn:subject:1:f9eb2b20-1c83-4292-8ad2-0fa8522da7cd"],"role":"employee","arenaEnabled":true,"arenaGroups":["ADMIN"],"shareName":true}}}
,{"data":{"allFolderResources":[{"id":"4a280971-7c99-467d-bb89-0f366c3acc0b","resourceId":"5796435380001","path":"/video/5796435380001","tags":[],"resourceType":"video","created":"2024-01-03T14:07:32.252Z","__typename":"FolderResource"},{"id":"64046129-fe50-40d3-8e82-92cb605b3063","resourceId":"11039","path":"/subject:1:b5156afd-e11c-4426-a3ba-a1e25c03f489/topic:2:188696/topic:2:189185/topic:2:198536/resource:1:98558","tags":[],"resourceType":"article","created":"2024-01-03T14:06:08.131Z","__typename":"FolderResource"},{"id":"dd40f2d8-123c-4eb1-a956-5de788d5fe3f","resourceId":"27615","path":"/subject:da2379d0-3c91-4e4d-94d7-fc42f69593d2/topic:66bda219-2e8f-4afd-b86c-c6b7127dd9c9/resource:42fb0c9a-69a3-4f42-954f-8609e47e929a","tags":[],"resourceType":"article","created":"2023-08-24T13:41:57.234Z","__typename":"FolderResource"},{"id":"c7ecefda-cbf9-4c4d-9b41-9595787a3267","resourceId":"34653","path":"/subject:1:aa902796-db72-4f3f-ade1-63e4dba5653b/topic:1:bcd0eea3-6939-48bb-aa53-5f5cc5845d26/resource:970eb418-b29e-4f6d-a614-9fd4cf3e7460","tags":[],"resourceType":"article","created":"2023-08-21T11:32:35.429Z","__typename":"FolderResource"},{"id":"dfc89318-8e17-4798-a746-e423db53c1f9","resourceId":"26008","path":"/subject:1:47678c7b-bc09-4fc8-b2d9-a2e3d709e105/topic:1:987036c0-929f-4033-9e3e-632c350ee6ef/resource:1be2c36c-747f-42c2-9669-7cbba8a20b0a","tags":[],"resourceType":"article","created":"2023-08-14T12:25:01.059Z","__typename":"FolderResource"}]}}
]
Loading

0 comments on commit 6d0da5a

Please sign in to comment.