Skip to content

Commit ee46dd5

Browse files
Merge pull request #345 from topcoder-platform/dev
TCA-464 TCA New Courses & GAME Release -> master
2 parents 9b652aa + 1c396e8 commit ee46dd5

File tree

173 files changed

+3704
-527
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+3704
-527
lines changed

.circleci/config.yml

Lines changed: 44 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ deploy_defaults: &deploy_defaults
88
docker:
99
- image: cimg/python:3.10.2
1010

11+
test_defaults: &test_defaults
12+
docker:
13+
- image: cypress/browsers:node16.14.2-slim-chrome100-ff99-edge
14+
1115
install_build_dependency: &install_build_dependency
1216
name: Installation of build and deployment dependencies.
1317
command: |
@@ -50,6 +54,14 @@ running_yarn_build: &running_yarn_build
5054
yarn install
5155
yarn build
5256
57+
running_yarn_test: &running_yarn_test
58+
name: Running Yarn Test Build
59+
command: |
60+
yarn install
61+
yarn cypress install
62+
yarn build
63+
yarn cy:ci
64+
5365
workspace_persist: &workspace_persist
5466
root: .
5567
paths:
@@ -81,6 +93,27 @@ build_steps: &build_steps
8193
- run: *running_yarn_build
8294
- persist_to_workspace: *workspace_persist
8395

96+
test_steps: &test_steps
97+
# Initialization.
98+
- checkout
99+
- setup_remote_docker
100+
- restore_cache:
101+
key: test-node-modules-{{ checksum "yarn.lock" }}
102+
- run: *running_yarn_test
103+
- save_cache:
104+
key: test-node-modules-{{ checksum "yarn.lock" }}
105+
paths:
106+
- node_modules
107+
- /root/.cache/Cypress
108+
- store_test_results:
109+
path: cypress/test-report
110+
- store_artifacts:
111+
path: cypress/test-report
112+
- store_artifacts:
113+
path: cypress/videos
114+
- store_artifacts:
115+
path: cypress/screenshots
116+
84117
deploy_steps: &deploy_steps
85118
- checkout
86119
- attach_workspace: *workspace_attach
@@ -127,6 +160,14 @@ jobs:
127160
LOGICAL_ENV: "prod"
128161
APPNAME: "platform-ui-mvp"
129162
steps: *build_steps
163+
164+
test-dev:
165+
<<: *test_defaults
166+
environment:
167+
DEPLOY_ENV: "DEV"
168+
LOGICAL_ENV: "dev"
169+
APPNAME: "platform-ui-mvp"
170+
steps: *test_steps
130171

131172
# Just tests commited code.
132173
deployDev:
@@ -147,35 +188,6 @@ jobs:
147188
APPNAME: "platform-ui-mvp"
148189
steps: *deploy_steps
149190

150-
# Test job for the cases when we don not need deployment.
151-
e2e-test:
152-
docker:
153-
- image: cypress/browsers:node16.14.2-slim-chrome100-ff99-edge
154-
steps:
155-
- checkout
156-
- restore_cache:
157-
key: test-node-modules-{{ checksum "yarn.lock" }}
158-
- run:
159-
name: Config Git
160-
command: git config --global url."https://git@".insteadOf git://
161-
- run:
162-
name: Install Dependencies
163-
command: yarn install
164-
no_output_timeout: 20m
165-
- run:
166-
name: Install Cypress Binary
167-
command: yarn cypress install
168-
- run:
169-
name: Build the application
170-
command: yarn build
171-
no_output_timeout: 20m
172-
- save_cache:
173-
key: test-node-modules-{{ checksum "yarn.lock" }}
174-
paths:
175-
- node_modules
176-
- /root/.cache/Cypress
177-
- run: yarn cy:ci
178-
179191
workflows:
180192
version: 2
181193
build:
@@ -201,9 +213,6 @@ workflows:
201213
ignore:
202214
- master
203215

204-
- e2e-test:
205-
context : org-global
206-
207216
- build-prod:
208217
context : org-global
209218
filters:
@@ -215,7 +224,6 @@ workflows:
215224
context : org-global
216225
requires:
217226
- build-dev
218-
- e2e-test
219227
filters:
220228
branches:
221229
only:
@@ -229,3 +237,6 @@ workflows:
229237
branches:
230238
only:
231239
- master
240+
241+
- test-dev:
242+
context : org-global

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
# testing
99
/coverage
1010
.nyc_output
11+
/cypress/screenshots
12+
/cypress/videos
13+
/cypress/test-report
1114

1215
# production
1316
/build

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ You can verify the versions of `nvm`, `node`, and `npm` using the commands below
6262
| `% nvm current` | v15.15.0 |
6363

6464

65+
>**NOTE:** The `yarn start` command requires the `NVM_DIR` env variable is set.
66+
67+
```zsh
68+
export NVM_DIR=~/.nvm
69+
```
70+
71+
If you don't have this set globally, you can create your own [personal config](#personal-config) to define your local nvm dir.
72+
6573
### Hosting
6674
You will need to add the following line to your hosts file. The hosts file is normally located at `/etc/hosts` (Mac). Do not overwrite the existing localhost entry also pointing to 127.0.0.1.
6775

