Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
b8d54e6
TCA-366 - Certificate view is flickering when trackType isn't DEV
vas3a Aug 29, 2022
a2e92aa
lint fixes
vas3a Aug 29, 2022
cd4ef32
TCA-367 - FCC page: check if url params are valid, if not redirect to…
vas3a Aug 30, 2022
8edfcaf
lint fixes
vas3a Aug 30, 2022
98fa2b0
Merge pull request #277 from topcoder-platform/TCA-366_certificate-fl…
vas3a Aug 30, 2022
f944b9a
TCA-376 - refetch course progress data when user opens sidebar nav
vas3a Aug 30, 2022
da181d4
Merge pull request #278 from topcoder-platform/TCA-367_fcc-page-param…
vas3a Aug 30, 2022
5bdbe6b
Final fix: Landing page thrive update, Getting Started Guide update
billsedison Aug 31, 2022
4e1ce72
Merge branch 'dev' into dev-center
billsedison Aug 31, 2022
c088faa
Update getting started guide
billsedison Aug 31, 2022
29bec27
Merge pull request #280 from topcoder-platform/gamification
kkartunov Aug 31, 2022
e9531e5
add e2e commands (#282)
LieutenantRoger Aug 31, 2022
4926673
Merge pull request #279 from topcoder-platform/TCA-376_refetch-course…
vas3a Aug 31, 2022
b8b1953
TCA-60 #comment This commit purposely creates a failing test in order…
brooketopcoder Aug 31, 2022
7cf193e
TCA-60 #comment This commit makes the test pass again #time 5m
brooketopcoder Aug 31, 2022
1cd35ea
TCA-60 #comment This commit changes the id attribute to not be cypres…
brooketopcoder Aug 31, 2022
117cf3e
TCA-377 #comment This commit adds the See All Learning link to the co…
brooketopcoder Aug 31, 2022
4af63bb
Merge pull request #284 from topcoder-platform/TCA-377_my-learning
brooketopcoder Aug 31, 2022
feaa9e0
Merge pull request #283 from topcoder-platform/TCA-60_cypress
brooketopcoder Aug 31, 2022
81ff8dd
Merge pull request #281 from topcoder-platform/dev-center
brooketopcoder Aug 31, 2022
ba6dc17
Merge pull request #285 from topcoder-platform/gamification
brooketopcoder Aug 31, 2022
7f26191
integrate cy dashboard
LieutenantRoger Sep 1, 2022
dc8b73b
refine ci
LieutenantRoger Sep 1, 2022
f1fcdc8
refine command
LieutenantRoger Sep 1, 2022
a90128b
TCA-386 #comment This commit fixes the condition that compares undefi…
brooketopcoder Sep 1, 2022
51f0762
Merge pull request #287 from topcoder-platform/TCA-386_newly-completed
brooketopcoder Sep 1, 2022
1924926
report integration
LieutenantRoger Sep 2, 2022
3e97d80
success tests
LieutenantRoger Sep 2, 2022
37d0a32
integrate test report
LieutenantRoger Sep 2, 2022
0840b7c
test with failure case
LieutenantRoger Sep 2, 2022
2015563
Merge branch 'dev' into circle-ci-setup-v5
LieutenantRoger Sep 2, 2022
7aff7c1
skip failed e2e test cases
LieutenantRoger Sep 2, 2022
e4f4305
finalize yarn.lock file
LieutenantRoger Sep 2, 2022
ef0ddb1
Merge pull request #288 from topcoder-platform/circle-ci-setup-v5
brooketopcoder Sep 2, 2022
a1abe2f
try workflow
LieutenantRoger Sep 5, 2022
d7eb09e
correct action
LieutenantRoger Sep 5, 2022
844928f
add sudo in lib installation
LieutenantRoger Sep 5, 2022
c5efbb5
store testing result
LieutenantRoger Sep 5, 2022
648375b
correct command
LieutenantRoger Sep 5, 2022
a77f304
check failed test case
LieutenantRoger Sep 5, 2022
8934154
continue on error
LieutenantRoger Sep 5, 2022
629c933
enable cache operation
LieutenantRoger Sep 5, 2022
f757bf2
yarn cache id update
LieutenantRoger Sep 5, 2022
550330f
TCA-400 - update behavior for fcc sidebar (course outline navigation)
vas3a Sep 7, 2022
97d9287
lint
vas3a Sep 7, 2022
5cf3d8f
TCA-404 #comment This commit tweaks for formatting of the cypress con…
brooketopcoder Sep 7, 2022
11fb137
TCA-404 #comment This commit does a little bit more clean-up #time 10m
brooketopcoder Sep 7, 2022
f95d26f
TCA-404 #comment This comment removes extraneous code that was in the…
brooketopcoder Sep 7, 2022
33952f5
TCA-404 #comment This commit fixes the base url in source control #ti…
brooketopcoder Sep 7, 2022
b835cfe
TCA-404 fix base url
brooketopcoder Sep 7, 2022
5f784fd
Merge pull request #290 from topcoder-platform/TCA-404_cypress-tweaks
brooketopcoder Sep 7, 2022
ea43c8a
TCA-400 - use the clickoutside hook
vas3a Sep 7, 2022
0b30d96
Merge remote-tracking branch 'origin/dev' into TCA-400_update-fcc-sid…
vas3a Sep 7, 2022
8a26d92
Merge pull request #289 from topcoder-platform/TCA-400_update-fcc-sid…
vas3a Sep 7, 2022
c6b0434
TCA-336 #comment This commit forces a dev deployment to see if it's a…
brooketopcoder Sep 7, 2022
1e2fdcc
TCA-400 #comment This commit temporarily skips the cypress test bc th…
brooketopcoder Sep 8, 2022
0ea5ece
Merge pull request #291 from topcoder-platform/TCA-400_update-fcc-sid…
brooketopcoder Sep 8, 2022
9823c1a
refine e2e
LieutenantRoger Sep 9, 2022
d77db70
include env var
LieutenantRoger Sep 9, 2022
db39b00
env prepare
LieutenantRoger Sep 9, 2022
2175923
remove test env
LieutenantRoger Sep 9, 2022
273ea59
Merge branch 'dev' into circle-ci-setup-v7
LieutenantRoger Sep 9, 2022
33eac90
merge dev
LieutenantRoger Sep 9, 2022
6ecf7f3
try fail and deploy
LieutenantRoger Sep 9, 2022
10ce989
reset
LieutenantRoger Sep 9, 2022
83446a1
execute test
LieutenantRoger Sep 9, 2022
f6ce5cb
switch the command seqneuce
LieutenantRoger Sep 9, 2022
efe4e01
TCA-408 clean up for dev #time 10m
brooketopcoder Sep 9, 2022
3099419
Merge pull request #292 from topcoder-platform/circle-ci-setup-v7
brooketopcoder Sep 9, 2022
5847cac
TCA-440: call certification completion based on assessment completion
vas3a Sep 15, 2022
0ea5539
lint fix
vas3a Sep 15, 2022
51c9207
TCA-444 - Learn Landing Header content
vas3a Sep 15, 2022
cfeb2d4
lint fixes
vas3a Sep 15, 2022
0675ff5
Merge pull request #295 from topcoder-platform/TCA-444_tca-landing-he…
vas3a Sep 15, 2022
1468545
Merge pull request #294 from topcoder-platform/TCA-440_certificate-pr…
vas3a Sep 15, 2022
cde8c84
TCA-440 - add slider on homepage with user's latest progress
vas3a Sep 16, 2022
dbeb9ad
update default active slider
vas3a Sep 16, 2022
f4d55e5
TCA-428 - add "completion suggestions" on course landing page
vas3a Sep 16, 2022
6233f09
Merge pull request #296 from topcoder-platform/TCA-440_certificate-pr…
vas3a Sep 16, 2022
8d89e85
Merge pull request #297 from topcoder-platform/TCA-428_ui-for-course-…
vas3a Sep 19, 2022
99d3260
Merge pull request #299 from topcoder-platform/TCA-413_learn-homepage…
vas3a Sep 19, 2022
03cd149
dedicated checkbox input init
kkartunov Sep 20, 2022
460cd29
GAME-108 #comment This commit adapts the InputText component to suppo…
brooketopcoder Sep 20, 2022
8d9582a
Merge pull request #301 from topcoder-platform/GAME-108_bjcs
kkartunov Sep 21, 2022
e8b5069
fix checkbox init and clean up
kkartunov Sep 21, 2022
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
77 changes: 44 additions & 33 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ deploy_defaults: &deploy_defaults
docker:
- image: cimg/python:3.10.2

test_defaults: &test_defaults
docker:
- image: cypress/browsers:node16.14.2-slim-chrome100-ff99-edge

install_build_dependency: &install_build_dependency
name: Installation of build and deployment dependencies.
command: |
Expand Down Expand Up @@ -50,6 +54,14 @@ running_yarn_build: &running_yarn_build
yarn install
yarn build
running_yarn_test: &running_yarn_test
name: Running Yarn Test Build
command: |
yarn install
yarn cypress install
yarn build
yarn cy:ci
workspace_persist: &workspace_persist
root: .
paths:
Expand Down Expand Up @@ -81,6 +93,27 @@ build_steps: &build_steps
- run: *running_yarn_build
- persist_to_workspace: *workspace_persist

test_steps: &test_steps
# Initialization.
- checkout
- setup_remote_docker
- restore_cache:
key: test-node-modules-{{ checksum "yarn.lock" }}
- run: *running_yarn_test
- save_cache:
key: test-node-modules-{{ checksum "yarn.lock" }}
paths:
- node_modules
- /root/.cache/Cypress
- store_test_results:
path: cypress/test-report
- store_artifacts:
path: cypress/test-report
- store_artifacts:
path: cypress/videos
- store_artifacts:
path: cypress/screenshots

deploy_steps: &deploy_steps
- checkout
- attach_workspace: *workspace_attach
Expand Down Expand Up @@ -127,6 +160,14 @@ jobs:
LOGICAL_ENV: "prod"
APPNAME: "platform-ui-mvp"
steps: *build_steps

test-dev:
<<: *test_defaults
environment:
DEPLOY_ENV: "DEV"
LOGICAL_ENV: "dev"
APPNAME: "platform-ui-mvp"
steps: *test_steps

# Just tests commited code.
deployDev:
Expand All @@ -147,35 +188,6 @@ jobs:
APPNAME: "platform-ui-mvp"
steps: *deploy_steps

# Test job for the cases when we don not need deployment.
e2e-test:
docker:
- image: cypress/browsers:node16.14.2-slim-chrome100-ff99-edge
steps:
- checkout
- restore_cache:
key: test-node-modules-{{ checksum "yarn.lock" }}
- run:
name: Config Git
command: git config --global url."https://git@".insteadOf git://
- run:
name: Install Dependencies
command: yarn install
no_output_timeout: 20m
- run:
name: Install Cypress Binary
command: yarn cypress install
- run:
name: Build the application
command: yarn build
no_output_timeout: 20m
- save_cache:
key: test-node-modules-{{ checksum "yarn.lock" }}
paths:
- node_modules
- /root/.cache/Cypress
- run: yarn cy:ci

workflows:
version: 2
build:
Expand All @@ -201,9 +213,6 @@ workflows:
ignore:
- master

- e2e-test:
context : org-global

- build-prod:
context : org-global
filters:
Expand All @@ -215,7 +224,6 @@ workflows:
context : org-global
requires:
- build-dev
- e2e-test
filters:
branches:
only:
Expand All @@ -229,3 +237,6 @@ workflows:
branches:
only:
- master

- test-dev:
context : org-global
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# testing
/coverage
.nyc_output
/cypress/screenshots
/cypress/videos
/cypress/test-report

# production
/build
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ See the [Dev Center README](/src-ts/tools/dev-center/README.md) for further inst
| `yarn eslint` | Run eslint against js/x files and outputs report |
| `yarn eslint:fix` | Run eslint against js/x files, fixes auto-fixable issues, and outputs report |
| `yarn test` | Run unit tests, watching for changes and re-running per your specifications |
| `yarn test:no-watch` | Run unit tests once, without watching for changes or re-running |
| `yarn test:no-watch` | Run unit tests once, without watching for changes or re-running |
| `yarn cy:run` | Run e2e tests once in local command with the site is running |
| `yarn cy:ci` | Run e2e tests once by circle ci |
| `yarn report:coverage`| Generate e2e coverage report in html format |
| `yarn report:coverage:text` | Generate e2e coverage report in text format |

## Folder Structure

Expand Down
42 changes: 28 additions & 14 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
// tslint:disable-next-line: no-submodule-imports This is the way cypress does it
import task from '@cypress/code-coverage/task'
import { defineConfig } from 'cypress'

export default defineConfig({
fixturesFolder: false,
video: false,
screenshotOnRunFailure: false,
defaultCommandTimeout: 10000,
e2e: {
baseUrl: 'http://localhost:3000',
specPattern: "cypress/e2e/**/*.spec.{js,jsx,ts,tsx}",
supportFile: "cypress/support/e2e.ts",
viewportHeight: 1000,
viewportWidth: 1280,
setupNodeEvents(on, config) {
require('@cypress/code-coverage/task')(on, config)
return config;
defaultCommandTimeout: 10000,
e2e: {
// baseUrl: 'https://local.topcoder-dev.com',
baseUrl: 'http://localhost:3000',
setupNodeEvents: setUpNodeEvents,
specPattern: 'cypress/e2e/**/*.spec.{js,jsx,ts,tsx}',
supportFile: 'cypress/support/e2e.ts',
viewportHeight: 1000,
viewportWidth: 1280,
},
},
fixturesFolder: false,
reporter: 'junit',
reporterOptions: {
mochaFile: 'cypress/test-report/test-result-[hash].xml',
toConsole: false,
},
screenshotOnRunFailure: true,
video: true,
})

// adds the config to node setup events
function setUpNodeEvents(
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
): Cypress.PluginConfigOptions {
task(on, config)
return config
}
14 changes: 10 additions & 4 deletions cypress/e2e/home/home.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
describe('Landing Page', () => {
beforeEach(() => cy.visit('/'))
it('loads landing page should be successfully', () => {
cy.get('[data-cy="root"]').should('be.visible')
})

beforeEach(() => cy.visit('/'))

it('loads landing page should be successfully', () => {
cy.get('[data-id="root"]').should('be.visible')
})

it.skip('loads landing page should fail', () => {
cy.get('[data-id="root"]').should('not.be.visible')
})
})
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@
"eslint:fix": "eslint 'src/**/*.{js,jsx}' --fix",
"test": "react-scripts test --watchAll",
"test:no-watch": "react-scripts test --watchAll=false --passWithNoTests",
"cy:run": "cypress run",
"cy:run": "cypress run --reporter junit",
"cy:ci": "start-server-and-test 'serve -s build -n -p 3000' http://localhost:3000 'cy:run'",
"report:coverage": "nyc report --reporter=html",
"report:coverage:text": "nyc report --reporter=text"
},
"dependencies": {
"@datadog/browser-logs": "^4.7.1",
"@heroicons/react": "^1.0.6",
"@types/dompurify": "^2.3.3",
"@types/highlightjs": "^9.12.2",
"@types/marked": "4.0.3",
"apexcharts": "^3.35.3",
"axios": "^0.26.1",
"browser-cookies": "^1.2.0",
Expand Down Expand Up @@ -82,8 +79,12 @@
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
"@types/axios": "^0.14.0",
"@types/cypress": "^1.1.3",
"@types/dompurify": "^2.3.3",
"@types/highlightjs": "^9.12.2",
"@types/jest": "^27.0.1",
"@types/lodash": "^4.14.182",
"@types/marked": "4.0.3",
"@types/node": "^18.7.13",
"@types/reach__router": "^1.3.10",
"@types/react": "^18.0.5",
Expand All @@ -94,6 +95,7 @@
"@types/segment-analytics": "^0.0.34",
"@types/systemjs": "^6.1.0",
"@types/uuid": "^8.3.4",
"@wdio/junit-reporter": "^7.24.0",
"autoprefixer": "^9.8.6",
"babel-eslint": "^11.0.0-beta.2",
"babel-jest": "^24.9.0",
Expand Down
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root" data-cy="root"></div>
<div id="root" data-id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand All @@ -45,4 +45,4 @@
-->
</body>

</html>
</html>
2 changes: 2 additions & 0 deletions src-ts/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
declare module '@cypress/code-coverage/task'

declare module '*.html' {
const htmlFile: string
export = htmlFile
Expand Down
18 changes: 14 additions & 4 deletions src-ts/lib/form/form-functions/form.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,13 @@ export function initializeValues<T>(inputs: Array<FormInputModel>, formValues?:
inputs
.filter(input => !input.dirty && !input.touched)
.forEach(input => {
input.value = !!(formValues as any)?.hasOwnProperty(input.name)
? (formValues as any)[input.name]
: undefined
if (input.type === 'checkbox') {
input.value = input.checked || false
} else {
input.value = !!(formValues as any)?.hasOwnProperty(input.name)
? (formValues as any)[input.name]
: undefined
}
})
}

Expand Down Expand Up @@ -121,7 +125,13 @@ function handleFieldEvent<T>(input: HTMLInputElement | HTMLTextAreaElement, inpu
inputDef.touched = true

// set the def value
inputDef.value = input.value
if (input.type === 'checkbox') {
const checkbox: HTMLInputElement = input as HTMLInputElement
inputDef.value = checkbox.checked
inputDef.checked = checkbox.checked
} else {
inputDef.value = input.value
}

// now let's validate the field
const formElements: HTMLFormControlsCollection = (input.form as HTMLFormElement).elements
Expand Down
38 changes: 29 additions & 9 deletions src-ts/lib/form/form-groups/FormGroups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ const FormGroups: (props: FormGroupsProps) => JSX.Element = (props: FormGroupsPr

const { formDef, onBlur, onChange }: FormGroupsProps = props

const getTabIndex: (input: FormInputModel, index: number) => number = (input, index) => {
function getTabIndex(input: FormInputModel, index: number): number {
const tabIndex: number = input.notTabbable ? -1 : index + 1 + (formDef.tabIndexStart || 0)
return tabIndex
}

const renderInputField: (input: FormInputModel, index: number) => JSX.Element | undefined = (input, index) => {
function renderInputField(input: FormInputModel, index: number): JSX.Element | undefined {

const tabIndex: number = getTabIndex(input, index)

let inputElement: JSX.Element
Expand All @@ -40,23 +41,33 @@ const FormGroups: (props: FormGroupsProps) => JSX.Element = (props: FormGroupsPr
{...input}
onChange={onChange}
tabIndex={tabIndex}
value={input.value}
value={input.value as number | undefined}
/>
)
break

case 'textarea':
inputElement = (
<InputTextarea
{...input}
onBlur={onBlur}
onChange={onChange}
tabIndex={tabIndex}
value={input.value}
value={input.value as string | undefined}
/>
)
break
case 'checkbox':
inputElement = (
<InputText
{...input}
checked={!!input.value}
onBlur={onBlur}
onChange={onChange}
tabIndex={tabIndex}
type='checkbox'
/>
)
break
case 'radio':
inputElement = (
<FormRadio
Expand All @@ -83,7 +94,7 @@ const FormGroups: (props: FormGroupsProps) => JSX.Element = (props: FormGroupsPr
onChange={onChange}
tabIndex={tabIndex}
type={input.type as InputTextTypes || 'text'}
value={input.value}
value={input.value as string | undefined}
/>
)
break
Expand All @@ -100,9 +111,18 @@ const FormGroups: (props: FormGroupsProps) => JSX.Element = (props: FormGroupsPr
)
}

const formGroups: Array<JSX.Element | undefined> = formDef?.groups?.map((element: FormGroup, index: number) => {
return <FormGroupItem key={`element-${index}`} group={element} renderFormInput={renderInputField} totalGroupCount={formDef.groups?.length || 0} />
}) || []
const formGroups: Array<JSX.Element | undefined> = formDef?.groups
?.map((element: FormGroup, index: number) => {
return (
<FormGroupItem
key={`element-${index}`}
group={element}
renderFormInput={renderInputField}
totalGroupCount={formDef.groups?.length || 0}
/>
)
})
|| []

return (
<div className={styles['form-groups']}>
Expand Down
Loading