[Unit Tests]: setItem
and getItem
#1504
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cypress Tests | |
on: | |
pull_request: | |
branches: | |
- "*" | |
jobs: | |
get-cypress-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: ./sphinx-tribes-frontend | |
- name: Debug test files | |
working-directory: ./sphinx-tribes-frontend | |
run: | | |
find cypress/e2e -name '*.spec.js' -o -name '*.cy.ts' | jq -R -s -c 'split("\n") | map(select(. != ""))' | |
- name: List Cypress test files | |
id: list-tests | |
working-directory: ./sphinx-tribes-frontend | |
run: | | |
tests=$(find cypress/e2e -name '*.spec.js' -o -name '*.cy.ts' | jq -R -s -c 'split("\n") | map(select(. != ""))') | |
if [ -z "$tests" ]; then | |
echo "No Cypress test files found." | |
tests="[]" | |
fi | |
echo "tests=$tests" >> $GITHUB_OUTPUT | |
outputs: | |
tests: ${{ steps.list-tests.outputs.tests }} | |
cypress: | |
name: Cypress | |
runs-on: ubuntu-latest | |
needs: get-cypress-tests | |
strategy: | |
fail-fast: false | |
matrix: | |
file: ${{ fromJson(needs.get-cypress-tests.outputs.tests) }} | |
steps: | |
- name: Enable docker.host.internal for Ubuntu | |
run: | | |
pwd && sudo bash -c 'echo "172.17.0.1 host.docker.internal" >> /etc/hosts' | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Clone Stack | |
run: | | |
git clone --single-branch --branch change_v2_ports https://github.com/stakwork/sphinx-stack.git stack | |
- name: Give Permissions to Sphinx Tribes Frontend | |
run: chmod 777 -R cypress | |
- name: Give Permissions to Stack | |
working-directory: ./stack | |
run: | | |
chmod 777 ./bitcoind; | |
chmod 777 -R ./relay; | |
chmod 777 -R ./lnd; | |
chmod 777 -R ./proxy; | |
chmod 777 -R ./cln; | |
- name: Check for NODES | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 10 | |
max_attempts: 3 | |
command: | | |
GITACTION_ENV=gitactionenv docker compose -f ./stack/alts/v1v2.yml --project-directory ./stack up -d; | |
sleep 240; | |
docker ps | |
docker logs alice.sphinx | |
docker logs meme.sphinx | |
docker logs dave.sphinx | |
docker logs tribes.sphinx | |
docker wait stack_relaysetup_1 | |
cat stack/relay/NODES.json; | |
cat stack/relay/V2NODES.json; | |
- name: Copy Node.json | |
uses: canastro/copy-file-action@master | |
with: | |
source: 'stack/relay/NODES.json' | |
target: 'cypress/fixtures/nodes.json' | |
- name: Copy V2Node.json | |
uses: canastro/copy-file-action@master | |
with: | |
source: 'stack/relay/V2NODES.json' | |
target: 'cypress/fixtures/v2nodes.json' | |
- name: Sanitize Test File Path | |
run: echo "SANITIZED_FILE=$(echo ${{ matrix.file }} | sed 's/\//_/g')" >> $GITHUB_ENV | |
- name: Install Frontend Dependencies | |
run: yarn install | |
- name: Cypress run | |
# Uses the official Cypress GitHub action https://github.com/cypress-io/github-action | |
uses: cypress-io/github-action@v6 | |
with: | |
install-command: yarn --immutable | |
browser: chrome | |
headless: true | |
start: yarn run start:cypress | |
spec: ${{ matrix.file }} | |
wait-on: "http://localhost:3007" # Waits for above | |
wait-on-timeout: 120 # Waits for 2 minutes | |
record: false | |
video: true | |
# - name: Component tests | |
# run: yarn run cy-comp | |
# continue-on-error: false | |
# - name: Start Server | |
# run: yarn run start:cypress & | |
# - name: Run Cypress Test | |
# run: | | |
# sleep 20 | |
# yarn run cypress:run | |
- name: Upload Cypress logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ env.SANITIZED_FILE }}-cypress-logs" | |
path: cypress/videos | |
- name: Stop Stack | |
working-directory: ./stack | |
run: docker compose down |