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: Replace tests with playwright (30-search/30-search--search.cy.ts) #9017

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
e8d4c3b
add playwright test
miya Aug 6, 2024
bfabf23
add tstid
miya Aug 6, 2024
a3940ac
add playwright test
miya Aug 7, 2024
f90cf40
Fix docker image version
miya Aug 7, 2024
ded6706
fix docker image
miya Aug 7, 2024
daf5a5c
Revert "fix docker image"
miya Aug 7, 2024
9e4031a
Revert "Fix docker image version"
miya Aug 7, 2024
4e370f9
Match the docker image with the playwright's version
miya Aug 7, 2024
8d2fedf
test ci
miya Aug 7, 2024
9481aae
rm unnecessary import
miya Aug 7, 2024
52a5c7e
Merge branch 'master' into support/148792-replace-tests-with-playwright
miya Aug 8, 2024
295bb27
imprv test
miya Aug 8, 2024
62df30a
Revert "Match the docker image with the playwright's version"
miya Aug 8, 2024
9a17430
Merge branch 'master' into support/148792-replace-tests-with-playwright
miya Aug 8, 2024
a907a9b
Revert "test ci"
miya Aug 8, 2024
6004346
test ci
miya Aug 8, 2024
6638e38
imprv test
miya Aug 8, 2024
735eb7b
add test
miya Aug 8, 2024
f3281b3
add test id
miya Aug 8, 2024
cdcbadb
ipmrv test
miya Aug 9, 2024
5277e5e
test ci
miya Aug 9, 2024
ff974f8
test ci
miya Aug 9, 2024
64cf866
test ci
miya Aug 9, 2024
bacc2cf
Revert "test ci"
miya Aug 9, 2024
f4462cd
test ci
miya Aug 9, 2024
56e3b20
test ci
miya Aug 9, 2024
9b411bd
test ci
miya Aug 9, 2024
a1f9915
test ci
miya Aug 9, 2024
6367dc9
commentout
miya Aug 9, 2024
e72f95e
test ci
miya Aug 9, 2024
614c62e
fix ci
miya Aug 9, 2024
d1b52f0
video: on
miya Aug 12, 2024
3fd1eee
test ci
miya Aug 12, 2024
c9e449e
fix indent
miya Aug 12, 2024
2eac271
change config
miya Aug 12, 2024
2a9ba53
test ci
miya Aug 13, 2024
f7e98a2
test ci
miya Aug 13, 2024
1c958ce
test ci
miya Aug 13, 2024
3495e9b
Merge branch 'master' into support/148792-replace-tests-with-playwright
miya Aug 19, 2024
91540d4
commentout
miya Aug 21, 2024
0b5ad79
fix version
miya Aug 21, 2024
636c445
Revert "fix version"
miya Aug 21, 2024
925828f
Merge branch 'master' into support/148792-replace-tests-with-playwright
miya Aug 22, 2024
e1e9ae5
add AUTO_INSTALL_ALLOW_GUEST_MODE
miya Aug 22, 2024
e98fca7
add AUTO_INSTALL_ALLOW_GUEST_MODE
miya Aug 22, 2024
c255268
add enve
miya Aug 22, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/ci-app-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ concurrency:
jobs:

test-prod-node18:
uses: weseek/growi/.github/workflows/reusable-app-prod.yml@master
uses: weseek/growi/.github/workflows/reusable-app-prod.yml@support/148792-replace-tests-with-playwright
with:
node-version: 18.x
skip-e2e-test: true
Expand All @@ -58,7 +58,7 @@ jobs:


test-prod-node20:
uses: weseek/growi/.github/workflows/reusable-app-prod.yml@master
uses: weseek/growi/.github/workflows/reusable-app-prod.yml@support/148792-replace-tests-with-playwright
with:
node-version: 20.x
skip-e2e-test: ${{ contains( github.event.pull_request.labels.*.name, 'dependencies' ) }}
Expand Down
201 changes: 34 additions & 167 deletions .github/workflows/reusable-app-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,146 +201,6 @@ jobs:
url: ${{ secrets.SLACK_WEBHOOK_URL }}



run-cypress:
needs: [build-prod]

if: ${{ !inputs.skip-e2e-test }}

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# List string expressions that is comma separated ids of tests in "test/cypress/integration"
spec-group: ['21', '30', '50']

services:
mongodb:
image: mongo:6.0
ports:
- 27017/tcp
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.1
ports:
- 9200/tcp
env:
discovery.type: single-node

steps:
- uses: actions/checkout@v4

- name: Install fonts
run: sudo apt install fonts-noto

- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install turbo
run: |
yarn global add turbo

