Skip to content

Commit 4e1ce72

Browse files
committed
Merge branch 'dev' into dev-center
2 parents 5bdbe6b + da181d4 commit 4e1ce72

File tree

110 files changed

+3251
-1679
lines changed

Some content is hidden

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

110 files changed

+3251
-1679
lines changed

.circleci/config.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,35 @@ jobs:
147147
APPNAME: "platform-ui-mvp"
148148
steps: *deploy_steps
149149

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+
150179
workflows:
151180
version: 2
152181
build:
@@ -172,6 +201,9 @@ workflows:
172201
ignore:
173202
- master
174203

204+
- e2e-test:
205+
context : org-global
206+
175207
- build-prod:
176208
context : org-global
177209
filters:
@@ -183,6 +215,7 @@ workflows:
183215
context : org-global
184216
requires:
185217
- build-dev
218+
- e2e-test
186219
filters:
187220
branches:
188221
only:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
# testing
99
/coverage
10+
.nyc_output
1011

1112
# production
1213
/build

README.md

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22

33
The Platform UI is the official Topcoder web app to host all modern user interfaces to be used by all users.
44

5-
All future user interfaces at Topcoder will be implemented here.
6-
Pre-existing user interfaces will be ported to here over time until this is the only user interface any user sees when interacting with Topcoder.
5+
All future user interfaces at Topcoder will be implemented here. Pre-existing user interfaces will be ported to here over time until this is the only user interface any user sees when interacting with Topcoder.
76

87
>**NOTE:** The information in this file describes our coding standards and best practices. All new code should follow these guidelines both when coding new features as well as porting old features. Please take the time to read through this file in detail.
98
109
# Getting started with local development
1110

