Skip to content

Commit

Permalink
ci: add use-side e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
KermanX committed Mar 2, 2024
1 parent d9302ac commit fa7574c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 10 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/userside.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,17 @@ jobs:
working-directory: ../temp/slidev-project
if: ${{ matrix.pm == 'yarn' }}

- name: Test build and export command in project
run: |
pnpm build
pnpm export --timeout 300000
pnpm export --per-slide --timeout 300000
- name: Test build command in project
run: pnpm build
working-directory: ../temp/slidev-project

- name: E2E test in global mode
uses: cypress-io/github-action@v4
with:
project: ${{ github.workspace }}
install-command: echo
build: echo
start: pnpm dev
working-directory: ../temp/slidev-project

- name: Install globally
Expand All @@ -97,10 +103,16 @@ jobs:
run: pnpm --package=cpy-cli dlx cpy ./packages/slidev/template.md ../temp/
if: ${{ matrix.pm != 'yarn' }}

- name: Test build and export command in global mode
run: |
slidev build template.md
slidev export template.md --timeout 300000
slidev export template.md --per-slide --timeout 300000
- name: Test build command in global mode
run: slidev build template.md
if: ${{ matrix.pm != 'yarn' }}
working-directory: ../temp

- name: E2E test in global mode
uses: cypress-io/github-action@v4
with:
project: ${{ github.workspace }}
install-command: echo
build: echo
start: slidev template.md
working-directory: ../temp
32 changes: 32 additions & 0 deletions cypress/e2e/examples/noError.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
context('No error', () => {
async function testAllSlides() {
while (1) {
let oldUrl, newUrl
cy.get('body')
.url().then(url => (oldUrl = url))
.type(`{RightArrow}`)
.wait(1000)
.url().then(url => (newUrl = url))
if (oldUrl === newUrl)
break
}
}

it('should throw no error in Play mode', async () => {
cy.visit('/').wait(4000)
await testAllSlides()
})

it('should throw no error in Presenter mode', async () => {
cy.visit('/presenter').wait(4000)
await testAllSlides()
})

it('should throw no error in Overview page', async () => {
cy.visit('/overview').wait(4000)
})

it('should throw no error in Entry page', async () => {
cy.visit('/entry').wait(4000)
})
})

0 comments on commit fa7574c

Please sign in to comment.