Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: list content of cypress directory #2202

Merged
merged 17 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 19 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
- master
jobs:
get-cypress-tests:
runs-on:
ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -18,7 +17,6 @@ jobs:
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-nav-fiber
Expand Down Expand Up @@ -51,8 +49,8 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
node-version-file: ".nvmrc"
cache: "yarn"
- name: Clone Stack
run: |
git clone https://github.com/stakwork/sphinx-stack.git stack
Expand Down Expand Up @@ -101,8 +99,8 @@ jobs:
- name: Copy Node.json
uses: canastro/copy-file-action@master
with:
source: 'stack/relay/NODES.json'
target: 'relay/nodes.json'
source: "stack/relay/NODES.json"
target: "relay/nodes.json"

- name: Install
run: yarn --immutable
Expand All @@ -116,26 +114,32 @@ jobs:
headless: true
start: yarn run start-e2e
spec: ${{ matrix.file }}
wait-on: 'http://localhost:3000' # Waits for above
wait-on: "http://localhost:3000" # Waits for above
wait-on-timeout: 120 # Waits for 2 minutes
# Records to Cypress Dashboard
record: true
record: false
video: true
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# created by the GH Action automatically
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Component tests
run: yarn run cy-comp
continue-on-error: false
# - name: Component tests
# run: yarn run cy-comp
# continue-on-error: false

- name: Sanitize Test File Path
run: echo "SANITIZED_FILE=$(echo ${{ matrix.file }} | sed 's/\//_/g')" >> $GITHUB_ENV

- name: Debug sanitized file
run: echo "Sanitized file $SANITIZED_FILE"

- name: Upload Cypress logs
if: failure()
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-logs
name: "${{ env.SANITIZED_FILE }}-cypress-logs"
path: cypress/videos


- name: Stop Stack
working-directory: ./stack
run: docker compose down
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default defineConfig({
watchForFileChanges: false,
experimentalMemoryManagement: true,
numTestsKeptInMemory: 1,
video: false,
video: true,
},
component: {
supportFile: './cypress/support/components.ts',
Expand Down
13 changes: 12 additions & 1 deletion cypress/e2e/addContent/addWebpage.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ describe('Add Webpage Content', () => {
cy.get('[data-testid="skip-location-btn"').click()
cy.get('[data-testid="check-icon"]').click()

cy.wait('@addWebpage')
cy.wait('@addWebpage').then((interception) => {
//check we get a 402 response code, when trying to add content for the first time
expect(interception.response.statusCode).to.eq(402)
})

cy.intercept({
method: 'POST',
url: 'http://localhost:8444/api/add_node*',
}).as('addWebpage2')

cy.wait('@addWebpage2')

cy.get('.Toastify__toast-body').should('have.text', 'Content Added')
cy.get('#addContent').should('not.exist')
})
Expand Down
13 changes: 12 additions & 1 deletion cypress/e2e/addContent/addYoutube.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ describe('Add Youtube Content', () => {
cy.get('[data-testid="skip-location-btn"').click()
cy.get('[data-testid="check-icon"]').click()

cy.wait('@addYoutube')
cy.wait('@addYoutube').then((interception) => {
//check we get a 402 response code, when trying to add content for the first time
expect(interception.response.statusCode).to.eq(402)
})

cy.intercept({
method: 'POST',
url: 'http://localhost:8444/api/add_node*',
}).as('addYoutube2')

cy.wait('@addYoutube2')

cy.get('.Toastify__toast-body').should('have.text', 'Content Added')
cy.get('#addContent').should('not.exist')
})
Expand Down
Loading