- name: Prune repositories
run: |
turbo prune @growi/app
rm -rf apps packages
mv out/* .

- name: Restore node_modules
uses: actions/cache/restore@v4
with:
path: |
**/node_modules
# saved key by build-prod
key: node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
node_modules-app-build-prod-${{ runner.OS }}-node${{ inputs.node-version }}-

- name: Cache/Restore Cypress files
uses: actions/cache@v4
with:
path: |
~/.cache/Cypress
key: deps-for-cypress-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
deps-for-cypress-${{ runner.OS }}-node${{ inputs.node-version }}-

- name: Install dependencies
run: |
yarn global add node-gyp
yarn --frozen-lockfile
yarn cypress install

- name: Download production files artifact
uses: actions/download-artifact@v4
with:
name: Production Files (node${{ inputs.node-version }})

- name: Extract procution files artifact
run: |
tar -xf ${{ needs.build-prod.outputs.PROD_FILES }}

- name: Determine spec expression
id: determine-spec-exp
run: |
SPEC=`node bin/github-actions/generate-cypress-spec-arg.mjs --prefix="test/cypress/e2e/" --suffix="-*/*.cy.{ts,tsx}" "${{ matrix.spec-group }}"`
echo "value=$SPEC" >> $GITHUB_OUTPUT

- name: Copy dotenv file for ci
working-directory: ./apps/app
run: |
cat config/ci/.env.local.for-ci >> .env.production.local

- name: Copy dotenv file for automatic installation
if: ${{ matrix.spec-group != '10' }}
working-directory: ./apps/app
run: |
cat config/ci/.env.local.for-auto-install >> .env.production.local

- name: Copy dotenv file for automatic installation with allowing guest mode
if: ${{ matrix.spec-group == '21' }}
working-directory: ./apps/app
run: |
cat config/ci/.env.local.for-auto-install-with-allowing-guest >> .env.production.local

- name: Cypress Run
uses: cypress-io/github-action@v6
with:
browser: chromium
working-directory: ./apps/app
spec: '${{ steps.determine-spec-exp.outputs.value }}'
install: false
start: yarn server
wait-on: 'http://localhost:3000'
config: video=${{ inputs.cypress-config-video }}
env:
MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi-vrt
ELASTICSEARCH_URI: http://localhost:${{ job.services.elasticsearch.ports['9200'] }}/growi

- name: Upload results
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.cypress-report-artifact-name-prefix }}${{ matrix.spec-group }}
path: |
apps/app/test/cypress/screenshots
apps/app/test/cypress/videos

- name: Slack Notification
uses: weseek/ghaction-slack-notification@master
if: failure()
with:
type: ${{ job.status }}
job_name: '*Node CI for growi - run-cypress (${{ inputs.node-version }})*'
channel: '#ci'
isCompactMode: true
url: ${{ secrets.SLACK_WEBHOOK_URL }}



run-playwright:
needs: [build-prod]

Expand Down Expand Up @@ -407,20 +267,20 @@ jobs:
run: |
tar -xf ${{ needs.build-prod.outputs.PROD_FILES }}

- name: Copy dotenv file for ci
working-directory: ./apps/app
run: |
cat config/ci/.env.local.for-ci >> .env.production.local

- name: Playwright Run (--project=chromium/installer)
if: ${{ matrix.browser == 'chromium' }}
working-directory: ./apps/app
run: |
yarn playwright test --project=chromium/installer
env:
HOME: /root # ref: https://github.com/microsoft/playwright/issues/6500
MONGO_URI: mongodb://mongodb:27017/growi-playwright-installer
ELASTICSEARCH_URI: http://localhost:${{ job.services.elasticsearch.ports['9200'] }}/growi
# - name: Copy dotenv file for ci
# working-directory: ./apps/app
# run: |
# cat config/ci/.env.local.for-ci >> .env.production.local

# - name: Playwright Run (--project=chromium/installer)
# if: ${{ matrix.browser == 'chromium' }}
# working-directory: ./apps/app
# run: |
# yarn playwright test --project=chromium/installer
# env:
# HOME: /root # ref: https://github.com/microsoft/playwright/issues/6500
# MONGO_URI: mongodb://mongodb:27017/growi-playwright-installer
# ELASTICSEARCH_URI: http://localhost:${{ job.services.elasticsearch.ports['9200'] }}/growi

- name: Copy dotenv file for automatic installation
working-directory: ./apps/app
Expand All @@ -436,19 +296,26 @@ jobs:
MONGO_URI: mongodb://mongodb:27017/growi-playwright
ELASTICSEARCH_URI: http://localhost:${{ job.services.elasticsearch.ports['9200'] }}/growi

