Skip to content

Commit

Permalink
fix: cypress updated to 12.17.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehsan Mirzarazi committed Feb 20, 2024
1 parent 19159dc commit 309f398
Show file tree
Hide file tree
Showing 6 changed files with 522 additions and 159 deletions.
72 changes: 15 additions & 57 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,9 @@ on:
jobs:
# Verifies the boilerplate can start and run in GitHub Actions environment
test-for-workflow:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3
bundler-cache: true
- name: Install jq
run: sudo apt-get install jq
- name: Extract port from cypress.json
id: vars
run: |
apiUrl=$(jq -r '.env.apiUrl // .baseUrl // empty' ./cypress.json)
if [[ -z "$apiUrl" ]]; then
echo "API URL or Base URL not found in cypress.json."
exit 1
fi
port=$(echo $apiUrl | grep -o '[0-9]\+')
if [[ -z "$port" ]]; then
echo "Port not found in URL."
exit 1
fi
echo "Extracted port: $port"
echo "::set-output name=port::$port"
- name: Run tests
uses: cypress-io/github-action@v5
with:
build: npm run build
start: npm run start
wait-on: 'npx wait-on --timeout ${{ env.WAIT_ON_TIMEOUT }} tcp:${{ steps.vars.outputs.port }}'
env:
WAIT_ON_TIMEOUT: ${{ vars.WAIT_ON_TIMEOUT }}

name: Alva test workflow
uses: DevSkillsHQ/publish-test-results-workflow/.github/workflows/publish-test-results.yml@main

# Verifies the boilerplate can start and run in codespace environment
test-for-codespaces:
runs-on: ubuntu-20.04
Expand All @@ -65,29 +28,24 @@ jobs:
uses: actions/checkout@v4
- name: Install jq
run: sudo apt-get install jq
- name: Extract port from cypress.json
id: vars
- name: Fetch apiUrl
run: |
apiUrl=$(jq -r '.env.apiUrl // .baseUrl // empty' ./cypress.json)
if [[ -z "$apiUrl" ]]; then
echo "API URL or Base URL not found in cypress.json."
exit 1
fi
port=$(echo $apiUrl | grep -o '[0-9]\+')
if [[ -z "$port" ]]; then
echo "Port not found in URL."
exit 1
apiUrl=$(grep "apiUrl:" cypress.config.js | awk -F": " '{print $2}' | tr -d "'," || echo "")
if [[ ! -z "$apiUrl" ]]; then
apiUrl="$apiUrl/ping"
fi
echo "Extracted port: $port"
echo "::set-output name=port::$port"
- name: Run tests
echo "apiUrl=$apiUrl" >> $GITHUB_ENV
shell: bash
# Running tests for all challenges except Backend.
- name: Run tests without waiting on API
if: env.apiUrl == ''
uses: cypress-io/github-action@v5
with:
build: npm run build
start: npm run start
wait-on: 'npx wait-on --timeout ${{ env.WAIT_ON_TIMEOUT }} tcp:${{ steps.vars.outputs.port }}'
env:
WAIT_ON_TIMEOUT: ${{ vars.WAIT_ON_TIMEOUT }}

check-dependabot:
needs:
Expand Down
15 changes: 15 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
env: {
apiUrl: 'http://localhost:8000/api',
},
e2e: {
supportFile: false,
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
},
})
5 changes: 0 additions & 5 deletions cypress.json

This file was deleted.

File renamed without changes.
Loading

0 comments on commit 309f398

Please sign in to comment.