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

Enable E2E deploy tests on publish #37019

Merged
merged 4 commits into from
May 21, 2022
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
41 changes: 41 additions & 0 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,47 @@ jobs:
- run: ./scripts/publish-native.js $GITHUB_REF
- run: ./scripts/publish-release.sh

testDeployE2E:
name: E2E (deploy)
runs-on: ubuntu-latest
needs: [publishRelease]
env:
NEXT_TELEMETRY_DISABLED: 1
NEXT_TEST_JOB: 1
VERCEL_TEST_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }}
VERCEL_TEST_TEAM: 'vtest314-next-e2e-tests'
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true

- uses: actions/cache@v3
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}

- run: npm i -g playwright-chromium@1.14.1 && npx playwright install-deps
ijjk marked this conversation as resolved.
Show resolved Hide resolved
name: Install playwright dependencies

- run: RESET_VC_PROJECT=true node scripts/reset-vercel-project.mjs
name: Reset test project

- run: NEXT_TEST_MODE=deploy node run-tests.js --type e2e
name: Run test/e2e (deploy)

- name: Upload test trace
if: always()
ijjk marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/upload-artifact@v3
with:
name: test-trace
if-no-files-found: ignore
retention-days: 2
path: |
test/traces

releaseStats:
name: Release Stats
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion scripts/reset-vercel-project.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fetch from 'node-fetch'

export const TEST_PROJECT_NAME = 'vtest314-e2e-tests'
export const TEST_TEAM_NAME = 'vtest314-next-e2e-tests'
export const TEST_TEAM_NAME = process.env.VERCEL_TEST_TEAM
export const TEST_TOKEN = process.env.VERCEL_TEST_TOKEN

async function resetProject() {
Expand Down
29 changes: 16 additions & 13 deletions test/e2e/i18n-api-support/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,21 @@ describe('i18n API support', () => {
expect(await res.text()).toBe('blog/[slug]')
})

it('should fallback rewrite non-matching API request', async () => {
const paths = [
'/fr/api/hello',
'/en/api/blog/first',
'/en/api/non-existent',
'/api/non-existent',
]
// TODO: re-enable after this is fixed to match on Vercel
if (!(global as any).isNextDeploy) {
it('should fallback rewrite non-matching API request', async () => {
const paths = [
'/fr/api/hello',
'/en/api/blog/first',
'/en/api/non-existent',
'/api/non-existent',
]

for (const path of paths) {
const res = await fetchViaHTTP(next.url, path)
expect(res.status).toBe(200)
expect(await res.text()).toContain('Example Domain')
}
})
for (const path of paths) {
const res = await fetchViaHTTP(next.url, path)
expect(res.status).toBe(200)
expect(await res.text()).toContain('Example Domain')
}
})
}
})
5 changes: 5 additions & 0 deletions test/e2e/manual-client-base-path/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import assert from 'assert'
import { check, waitFor } from 'next-test-utils'

describe('manual-client-base-path', () => {
if ((global as any).isNextDeploy) {
it('should skip deploy', () => {})
return
}

let next: NextInstance
let server: http.Server
let appPort: string
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/views-dir/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ import cheerio from 'cheerio'
import webdriver from 'next-webdriver'

describe('views dir', () => {
if ((global as any).isNextDeploy) {
it('should skip next deploy for now', () => {})
return
}

if (process.env.NEXT_TEST_REACT_VERSION === '^17') {
it('should skip for react v17', () => {})
return
Expand Down