Enable E2E deploy tests on publish (#37019)

* Enable E2E deploy tests on publish

* update e2e tests

* add job name
This commit is contained in:
JJ Kasper 2022-05-21 04:46:16 -05:00 committed by GitHub
parent 33c837b115
commit 2411d368d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 68 additions and 14 deletions

View file

@ -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
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()
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

View file

@ -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() {

View file

@ -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')
}
})
}
})

View file

@ -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

View file

@ -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