1211
- [Local Environment Setup](#local-environment-setup)
1312
- [Deployments](#deployments)
14-
- [Developer Center specific setup](#developer-center-specific-setup)
13+
- [Developer Center specific setup](#developer-center-contentful-api-key-and-space-id)
1514
- [Yarn Commands](#yarn-commands)
1615

1716
# Application structure
@@ -82,29 +81,37 @@ You will need to add the following line to your hosts file. The hosts file is no
8281
8382
>% yarn start
8483
85-
3. Go to https://local.topcoder-dev.com:3003/
84+
3. Go to https://local.topcoder-dev.com:3000
85+
86+
>**NOTE**: The default port is 3000, but you can override it in your [personal config](#personal-config).
8687
8788
### Local SSL
8889

8990
SSL is required for authentication to work properly.
9091

91-
The `yarn start` command serves the site using the cert and key in the /ssl directory.
92+
The `yarn start` command serves the site using the cert and key in the /ssl directory, which authorize the `https://local.topcoder-dev.com`URL.
93+
94+
By overriding the app to use <b>port 443</b>, you can use the authorized URL and trust the root CA to avoid SSL errors in the browser.
95+
96+
>**NOTE:** Mac users will require running the app with elevated permissions in order to use a port lower than 500.
9297
93-
For easier development, it is recommended that you add this certificate to your trusted root authorities and as a trused cert in your browser. Google your browser and OS for more info.
98+
For easier development, it is recommended that you add this certificate to your trusted root authorities and as a trused cert in your browser. Google your browser and OS for more info on how to trust cert authorities.
9499

95100
Otherwise, you will need to override the exception each time you load the site. Firefox users may need to user an incognito browser in order to override the exception.
96101

97102
### Personal Config
98103

99-
1. Add [hostname] to src-ts/config/environments/app-host-environment.enum.ts
100-
2. Copy an existing config from src-ts/config/environments/environment.*.config.ts
101-
3. Rename new config environment.[hostname].config.ts
102-
4. Rename config variable to EnvironmentConfig[HostName]
103-
5. Set the ENV variable to AppHostEnvironment.[hostname]
104-
6. Add the switch case for the host name to src-ts/config/environments/environment.config.ts
104+
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)
106+
3. Rename new config `environment.[hostname].config.ts`
107+
4. Rename config variable to `EnvironmentConfig[HostName]`
108+
5. Set the `ENV` variable to `[hostname]`
109+
6. Add the switch case for the host name to [`/src-ts/config/environments/environment.config.ts`](/src-ts/config/environments/environment.config.ts)
105110
7. Prior to starting the server, set your host name:
106111
```% export REACT_APP_HOST_ENV=[hostname]```
107112

113+
>**NOTE:** Individual tools (e.g. [Learn tool](/src-ts/tools/learn/README.md)) can have their own configuration, which can be configured the same way as the global config.
114+
108115
#### For further convenience
109116

110117
1. Copy start-ssl-*.sh
@@ -118,11 +125,9 @@ The app uses CircleCI for CI/CD.
118125

119126
The "dev" branch is auto-deployed to the dev environment: https://platform-mvp.topcoder-dev.com.
120127

121-
The "master" branch is auto-deployed to the production environment: https://platform-mvp.topcoder.com.
122-
123-
## Developer Center specific setup
128+
The "master" branch is auto-deployed to the production environment: https://platform-ui.topcoder.com.
124129

125-
### Contentful API Key and Space Id
130+
## Developer Center Contentful API Key and Space Id
126131

127132
The app requires two environment variables, which contain the space id and the key used to access contentful and retrieve Thrive Articles.
128133

@@ -135,21 +140,7 @@ REACT_APP_CONTENTFUL_EDU_CDN_API_KEY=<API Key>
135140

136141
We should use the same space ID and API Key as Topcoder Thrive, these are for fetching Thrive articles and videos in the landing page.
137142

138-
### Landing page configuration
139-
140-
We can configure up to 5 articles shown on the landing page. The articles can be from Topcoder Thrive and/or Topcoder Blog.
141-
142-
The configuration file is located at `src-ts/tools/dev-center/dev-center-pages/community-app/landing-page/dev-center-articles-section/articles.config.ts`.
143-
144-
We can configure the image carousel on the landing page, the configuration file is located at `src-ts/tools/dev-center/dev-center-pages/community-app/landing-page/dev-center-header/carousel-content.config.ts`.
145-
146-
The local images for the carousel should be put in `src-ts/tools/dev-center/carousel-images`.
147-
148-
### Getting Started page configuration.
149-
150-
The content of the getting started page is from a Markdown text, the source is located at `src-ts/tools/dev-center/dev-center-pages/community-app/getting-started/GettingStartedGuide.md`.
151-
152-
The local images for the markdown should be put in `src-ts/tools/dev-center/images`.
143+
See the [Dev Center README](/src-ts/tools/dev-center/README.md) for further instructions on setting up the Dev Center.
153144

154145
## yarn Commands
155146

@@ -279,7 +270,7 @@ The PlatformRoute model has several useful options:
279270
| `element: JSX.Element` | The element property is the JSX element that should appear at the specified URL. |
280271
| `disabled?: boolean` | When a route is marked as disabled, it will not be registered and will the URL will return a 404. |
281272
| `hide?: boolean` | When a route is hidden, it will be registered and the URL will be available through deep-linking but will not be visible in either the Tools or Utils Selectors. This is useful for handling redirects for obsolete routes. |
282-
| `requireAuth?: boolean` | Requiring authentication for a route means that users who are not logged in will be redirected to the Login Form when they try to access the route. |
273+
| `authRequired?: boolean` | Requiring authentication for a route means that users who are not logged in will be redirected to the Login Form when they try to access the route. |
283274
| `route: string` | The route property is the path to the route, relative to its parent(s). |
284275
| `title: string` | The title property is the text that will appear in the Tools or Utils Selectors (this is irrelevant on hidden routes). |
285276

babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = function (api) {
5050
],
5151
],
5252
plugins: [
53+
"istanbul",
5354
[
5455
"module-resolver",
5556
{

cypress.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { defineConfig } from 'cypress'
2+
3+
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;
17+
},
18+
},
19+
})

cypress/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": ["plugin:cypress/recommended"]
3+
}

cypress/e2e/home/home.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
describe('Landing Page', () => {
2+
beforeEach(() => cy.visit('/'))
3+
it('loads landing page should be successfully', () => {
4+
cy.get('[data-cy="root"]').should('be.visible')
5+
})
6+
})

cypress/support/commands.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference types="cypress" />
2+
3+
Cypress.on('uncaught:exception', () => {
4+
// returning false here prevents Cypress from failing the test
5+
return false
6+
})
7+
8+
export {}

cypress/support/e2e.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import '@cypress/code-coverage/support'
2+
import './commands'

cypress/tsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"include": ["./**/*.ts"],
4+
"exclude": [],
5+
"compilerOptions": {
6+
"types": ["cypress"],
7+
"lib": ["es2015", "dom"],
8+
"isolatedModules": false,
9+
"allowJs": true,
10+
"noEmit": true
11+
}
12+
}

0 commit comments

Comments
 (0)