@@ -81,9 +89,9 @@ You will need to add the following line to your hosts file. The hosts file is no
8189
8290
>% yarn start
8391
84-
3. Go to https://local.topcoder-dev.com:3000
92+
3. Go to https://local.topcoder-dev.com
8593

86-
>**NOTE**: The default port is 3000, but you can override it in your [personal config](#personal-config).
94+
>**NOTE**: The site must run on port 443 in order for auth0 to work and for the site to load properly. Mac users will need to run the app with elevated permissions.
8795
8896
### Local SSL
8997

@@ -102,7 +110,7 @@ Otherwise, you will need to override the exception each time you load the site.
102110
### Personal Config
103111

104112
1. Add [hostname] to [`/src-ts/config/environments/app-host-environment.type.ts`](/src-ts/config/environments/app-host-environment.type.ts)
105-
2. Copy an existing config from [`/src-ts/config/environments/environment.*.config.ts`](/src-ts/config/environments/environment.bsouza.config.ts)
113+
2. Copy an existing config from [`/src-ts/config/environments/environment.*.config.ts`](/src-ts/config/environments/environment.brooke.config.ts)
106114
3. Rename new config `environment.[hostname].config.ts`
107115
4. Rename config variable to `EnvironmentConfig[HostName]`
108116
5. Set the `ENV` variable to `[hostname]`
@@ -509,3 +517,5 @@ e.g.:
509517
}
510518
}
511519
```
520+
521+
>**NOTE** - all SVGs require explicit `width` and `height` in the Safari browser in order to be rendered properly, otherwise they'll be rendered to the _default_ size and probably will crop out of view

cypress.config.ts

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
1+
// tslint:disable-next-line: no-submodule-imports This is the way cypress does it
2+
import task from '@cypress/code-coverage/task'
13
import { defineConfig } from 'cypress'
24

35
export default defineConfig({
4-
fixturesFolder: false,
5-
video: false,
6-
screenshotOnRunFailure: false,
7-
defaultCommandTimeout: 10000,
8-
e2e: {
9-
baseUrl: 'http://localhost:3000',
10-
specPattern: "cypress/e2e/**/*.spec.{js,jsx,ts,tsx}",
11-
supportFile: "cypress/support/e2e.ts",
12-
viewportHeight: 1000,
13-
viewportWidth: 1280,
14-
setupNodeEvents(on, config) {
15-
require('@cypress/code-coverage/task')(on, config)
16-
return config;
6+
defaultCommandTimeout: 10000,
7+
e2e: {
8+
// baseUrl: 'https://local.topcoder-dev.com',
9+
baseUrl: 'http://localhost:3000',
10+
setupNodeEvents: setUpNodeEvents,
11+
specPattern: 'cypress/e2e/**/*.spec.{js,jsx,ts,tsx}',
12+
supportFile: 'cypress/support/e2e.ts',
13+
viewportHeight: 1000,
14+
viewportWidth: 1280,
1715
},
18-
},
16+
fixturesFolder: false,
17+
reporter: 'junit',
18+
reporterOptions: {
19+
mochaFile: 'cypress/test-report/test-result-[hash].xml',
20+
toConsole: false,
21+
},
22+
screenshotOnRunFailure: true,
23+
video: true,
1924
})
25+
26+
// adds the config to node setup events
27+
function setUpNodeEvents(
28+
on: Cypress.PluginEvents,
29+
config: Cypress.PluginConfigOptions
30+
): Cypress.PluginConfigOptions {
31+
task(on, config)
32+
return config
33+
}

cypress/e2e/home/home.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@ describe('Landing Page', () => {
55
it('loads landing page should be successfully', () => {
66
cy.get('[data-id="root"]').should('be.visible')
77
})
8+
9+
it.skip('loads landing page should fail', () => {
10+
cy.get('[data-id="root"]').should('not.be.visible')
11+
})
812
})

package.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
"scripts": {
66
"dev": "yarn react-app-rewired start",
77
"start": "sh start-ssl.sh",
8-
"start:bsouza": "sudo sh start-ssl-bsouza.sh",
8+
"start:brooke": "sudo sh start-ssl-brooke.sh",
99
"build": "yarn react-app-rewired build",
10+
"postbuild": "gzip build/static/js/*.js && gzip build/static/css/*.css",
1011
"lint": "tslint 'src-ts/**/*.{ts,tsx}' && eslint 'src*/**/*.{js,jsx,ts,tsx}'",
1112
"lint:fix": "tslint 'src-ts/**/*.{ts,tsx}' --fix && eslint 'src*/**/*.{js,jsx,ts,tsx}' --fix",
1213
"tslint": "tslint 'src-ts/**/*.{ts,tsx}'",
@@ -15,17 +16,14 @@
1516
"eslint:fix": "eslint 'src/**/*.{js,jsx}' --fix",
1617
"test": "react-scripts test --watchAll",
1718
"test:no-watch": "react-scripts test --watchAll=false --passWithNoTests",
18-
"cy:run": "cypress run",
19+
"cy:run": "cypress run --reporter junit",
1920
"cy:ci": "start-server-and-test 'serve -s build -n -p 3000' http://localhost:3000 'cy:run'",
2021
"report:coverage": "nyc report --reporter=html",
2122
"report:coverage:text": "nyc report --reporter=text"
2223
},
2324
"dependencies": {
2425
"@datadog/browser-logs": "^4.7.1",
2526
"@heroicons/react": "^1.0.6",
26-
"@types/dompurify": "^2.3.3",
27-
"@types/highlightjs": "^9.12.2",
28-
"@types/marked": "4.0.3",
2927
"apexcharts": "^3.35.3",
3028
"axios": "^0.26.1",
3129
"browser-cookies": "^1.2.0",
@@ -37,14 +35,17 @@
3735
"highlight.js": "^11.6.0",
3836
"html2canvas": "^1.4.1",
3937
"lodash": "^4.17.21",
38+
"markdown-it": "^13.0.1",
4039
"marked": "4.0.3",
4140
"moment": "^2.29.3",
4241
"moment-timezone": "^0.5.34",
4342
"prop-types": "^15.8.1",
43+
"qs": "^6.11.0",
4444
"rc-checkbox": "^2.3.2",
4545
"react": "^17.0.2",
4646
"react-apexcharts": "^1.4.0",
4747
"react-app-rewired": "^2.2.1",
48+
"react-contenteditable": "^3.3.6",
4849
"react-dom": "^17.0.2",
4950
"react-elastic-carousel": "^0.11.5",
5051
"react-gtm-module": "^2.0.11",
@@ -63,6 +64,7 @@
6364
"redux-thunk": "^2.4.1",
6465
"sass": "^1.49.8",
6566
"styled-components": "^5.3.5",
67+
"swr": "^1.3.0",
6668
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.4",
6769
"typescript": "^4.6.3",
6870
"uuid": "^8.3.2"
@@ -82,8 +84,13 @@
8284
"@testing-library/react": "^12.0.0",
8385
"@testing-library/user-event": "^13.2.1",
8486
"@types/axios": "^0.14.0",
87+
"@types/cypress": "^1.1.3",
88+
"@types/dompurify": "^2.3.3",
89+
"@types/highlightjs": "^9.12.2",
8590
"@types/jest": "^27.0.1",
8691
"@types/lodash": "^4.14.182",
92+
"@types/markdown-it": "^12.2.3",
93+
"@types/marked": "4.0.3",
8794
"@types/node": "^18.7.13",
8895
"@types/reach__router": "^1.3.10",
8996
"@types/react": "^18.0.5",
@@ -94,6 +101,7 @@
94101
"@types/segment-analytics": "^0.0.34",
95102
"@types/systemjs": "^6.1.0",
96103
"@types/uuid": "^8.3.4",
104+
"@wdio/junit-reporter": "^7.24.0",
97105
"autoprefixer": "^9.8.6",
98106
"babel-eslint": "^11.0.0-beta.2",
99107
"babel-jest": "^24.9.0",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export type AppHostEnvironmentType = 'bsouza' | 'default' | 'dev' | 'prod'
1+
export type AppHostEnvironmentType = 'brooke' | 'default' | 'dev' | 'prod'
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { EnvironmentConfigModel } from './environment-config.model'
22
import { EnvironmentConfigDefault } from './environment.default.config'
33

4-
export const EnvironmentConfigBsouza: EnvironmentConfigModel = {
4+
export const EnvironmentConfigBrooke: EnvironmentConfigModel = {
55
...EnvironmentConfigDefault,
6-
ENV: 'bsouza',
6+
ENV: 'brooke',
77
}

src-ts/config/environments/environment.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AppHostEnvironmentType } from './app-host-environment.type'
22
import { EnvironmentConfigModel } from './environment-config.model'
3-
import { EnvironmentConfigBsouza } from './environment.bsouza.config'
3+
import { EnvironmentConfigBrooke } from './environment.brooke.config'
44
import { EnvironmentConfigDefault } from './environment.default.config'
55
import { EnvironmentConfigDev } from './environment.dev.config'
66
import { EnvironmentConfigProd } from './environment.prod.config'
@@ -12,8 +12,8 @@ function getEnvironmentConfig(): EnvironmentConfigModel {
1212

1313
switch (environment) {
1414

15-
case 'bsouza':
16-
return EnvironmentConfigBsouza
15+
case 'brooke':
16+
return EnvironmentConfigBrooke
1717

1818
case 'default':
1919
return EnvironmentConfigDefault

src-ts/declarations.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
declare module '@cypress/code-coverage/task'
2+
13
declare module '*.html' {
24
const htmlFile: string
35
export = htmlFile

0 commit comments

Comments
 (0)