test: check that JS projects can be submitted. (#43222)

* test: check that JS projects can be submitted.

* refactor: remove stale workflow comments

* refactor: remove redundant build

* chore: update Cypress version in CI

* test: create separate electron-only workflow

* test: put data-cy on correct button

* test: drop mailhog from electron CI

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>

* refactor: update differences comment

* test: separate toggling from logging in

* test: check solutions can be viewed on cert

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
Oliver Eyton-Williams
2021-08-24 20:26:48 +02:00
committed by GitHub
parent 5371af7767
commit d161998acc
8 changed files with 185 additions and 18 deletions

83
.github/workflows/cypress-electron.yml vendored Normal file
View File

@@ -0,0 +1,83 @@
# Mirrors the Cypress workflow with the following changes:
# - Cypress run has a spec
# - We create the stats.json file here since the workflow only runs once.
# - Mailhog is missing since none of the tests use it.
name: Cypress Electron
on:
push:
branches-ignore:
- 'renovate/**'
pull_request:
jobs:
cypress-run:
name: Test
runs-on: ubuntu-18.04
strategy:
matrix:
browsers: [electron]
node-version: [14.x]
services:
mongodb:
image: mongo:3.6.19
ports:
- 27017:27017
steps:
# We use .npmrc to set the default version to 0, and prevents download during development.
# This installs it specifically in the CI runs.
- name: Set Action Environment Variables
run: |
echo "CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }}" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "CYPRESS_INSTALL_BINARY=7.7.0" >> $GITHUB_ENV
- name: Checkout Source Files
uses: actions/checkout@v2
- name: Checkout client config
uses: actions/checkout@v2
with:
repository: freeCodeCamp/client-config
path: client-config
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Set freeCodeCamp Environment Variables
run: cp sample.env .env
- name: Install Dependencies
run: |
npm ci
npm run ensure-env
- name: Move serve.json to client
run: |
mkdir -p client/public
cp client-config/serve.json client/public/serve.json
- name: Seed Database
run: npm run seed
- name: Cypress run
uses: cypress-io/github-action@v2
with:
record: ${{ env.CYPRESS_RECORD_KEY != 0 }}
build: npm run build
start: npm run start-ci
wait-on: http://localhost:8000
wait-on-timeout: 1200
config: baseUrl=http://localhost:8000
browser: ${{ matrix.browsers }}
spec: 'cypress/integration/learn/challenges/projects.js'
headless: true
- name: Upload Webpack stats
uses: actions/upload-artifact@v2
with:
name: webpack-stats
path: client/public/stats.json

View File

@@ -31,7 +31,7 @@ jobs:
run: |
echo "CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }}" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "CYPRESS_INSTALL_BINARY=7.1.0" >> $GITHUB_ENV
echo "CYPRESS_INSTALL_BINARY=7.7.0" >> $GITHUB_ENV
- name: Checkout Source Files
uses: actions/checkout@v2
@@ -55,7 +55,6 @@ jobs:
run: |
npm ci
npm run ensure-env
npm run build:curriculum
- name: Move serve.json to client
run: |
@@ -70,19 +69,9 @@ jobs:
with:
record: ${{ env.CYPRESS_RECORD_KEY != 0 }}
build: npm run build
# this should mirror the production build, but for now we're using gatsby
# serve instead (the npm script serve:client needs updating!)
start: npm run start-ci
wait-on: http://localhost:8000
# the site builds in about 8 minutes, so there is currently 12 minutes of time
# left for testing.
wait-on-timeout: 1200
config: baseUrl=http://localhost:8000
browser: ${{ matrix.browsers }}
headless: true
- name: Upload Webpack stats
uses: actions/upload-artifact@v2
with:
name: webpack-stats
path: client/public/stats.json