- name: Copy dotenv file for automatic installation with allowing guest mode
working-directory: ./apps/app
run: |
cat config/ci/.env.local.for-auto-install-with-allowing-guest >> .env.production.local

- name: Playwright Run (--project=${browser}/guest-mode)
working-directory: ./apps/app
run: |
yarn playwright test --project=${{ matrix.browser }}/guest-mode --shard=${{ matrix.shard }}
env:
HOME: /root # ref: https://github.com/microsoft/playwright/issues/6500
MONGO_URI: mongodb://mongodb:27017/growi-playwright-guest-mode
ELASTICSEARCH_URI: http://localhost:${{ job.services.elasticsearch.ports['9200'] }}/growi
# - name: Copy dotenv file for automatic installation with allowing guest mode
# working-directory: ./apps/app
# run: |
# cat config/ci/.env.local.for-auto-install-with-allowing-guest >> .env.production.local

# - name: Playwright Run (--project=${browser}/guest-mode)
# working-directory: ./apps/app
# run: |
# yarn playwright test --project=${{ matrix.browser }}/guest-mode --shard=${{ matrix.shard }}
# env:
# HOME: /root # ref: https://github.com/microsoft/playwright/issues/6500
# MONGO_URI: mongodb://mongodb:27017/growi-playwright-guest-mode
# ELASTICSEARCH_URI: http://localhost:${{ job.services.elasticsearch.ports['9200'] }}/growi

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: apps/app/playwright/output
retention-days: 1

- name: Slack Notification
uses: weseek/ghaction-slack-notification@master
Expand Down
24 changes: 17 additions & 7 deletions apps/app/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
## Handled by Next.js with dotenv or dotenv-flow
## https://nextjs.org/docs/basic-features/environment-variables
##
MIGRATIONS_DIR=src/migrations/
# MIGRATIONS_DIR=src/migrations/

APP_SITE_URL=http://localhost:3000
FILE_UPLOAD=mongodb
# APP_SITE_URL=http://localhost:3000
# FILE_UPLOAD=mongodb
# MONGO_GRIDFS_TOTAL_LIMIT=10485760
MONGO_URI="mongodb://mongo:27017/growi"
# REDIS_URI="http://redis:6379"
# NCHAN_URI="http://nchan"
ELASTICSEARCH_URI="http://elasticsearch:9200/growi"
ELASTICSEARCH_REQUEST_TIMEOUT=15000
ELASTICSEARCH_REJECT_UNAUTHORIZED=true
OGP_URI="http://ogp:8088"
QUESTIONNAIRE_SERVER_ORIGIN="http://host.docker.internal:3003"
# ELASTICSEARCH_REQUEST_TIMEOUT=15000
# ELASTICSEARCH_REJECT_UNAUTHORIZED=true
# OGP_URI="http://ogp:8088"
# QUESTIONNAIRE_SERVER_ORIGIN="http://host.docker.internal:3003"
# DRAWIO_URI="http://localhost:8080/?offline=1&https=0"
# S2SMSG_PUBSUB_SERVER_TYPE=nchan
# PUBLISH_OPEN_API=true
Expand All @@ -30,3 +30,13 @@ QUESTIONNAIRE_SERVER_ORIGIN="http://host.docker.internal:3003"
# AUDIT_LOG_ACTION_GROUP_SIZE=SMALL
# AUDIT_LOG_ADDITIONAL_ACTIONS=
# AUDIT_LOG_EXCLUDE_ACTIONS=

APP_SITE_URL=http://localhost:3000

AUTO_INSTALL_ADMIN_USERNAME=admin
AUTO_INSTALL_ADMIN_NAME=Admin
[email protected]
AUTO_INSTALL_ADMIN_PASSWORD=adminadmin
AUTO_INSTALL_GLOBAL_LANG=en_US

AUTO_INSTALL_SERVER_DATE=2022-01-01T00:00:00.0
3 changes: 3 additions & 0 deletions apps/app/config/ci/.env.local.for-auto-install
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ AUTO_INSTALL_ADMIN_PASSWORD=adminadmin
AUTO_INSTALL_GLOBAL_LANG=en_US

AUTO_INSTALL_SERVER_DATE=2022-01-01T00:00:00.0

ELASTICSEARCH_REJECT_UNAUTHORIZED=true
ELASTICSEARCH_REQUEST_TIMEOUT=300000
1 change: 1 addition & 0 deletions apps/app/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default defineConfig({

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
video: 'on',

viewport: { width: 1400, height: 1024 },
},
Expand Down
Loading
Loading