From 57e1eb5ee86f52d0137098247004082e4bfac5ae Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Thu, 27 Oct 2022 19:49:37 +0200 Subject: [PATCH 1/3] Move e2e to api tests and unify test command --- .../action.yml | 4 +- .../script.sh | 2 +- .github/workflows/tests.yml | 42 ++++---- CONTRIBUTING.md | 35 +++---- jest.config.e2e.js => jest.config.api.js | 5 +- jsconfig.json | 2 +- package.json | 4 +- ...test.e2e.js => provider-login.test.api.js} | 0 ...2e.js => admin-api-token-crud.test.api.js} | 0 ...uth.test.e2e.js => admin-auth.test.api.js} | 0 ...s => admin-authenticated-user.test.api.js} | 0 ...st.e2e.js => admin-permission.test.api.js} | 0 ... admin-permissions-conditions.test.api.js} | 0 ....js => admin-project-settings.test.api.js} | 0 ...ole.test.e2e.js => admin-role.test.api.js} | 0 ...ser.test.e2e.js => admin-user.test.api.js} | 0 ....js => basic-compo-repeatable.test.api.js} | 0 ...po.test.e2e.js => basic-compo.test.api.js} | 0 ... => basic-dp-compo-repeatable.test.api.js} | 0 ...test.e2e.js => basic-dp-compo.test.api.js} | 0 ...dz.test.e2e.js => basic-dp-dz.test.api.js} | 0 ...ic-dp.test.e2e.js => basic-dp.test.api.js} | 0 ...ic-dz.test.e2e.js => basic-dz.test.api.js} | 0 ...est.e2e.js => basic-relations.test.api.js} | 0 .../{basic.test.e2e.js => basic.test.api.js} | 0 ...dz.test.e2e.js => populate-dz.test.api.js} | 0 ...2e.js => x-to-many-rf-preview.test.api.js} | 0 ...peatable-not-required-min-max.test.api.js} | 0 ...js => repeatable-not-required.test.api.js} | 0 ...> repeatable-required-min-max.test.api.js} | 0 ...e2e.js => repeatable-required.test.api.js} | 0 ...e2e.js => single-not-required.test.api.js} | 0 ...est.e2e.js => single-required.test.api.js} | 0 ....test.e2e.js => content-types.test.api.js} | 0 ...ions.test.e2e.js => relations.test.api.js} | 0 .../{uid.test.e2e.js => uid.test.api.js} | 0 ...{simple.test.e2e.js => simple.test.api.js} | 0 ...dia.test.e2e.js => with-media.test.api.js} | 0 ...ger.test.e2e.js => biginteger.test.api.js} | 0 ...oolean.test.e2e.js => boolean.test.api.js} | 0 .../{date.test.e2e.js => date.test.api.js} | 0 ...etime.test.e2e.js => datetime.test.api.js} | 0 ...ecimal.test.e2e.js => decimal.test.api.js} | 0 .../{email.test.e2e.js => email.test.api.js} | 0 ...on.test.e2e.js => enumeration.test.api.js} | 0 .../{float.test.e2e.js => float.test.api.js} | 0 ...nteger.test.e2e.js => integer.test.api.js} | 0 .../{json.test.e2e.js => json.test.api.js} | 0 ...sword.test.e2e.js => password.test.api.js} | 0 ...htext.test.e2e.js => richtext.test.api.js} | 0 ...{string.test.e2e.js => string.test.api.js} | 0 .../{text.test.e2e.js => text.test.api.js} | 0 .../{time.test.e2e.js => time.test.api.js} | 0 .../{uid.test.e2e.js => uid.test.api.js} | 0 .../{index.test.e2e.js => index.test.api.js} | 0 ....test.e2e.js => relation-list.test.api.js} | 0 ...{search.test.e2e.js => search.test.api.js} | 0 ...pe.test.e2e.js => single-type.test.api.js} | 0 ....snap => collection-type.test.api.js.snap} | 0 ...e.js.snap => single-type.test.api.js.snap} | 0 ...est.e2e.js => collection-type.test.api.js} | 0 ...nts.test.e2e.js => components.test.api.js} | 0 ...pe.test.e2e.js => single-type.test.api.js} | 0 ....js => basic-compo-repeatable.test.api.js} | 0 ...po.test.e2e.js => basic-compo.test.api.js} | 0 ... => basic-dp-compo-repeatable.test.api.js} | 0 ...test.e2e.js => basic-dp-compo.test.api.js} | 0 ...ic-dp.test.e2e.js => basic-dp.test.api.js} | 0 ...ic-dz.test.e2e.js => basic-dz.test.api.js} | 0 .../{basic.test.e2e.js => basic.test.api.js} | 0 .../{index.test.e2e.js => index.test.api.js} | 0 ...itize.test.e2e.js => sanitize.test.api.js} | 0 ...peatable-not-required-min-max.test.api.js} | 0 ...js => repeatable-not-required.test.api.js} | 0 ...> repeatable-required-min-max.test.api.js} | 0 ...e2e.js => repeatable-required.test.api.js} | 0 ...e2e.js => single-not-required.test.api.js} | 0 ...est.e2e.js => single-required.test.api.js} | 0 ....test.e2e.js => deepFiltering.test.api.js} | 0 ...{simple.test.e2e.js => simple.test.api.js} | 0 ...dia.test.e2e.js => with-media.test.api.js} | 0 ...point.test.e2e.js => endpoint.test.api.js} | 0 ...ring.test.e2e.js => filtering.test.api.js} | 0 ....test.e2e.js => before-delete.test.api.js} | 0 ...js => migration-draft-publish.test.api.js} | 0 ... migration-required-attribute.test.api.js} | 0 ...=> migration-unique-attribute.test.api.js} | 0 ...t.e2e.js => publication-state.test.api.js} | 0 ...{search.test.e2e.js => search.test.api.js} | 0 ...pe.test.e2e.js => single-type.test.api.js} | 0 ...er.test.e2e.js => file-folder.test.api.js} | 0 ...age.test.e2e.js => file-image.test.api.js} | 0 .../{file.test.e2e.js => file.test.api.js} | 0 ...le.test.e2e.js => folder-file.test.api.js} | 0 ...st.e2e.js => folder-structure.test.api.js} | 0 ...{folder.test.e2e.js => folder.test.api.js} | 0 ...est.e2e.js => image-dimension.test.api.js} | 0 ...tings.test.e2e.js => settings.test.api.js} | 0 ...aphql-upload-automatic-folder.test.api.js} | 0 ...test.e2e.js => graphql-upload.test.api.js} | 0 ...js => upload-automatic-folder.test.api.js} | 0 ...{upload.test.e2e.js => upload.test.api.js} | 0 .../{crud.test.e2e.js => crud.test.api.js} | 0 .../{date.test.e2e.js => date.test.api.js} | 0 ...etime.test.e2e.js => datetime.test.api.js} | 0 ...ions.test.e2e.js => relations.test.api.js} | 0 ...pe.test.e2e.js => single-type.test.api.js} | 0 ...pi.test.e2e.js => content-api.test.api.js} | 0 ....test.e2e.js => content-types.test.api.js} | 0 .../{crud.test.e2e.js => crud.test.api.js} | 0 ....test.e2e.js => list-relation.test.api.js} | 0 ...raphql.test.e2e.js => graphql.test.api.js} | 0 ...ocales.test.e2e.js => locales.test.api.js} | 0 ...-api.test.e2e.js => roles-api.test.api.js} | 0 .../{auth.test.e2e.js => auth.test.api.js} | 0 ...-api.test.e2e.js => users-api.test.api.js} | 0 ...raphql.test.e2e.js => graphql.test.api.js} | 0 ....test.e2e.js => users-graphql.test.api.js} | 0 test/{e2e.js => api.js} | 27 ++++-- test/create-test-app.js | 1 + test/{jest2e2.setup.js => jest-api.setup.js} | 0 yarn.lock | 95 +++++-------------- 122 files changed, 87 insertions(+), 130 deletions(-) rename .github/actions/{run-e2e-tests => run-api-tests}/action.yml (84%) rename .github/actions/{run-e2e-tests => run-api-tests}/script.sh (85%) rename jest.config.e2e.js => jest.config.api.js (62%) rename packages/core/admin/ee/server/tests/{provider-login.test.e2e.js => provider-login.test.api.js} (100%) rename packages/core/admin/server/tests/{admin-api-token-crud.test.e2e.js => admin-api-token-crud.test.api.js} (100%) rename packages/core/admin/server/tests/{admin-auth.test.e2e.js => admin-auth.test.api.js} (100%) rename packages/core/admin/server/tests/{admin-authenticated-user.test.e2e.js => admin-authenticated-user.test.api.js} (100%) rename packages/core/admin/server/tests/{admin-permission.test.e2e.js => admin-permission.test.api.js} (100%) rename packages/core/admin/server/tests/{admin-permissions-conditions.test.e2e.js => admin-permissions-conditions.test.api.js} (100%) rename packages/core/admin/server/tests/{admin-project-settings.test.e2e.js => admin-project-settings.test.api.js} (100%) rename packages/core/admin/server/tests/{admin-role.test.e2e.js => admin-role.test.api.js} (100%) rename packages/core/admin/server/tests/{admin-user.test.e2e.js => admin-user.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{basic-compo-repeatable.test.e2e.js => basic-compo-repeatable.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{basic-compo.test.e2e.js => basic-compo.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{basic-dp-compo-repeatable.test.e2e.js => basic-dp-compo-repeatable.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{basic-dp-compo.test.e2e.js => basic-dp-compo.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{basic-dp-dz.test.e2e.js => basic-dp-dz.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{basic-dp.test.e2e.js => basic-dp.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{basic-dz.test.e2e.js => basic-dz.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{basic-relations.test.e2e.js => basic-relations.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{basic.test.e2e.js => basic.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{populate-dz.test.e2e.js => populate-dz.test.api.js} (100%) rename packages/core/content-manager/server/tests/api/{x-to-many-rf-preview.test.e2e.js => x-to-many-rf-preview.test.api.js} (100%) rename packages/core/content-manager/server/tests/components/{repeatable-not-required-min-max.test.e2e.js => repeatable-not-required-min-max.test.api.js} (100%) rename packages/core/content-manager/server/tests/components/{repeatable-not-required.test.e2e.js => repeatable-not-required.test.api.js} (100%) rename packages/core/content-manager/server/tests/components/{repeatable-required-min-max.test.e2e.js => repeatable-required-min-max.test.api.js} (100%) rename packages/core/content-manager/server/tests/components/{repeatable-required.test.e2e.js => repeatable-required.test.api.js} (100%) rename packages/core/content-manager/server/tests/components/{single-not-required.test.e2e.js => single-not-required.test.api.js} (100%) rename packages/core/content-manager/server/tests/components/{single-required.test.e2e.js => single-required.test.api.js} (100%) rename packages/core/content-manager/server/tests/content-manager/{content-types.test.e2e.js => content-types.test.api.js} (100%) rename packages/core/content-manager/server/tests/content-manager/{relations.test.e2e.js => relations.test.api.js} (100%) rename packages/core/content-manager/server/tests/content-manager/{uid.test.e2e.js => uid.test.api.js} (100%) rename packages/core/content-manager/server/tests/dynamiczones/{simple.test.e2e.js => simple.test.api.js} (100%) rename packages/core/content-manager/server/tests/dynamiczones/{with-media.test.e2e.js => with-media.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{biginteger.test.e2e.js => biginteger.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{boolean.test.e2e.js => boolean.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{date.test.e2e.js => date.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{datetime.test.e2e.js => datetime.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{decimal.test.e2e.js => decimal.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{email.test.e2e.js => email.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{enumeration.test.e2e.js => enumeration.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{float.test.e2e.js => float.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{integer.test.e2e.js => integer.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{json.test.e2e.js => json.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{password.test.e2e.js => password.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{richtext.test.e2e.js => richtext.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{string.test.e2e.js => string.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{text.test.e2e.js => text.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{time.test.e2e.js => time.test.api.js} (100%) rename packages/core/content-manager/server/tests/fields/{uid.test.e2e.js => uid.test.api.js} (100%) rename packages/core/content-manager/server/tests/{index.test.e2e.js => index.test.api.js} (100%) rename packages/core/content-manager/server/tests/{relation-list.test.e2e.js => relation-list.test.api.js} (100%) rename packages/core/content-manager/server/tests/{search.test.e2e.js => search.test.api.js} (100%) rename packages/core/content-manager/server/tests/{single-type.test.e2e.js => single-type.test.api.js} (100%) rename packages/core/content-type-builder/tests/__snapshots__/{collection-type.test.e2e.js.snap => collection-type.test.api.js.snap} (100%) rename packages/core/content-type-builder/tests/__snapshots__/{single-type.test.e2e.js.snap => single-type.test.api.js.snap} (100%) rename packages/core/content-type-builder/tests/{collection-type.test.e2e.js => collection-type.test.api.js} (100%) rename packages/core/content-type-builder/tests/{components.test.e2e.js => components.test.api.js} (100%) rename packages/core/content-type-builder/tests/{single-type.test.e2e.js => single-type.test.api.js} (100%) rename packages/core/strapi/tests/api/{basic-compo-repeatable.test.e2e.js => basic-compo-repeatable.test.api.js} (100%) rename packages/core/strapi/tests/api/{basic-compo.test.e2e.js => basic-compo.test.api.js} (100%) rename packages/core/strapi/tests/api/{basic-dp-compo-repeatable.test.e2e.js => basic-dp-compo-repeatable.test.api.js} (100%) rename packages/core/strapi/tests/api/{basic-dp-compo.test.e2e.js => basic-dp-compo.test.api.js} (100%) rename packages/core/strapi/tests/api/{basic-dp.test.e2e.js => basic-dp.test.api.js} (100%) rename packages/core/strapi/tests/api/{basic-dz.test.e2e.js => basic-dz.test.api.js} (100%) rename packages/core/strapi/tests/api/{basic.test.e2e.js => basic.test.api.js} (100%) rename packages/core/strapi/tests/api/populate/filtering/{index.test.e2e.js => index.test.api.js} (100%) rename packages/core/strapi/tests/api/populate/{sanitize.test.e2e.js => sanitize.test.api.js} (100%) rename packages/core/strapi/tests/components/{repeatable-not-required-min-max.test.e2e.js => repeatable-not-required-min-max.test.api.js} (100%) rename packages/core/strapi/tests/components/{repeatable-not-required.test.e2e.js => repeatable-not-required.test.api.js} (100%) rename packages/core/strapi/tests/components/{repeatable-required-min-max.test.e2e.js => repeatable-required-min-max.test.api.js} (100%) rename packages/core/strapi/tests/components/{repeatable-required.test.e2e.js => repeatable-required.test.api.js} (100%) rename packages/core/strapi/tests/components/{single-not-required.test.e2e.js => single-not-required.test.api.js} (100%) rename packages/core/strapi/tests/components/{single-required.test.e2e.js => single-required.test.api.js} (100%) rename packages/core/strapi/tests/{deepFiltering.test.e2e.js => deepFiltering.test.api.js} (100%) rename packages/core/strapi/tests/dynamiczones/{simple.test.e2e.js => simple.test.api.js} (100%) rename packages/core/strapi/tests/dynamiczones/{with-media.test.e2e.js => with-media.test.api.js} (100%) rename packages/core/strapi/tests/{endpoint.test.e2e.js => endpoint.test.api.js} (100%) rename packages/core/strapi/tests/{filtering.test.e2e.js => filtering.test.api.js} (100%) rename packages/core/strapi/tests/lifecycles/{before-delete.test.e2e.js => before-delete.test.api.js} (100%) rename packages/core/strapi/tests/migrations/{migration-draft-publish.test.e2e.js => migration-draft-publish.test.api.js} (100%) rename packages/core/strapi/tests/migrations/{migration-required-attribute.test.e2e.js => migration-required-attribute.test.api.js} (100%) rename packages/core/strapi/tests/migrations/{migration-unique-attribute.test.e2e.js => migration-unique-attribute.test.api.js} (100%) rename packages/core/strapi/tests/{publication-state.test.e2e.js => publication-state.test.api.js} (100%) rename packages/core/strapi/tests/{search.test.e2e.js => search.test.api.js} (100%) rename packages/core/strapi/tests/{single-type.test.e2e.js => single-type.test.api.js} (100%) rename packages/core/upload/tests/admin/{file-folder.test.e2e.js => file-folder.test.api.js} (100%) rename packages/core/upload/tests/admin/{file-image.test.e2e.js => file-image.test.api.js} (100%) rename packages/core/upload/tests/admin/{file.test.e2e.js => file.test.api.js} (100%) rename packages/core/upload/tests/admin/{folder-file.test.e2e.js => folder-file.test.api.js} (100%) rename packages/core/upload/tests/admin/{folder-structure.test.e2e.js => folder-structure.test.api.js} (100%) rename packages/core/upload/tests/admin/{folder.test.e2e.js => folder.test.api.js} (100%) rename packages/core/upload/tests/admin/{image-dimension.test.e2e.js => image-dimension.test.api.js} (100%) rename packages/core/upload/tests/admin/{settings.test.e2e.js => settings.test.api.js} (100%) rename packages/core/upload/tests/content-api/{graphql-upload-automatic-folder.test.e2e.js => graphql-upload-automatic-folder.test.api.js} (100%) rename packages/core/upload/tests/content-api/{graphql-upload.test.e2e.js => graphql-upload.test.api.js} (100%) rename packages/core/upload/tests/content-api/{upload-automatic-folder.test.e2e.js => upload-automatic-folder.test.api.js} (100%) rename packages/core/upload/tests/content-api/{upload.test.e2e.js => upload.test.api.js} (100%) rename packages/plugins/graphql/tests/{crud.test.e2e.js => crud.test.api.js} (100%) rename packages/plugins/graphql/tests/fields/{date.test.e2e.js => date.test.api.js} (100%) rename packages/plugins/graphql/tests/fields/{datetime.test.e2e.js => datetime.test.api.js} (100%) rename packages/plugins/graphql/tests/{relations.test.e2e.js => relations.test.api.js} (100%) rename packages/plugins/graphql/tests/{single-type.test.e2e.js => single-type.test.api.js} (100%) rename packages/plugins/i18n/tests/content-api/{content-api.test.e2e.js => content-api.test.api.js} (100%) rename packages/plugins/i18n/tests/content-api/{content-types.test.e2e.js => content-types.test.api.js} (100%) rename packages/plugins/i18n/tests/content-manager/{crud.test.e2e.js => crud.test.api.js} (100%) rename packages/plugins/i18n/tests/content-manager/{list-relation.test.e2e.js => list-relation.test.api.js} (100%) rename packages/plugins/i18n/tests/{graphql.test.e2e.js => graphql.test.api.js} (100%) rename packages/plugins/i18n/tests/{locales.test.e2e.js => locales.test.api.js} (100%) rename packages/plugins/users-permissions/tests/admin/{roles-api.test.e2e.js => roles-api.test.api.js} (100%) rename packages/plugins/users-permissions/tests/content-api/{auth.test.e2e.js => auth.test.api.js} (100%) rename packages/plugins/users-permissions/tests/content-api/{users-api.test.e2e.js => users-api.test.api.js} (100%) rename packages/plugins/users-permissions/tests/{graphql.test.e2e.js => graphql.test.api.js} (100%) rename packages/plugins/users-permissions/tests/{users-graphql.test.e2e.js => users-graphql.test.api.js} (100%) rename test/{e2e.js => api.js} (69%) rename test/{jest2e2.setup.js => jest-api.setup.js} (100%) diff --git a/.github/actions/run-e2e-tests/action.yml b/.github/actions/run-api-tests/action.yml similarity index 84% rename from .github/actions/run-e2e-tests/action.yml rename to .github/actions/run-api-tests/action.yml index bf395532b8e..06b91f7a846 100644 --- a/.github/actions/run-e2e-tests/action.yml +++ b/.github/actions/run-api-tests/action.yml @@ -1,5 +1,5 @@ -name: 'Run E2E tests' -description: 'Run end to end tests' +name: 'Run API tests' +description: 'Run api tests' inputs: dbOptions: description: 'Database options' diff --git a/.github/actions/run-e2e-tests/script.sh b/.github/actions/run-api-tests/script.sh similarity index 85% rename from .github/actions/run-e2e-tests/script.sh rename to .github/actions/run-api-tests/script.sh index d0139bcaf2c..b571e7303ce 100755 --- a/.github/actions/run-e2e-tests/script.sh +++ b/.github/actions/run-api-tests/script.sh @@ -9,4 +9,4 @@ export JWT_SECRET="aSecret" opts=($DB_OPTIONS) yarn run -s test:generate-app "${opts[@]}" -yarn run -s test:e2e $@ +yarn run -s test:api --no-generate-app diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dea2b900e53..e1edbefcfae 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -74,10 +74,10 @@ jobs: - name: Run test run: yarn run -s test:front --coverage && codecov -C -F front - e2e_ce_pg: + api_ce_pg: runs-on: ubuntu-latest needs: [lint, unit_back, unit_front] - name: '[CE] E2E (postgres, node: ${{ matrix.node }})' + name: '[CE] API Integration (postgres, node: ${{ matrix.node }})' strategy: matrix: node: [14, 16, 18] @@ -106,14 +106,14 @@ jobs: node-version: ${{ matrix.node }} cache: yarn - uses: ./.github/actions/install-modules - - uses: ./.github/actions/run-e2e-tests + - uses: ./.github/actions/run-api-tests with: dbOptions: '--dbclient=postgres --dbhost=localhost --dbport=5432 --dbname=strapi_test --dbusername=strapi --dbpassword=strapi' - e2e_ce_mysql: + api_ce_mysql: runs-on: ubuntu-latest needs: [lint, unit_back, unit_front] - name: '[CE] E2E (mysql, node: ${{ matrix.node }})' + name: '[CE] API Integration (mysql, node: ${{ matrix.node }})' strategy: matrix: node: [14, 16, 18] @@ -141,14 +141,14 @@ jobs: node-version: ${{ matrix.node }} cache: yarn - uses: ./.github/actions/install-modules - - uses: ./.github/actions/run-e2e-tests + - uses: ./.github/actions/run-api-tests with: dbOptions: '--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=strapi --dbpassword=strapi' - e2e_ce_mysql_5: + api_ce_mysql_5: runs-on: ubuntu-latest needs: [lint, unit_back, unit_front] - name: '[CE] E2E (mysql:5 , node: ${{ matrix.node }})' + name: '[CE] API Integration (mysql:5 , node: ${{ matrix.node }})' strategy: matrix: node: [14, 16, 18] @@ -176,14 +176,14 @@ jobs: node-version: ${{ matrix.node }} cache: yarn - uses: ./.github/actions/install-modules - - uses: ./.github/actions/run-e2e-tests + - uses: ./.github/actions/run-api-tests with: dbOptions: '--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=strapi --dbpassword=strapi' - e2e_ce_sqlite: + api_ce_sqlite: runs-on: ubuntu-latest needs: [lint, unit_back, unit_front] - name: '[CE] E2E (sqlite: ${{ matrix.sqlite_pkg }}, node: ${{ matrix.node }})' + name: '[CE] API Integration (sqlite: ${{ matrix.sqlite_pkg }}, node: ${{ matrix.node }})' strategy: matrix: node: [14, 16, 18] @@ -195,16 +195,16 @@ jobs: node-version: ${{ matrix.node }} cache: yarn - uses: ./.github/actions/install-modules - - uses: ./.github/actions/run-e2e-tests + - uses: ./.github/actions/run-api-tests env: SQLITE_PKG: ${{ matrix.sqlite_pkg }} with: dbOptions: '--dbclient=sqlite-legacy --dbfile=./tmp/data.db' # EE - e2e_ee_pg: + api_ee_pg: runs-on: ubuntu-latest needs: [lint, unit_back, unit_front] - name: '[EE] E2E (postgres, node: ${{ matrix.node }})' + name: '[EE] API Integration (postgres, node: ${{ matrix.node }})' if: github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]') env: STRAPI_LICENSE: ${{ secrets.strapiLicense }} @@ -236,15 +236,15 @@ jobs: node-version: ${{ matrix.node }} cache: yarn - uses: ./.github/actions/install-modules - - uses: ./.github/actions/run-e2e-tests + - uses: ./.github/actions/run-api-tests with: dbOptions: '--dbclient=postgres --dbhost=localhost --dbport=5432 --dbname=strapi_test --dbusername=strapi --dbpassword=strapi' runEE: true - e2e_ee_mysql: + api_ee_mysql: runs-on: ubuntu-latest needs: [lint, unit_back, unit_front] - name: '[EE] E2E (mysql, node: ${{ matrix.node }})' + name: '[EE] API Integration (mysql, node: ${{ matrix.node }})' if: github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]') env: STRAPI_LICENSE: ${{ secrets.strapiLicense }} @@ -275,15 +275,15 @@ jobs: node-version: ${{ matrix.node }} cache: yarn - uses: ./.github/actions/install-modules - - uses: ./.github/actions/run-e2e-tests + - uses: ./.github/actions/run-api-tests with: dbOptions: '--dbclient=mysql --dbhost=localhost --dbport=3306 --dbname=strapi_test --dbusername=strapi --dbpassword=strapi' runEE: true - e2e_ee_sqlite: + api_ee_sqlite: runs-on: ubuntu-latest needs: [lint, unit_back, unit_front] - name: '[EE] E2E (sqlite: ${{ matrix.sqlite_pkg }}, node: ${{ matrix.node }})' + name: '[EE] API Integration (sqlite: ${{ matrix.sqlite_pkg }}, node: ${{ matrix.node }})' if: github.event.pull_request.head.repo.full_name == github.repository && !(github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]') env: STRAPI_LICENSE: ${{ secrets.strapiLicense }} @@ -298,7 +298,7 @@ jobs: node-version: ${{ matrix.node }} cache: yarn - uses: ./.github/actions/install-modules - - uses: ./.github/actions/run-e2e-tests + - uses: ./.github/actions/run-api-tests env: SQLITE_PKG: ${{ matrix.sqlite_pkg }} with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b0384d5aaa0..5f3d18adca4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,15 +114,15 @@ The administration panel should now be available at http://localhost:4000/admin. - `yarn test:front` runs front-end related tests. - `yarn test:front:watch` runs an interactive test watcher for the front-end. - `yarn test:unit` runs the back-end unit tests. -- `yarn test:e2e` runs an end-to-end test suite. +- `yarn test:api` runs an end-to-end test suite. - `yarn test:generate-app` generates a test application. - `yarn test:start-app` starts the test application. --- -## Running the End-To-End (e2e) tests +## Running the API Integration tests -The end-to-end tests require a Strapi app to be able to run. You can generate a "test app" using `yarn test:generate-app `: +The API integration tests require a Strapi app to be able to run. You can generate a "test app" using `yarn test:generate-app `: ```bash $ yarn test:generate-app sqlite @@ -130,36 +130,27 @@ $ yarn test:generate-app postgres $ yarn test:generate-app mysql ``` -A new app is required every time you run the end-to-end tests otherwise, the test suite will fail. A script is available to make this process easier: `node test/e2e.js`. It will delete the current test app, generate a new one and run the test suite. +A new app is required every time you run the API integration tests otherwise, the test suite will fail. A command is available to make this process easier: `yarn test:api`. -The script takes a path as optional argument (e.g. `node test/e2e.js path/to/test`). Options for jest can be passed using the double-dash notion: e.g. to update snapshots `node test/e2e.js -- -u`. +This command runs tests using jest behing the scenes. Options for jest can be passed in the command. (e.g. to update snapshots `yarn test:api -u`). ### Changing the database -By default the script `test/e2e.js` creates an app that uses `sqlite`. But you can run the test suites using different databases: +By default the script test commmand creates an app that uses `sqlite`. But you can run the test suites using different databases: ```bash -$ node test/e2e.js --db=sqlite -$ node test/e2e.js --db=postgres -$ node test/e2e.js --db=mysql +$ yarn test:api --db=sqlite +$ yarn test:api --db=postgres +$ yarn test:api --db=mysql ``` -### Running the tests for the Community Editon (CE)\*\* +### Running the tests for the Enterprise Editon (EE) -The test suites run the tests for the Enterprise Edition (EE) version of Strapi by default. Should you want to test the Community Edition (CE) version, you will need to set the environment variable `STRAPI_DISABLE_EE` to true: +The test suites run the tests for the Community Edition (CE) version of Strapi by default. +In order to run the Enterprise Edition tests you need a valid license. To specify a license, you can use the environment variable `STRAPI_LICENSE`: ```bash -$ STRAPI_DISABLE_EE=true node test/e2e.js -$ STRAPI_DISABLE_EE=true yarn test:e2e -``` - -### Specifying a license to use for the Enterprise Edition (EE) - -The Enterprise Edition tests need a valid license to run correctly. To specify a license, you can use the environment variable `STRAPI_LICENSE`: - -```bash -$ STRAPI_LICENSE= node test/e2e.js -$ STRAPI_LICENSE= yarn test:e2e +$ STRAPI_LICENSE= yarn test:api ``` --- diff --git a/jest.config.e2e.js b/jest.config.api.js similarity index 62% rename from jest.config.e2e.js rename to jest.config.api.js index 3eeb7d733d3..9ee70999d2a 100644 --- a/jest.config.e2e.js +++ b/jest.config.api.js @@ -1,9 +1,8 @@ module.exports = { displayName: 'API integration tests', - testMatch: ['**/?(*.)+(spec|test).e2e.js'], + testMatch: ['**/?(*.)+(spec|test).api.js'], testEnvironment: 'node', - setupFilesAfterEnv: ['/test/jest2e2.setup.js'], - testPathIgnorePatterns: ['/packages/core/database.old'], + setupFilesAfterEnv: ['/test/jest-api.setup.js'], coveragePathIgnorePatterns: [ '/dist/', '/node_modules/', diff --git a/jsconfig.json b/jsconfig.json index a3c94b00a9e..39b38bc264a 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -13,7 +13,7 @@ "**/dist/*", "**/build/*", "**/*.test.js", - "**/*.test.e2e.js", + "**/*.test.api.js", "**/examples/getstarted/*", "**/examples/kitchensink/*" ] diff --git a/package.json b/package.json index f4cdf80e0ad..49a323d7f7f 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "test:front:watch:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll", "test:front:update:ce": "cross-env IS_EE=false jest --config ./jest.config.front.js --u", "test:unit": "jest --verbose", - "test:e2e": "FORCE_COLOR=true jest --config jest.config.e2e.js --verbose --runInBand --testRunner=jest-circus/runner --forceExit --detectOpenHandles", + "test:api": "node test/api.js", "test:generate-app": "node test/create-test-app.js", "doc:api": "node scripts/open-api/serve.js" }, @@ -104,7 +104,7 @@ "stylelint-config-styled-components": "0.1.1", "stylelint-processor-styled-components": "1.10.0", "supertest": "6.2.4", - "yargs": "13.3.2" + "yargs": "17.6.0" }, "engines": { "node": ">=14.19.1 <=18.x.x", diff --git a/packages/core/admin/ee/server/tests/provider-login.test.e2e.js b/packages/core/admin/ee/server/tests/provider-login.test.api.js similarity index 100% rename from packages/core/admin/ee/server/tests/provider-login.test.e2e.js rename to packages/core/admin/ee/server/tests/provider-login.test.api.js diff --git a/packages/core/admin/server/tests/admin-api-token-crud.test.e2e.js b/packages/core/admin/server/tests/admin-api-token-crud.test.api.js similarity index 100% rename from packages/core/admin/server/tests/admin-api-token-crud.test.e2e.js rename to packages/core/admin/server/tests/admin-api-token-crud.test.api.js diff --git a/packages/core/admin/server/tests/admin-auth.test.e2e.js b/packages/core/admin/server/tests/admin-auth.test.api.js similarity index 100% rename from packages/core/admin/server/tests/admin-auth.test.e2e.js rename to packages/core/admin/server/tests/admin-auth.test.api.js diff --git a/packages/core/admin/server/tests/admin-authenticated-user.test.e2e.js b/packages/core/admin/server/tests/admin-authenticated-user.test.api.js similarity index 100% rename from packages/core/admin/server/tests/admin-authenticated-user.test.e2e.js rename to packages/core/admin/server/tests/admin-authenticated-user.test.api.js diff --git a/packages/core/admin/server/tests/admin-permission.test.e2e.js b/packages/core/admin/server/tests/admin-permission.test.api.js similarity index 100% rename from packages/core/admin/server/tests/admin-permission.test.e2e.js rename to packages/core/admin/server/tests/admin-permission.test.api.js diff --git a/packages/core/admin/server/tests/admin-permissions-conditions.test.e2e.js b/packages/core/admin/server/tests/admin-permissions-conditions.test.api.js similarity index 100% rename from packages/core/admin/server/tests/admin-permissions-conditions.test.e2e.js rename to packages/core/admin/server/tests/admin-permissions-conditions.test.api.js diff --git a/packages/core/admin/server/tests/admin-project-settings.test.e2e.js b/packages/core/admin/server/tests/admin-project-settings.test.api.js similarity index 100% rename from packages/core/admin/server/tests/admin-project-settings.test.e2e.js rename to packages/core/admin/server/tests/admin-project-settings.test.api.js diff --git a/packages/core/admin/server/tests/admin-role.test.e2e.js b/packages/core/admin/server/tests/admin-role.test.api.js similarity index 100% rename from packages/core/admin/server/tests/admin-role.test.e2e.js rename to packages/core/admin/server/tests/admin-role.test.api.js diff --git a/packages/core/admin/server/tests/admin-user.test.e2e.js b/packages/core/admin/server/tests/admin-user.test.api.js similarity index 100% rename from packages/core/admin/server/tests/admin-user.test.e2e.js rename to packages/core/admin/server/tests/admin-user.test.api.js diff --git a/packages/core/content-manager/server/tests/api/basic-compo-repeatable.test.e2e.js b/packages/core/content-manager/server/tests/api/basic-compo-repeatable.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/basic-compo-repeatable.test.e2e.js rename to packages/core/content-manager/server/tests/api/basic-compo-repeatable.test.api.js diff --git a/packages/core/content-manager/server/tests/api/basic-compo.test.e2e.js b/packages/core/content-manager/server/tests/api/basic-compo.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/basic-compo.test.e2e.js rename to packages/core/content-manager/server/tests/api/basic-compo.test.api.js diff --git a/packages/core/content-manager/server/tests/api/basic-dp-compo-repeatable.test.e2e.js b/packages/core/content-manager/server/tests/api/basic-dp-compo-repeatable.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/basic-dp-compo-repeatable.test.e2e.js rename to packages/core/content-manager/server/tests/api/basic-dp-compo-repeatable.test.api.js diff --git a/packages/core/content-manager/server/tests/api/basic-dp-compo.test.e2e.js b/packages/core/content-manager/server/tests/api/basic-dp-compo.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/basic-dp-compo.test.e2e.js rename to packages/core/content-manager/server/tests/api/basic-dp-compo.test.api.js diff --git a/packages/core/content-manager/server/tests/api/basic-dp-dz.test.e2e.js b/packages/core/content-manager/server/tests/api/basic-dp-dz.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/basic-dp-dz.test.e2e.js rename to packages/core/content-manager/server/tests/api/basic-dp-dz.test.api.js diff --git a/packages/core/content-manager/server/tests/api/basic-dp.test.e2e.js b/packages/core/content-manager/server/tests/api/basic-dp.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/basic-dp.test.e2e.js rename to packages/core/content-manager/server/tests/api/basic-dp.test.api.js diff --git a/packages/core/content-manager/server/tests/api/basic-dz.test.e2e.js b/packages/core/content-manager/server/tests/api/basic-dz.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/basic-dz.test.e2e.js rename to packages/core/content-manager/server/tests/api/basic-dz.test.api.js diff --git a/packages/core/content-manager/server/tests/api/basic-relations.test.e2e.js b/packages/core/content-manager/server/tests/api/basic-relations.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/basic-relations.test.e2e.js rename to packages/core/content-manager/server/tests/api/basic-relations.test.api.js diff --git a/packages/core/content-manager/server/tests/api/basic.test.e2e.js b/packages/core/content-manager/server/tests/api/basic.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/basic.test.e2e.js rename to packages/core/content-manager/server/tests/api/basic.test.api.js diff --git a/packages/core/content-manager/server/tests/api/populate-dz.test.e2e.js b/packages/core/content-manager/server/tests/api/populate-dz.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/populate-dz.test.e2e.js rename to packages/core/content-manager/server/tests/api/populate-dz.test.api.js diff --git a/packages/core/content-manager/server/tests/api/x-to-many-rf-preview.test.e2e.js b/packages/core/content-manager/server/tests/api/x-to-many-rf-preview.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/api/x-to-many-rf-preview.test.e2e.js rename to packages/core/content-manager/server/tests/api/x-to-many-rf-preview.test.api.js diff --git a/packages/core/content-manager/server/tests/components/repeatable-not-required-min-max.test.e2e.js b/packages/core/content-manager/server/tests/components/repeatable-not-required-min-max.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/components/repeatable-not-required-min-max.test.e2e.js rename to packages/core/content-manager/server/tests/components/repeatable-not-required-min-max.test.api.js diff --git a/packages/core/content-manager/server/tests/components/repeatable-not-required.test.e2e.js b/packages/core/content-manager/server/tests/components/repeatable-not-required.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/components/repeatable-not-required.test.e2e.js rename to packages/core/content-manager/server/tests/components/repeatable-not-required.test.api.js diff --git a/packages/core/content-manager/server/tests/components/repeatable-required-min-max.test.e2e.js b/packages/core/content-manager/server/tests/components/repeatable-required-min-max.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/components/repeatable-required-min-max.test.e2e.js rename to packages/core/content-manager/server/tests/components/repeatable-required-min-max.test.api.js diff --git a/packages/core/content-manager/server/tests/components/repeatable-required.test.e2e.js b/packages/core/content-manager/server/tests/components/repeatable-required.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/components/repeatable-required.test.e2e.js rename to packages/core/content-manager/server/tests/components/repeatable-required.test.api.js diff --git a/packages/core/content-manager/server/tests/components/single-not-required.test.e2e.js b/packages/core/content-manager/server/tests/components/single-not-required.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/components/single-not-required.test.e2e.js rename to packages/core/content-manager/server/tests/components/single-not-required.test.api.js diff --git a/packages/core/content-manager/server/tests/components/single-required.test.e2e.js b/packages/core/content-manager/server/tests/components/single-required.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/components/single-required.test.e2e.js rename to packages/core/content-manager/server/tests/components/single-required.test.api.js diff --git a/packages/core/content-manager/server/tests/content-manager/content-types.test.e2e.js b/packages/core/content-manager/server/tests/content-manager/content-types.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/content-manager/content-types.test.e2e.js rename to packages/core/content-manager/server/tests/content-manager/content-types.test.api.js diff --git a/packages/core/content-manager/server/tests/content-manager/relations.test.e2e.js b/packages/core/content-manager/server/tests/content-manager/relations.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/content-manager/relations.test.e2e.js rename to packages/core/content-manager/server/tests/content-manager/relations.test.api.js diff --git a/packages/core/content-manager/server/tests/content-manager/uid.test.e2e.js b/packages/core/content-manager/server/tests/content-manager/uid.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/content-manager/uid.test.e2e.js rename to packages/core/content-manager/server/tests/content-manager/uid.test.api.js diff --git a/packages/core/content-manager/server/tests/dynamiczones/simple.test.e2e.js b/packages/core/content-manager/server/tests/dynamiczones/simple.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/dynamiczones/simple.test.e2e.js rename to packages/core/content-manager/server/tests/dynamiczones/simple.test.api.js diff --git a/packages/core/content-manager/server/tests/dynamiczones/with-media.test.e2e.js b/packages/core/content-manager/server/tests/dynamiczones/with-media.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/dynamiczones/with-media.test.e2e.js rename to packages/core/content-manager/server/tests/dynamiczones/with-media.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/biginteger.test.e2e.js b/packages/core/content-manager/server/tests/fields/biginteger.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/biginteger.test.e2e.js rename to packages/core/content-manager/server/tests/fields/biginteger.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/boolean.test.e2e.js b/packages/core/content-manager/server/tests/fields/boolean.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/boolean.test.e2e.js rename to packages/core/content-manager/server/tests/fields/boolean.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/date.test.e2e.js b/packages/core/content-manager/server/tests/fields/date.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/date.test.e2e.js rename to packages/core/content-manager/server/tests/fields/date.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/datetime.test.e2e.js b/packages/core/content-manager/server/tests/fields/datetime.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/datetime.test.e2e.js rename to packages/core/content-manager/server/tests/fields/datetime.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/decimal.test.e2e.js b/packages/core/content-manager/server/tests/fields/decimal.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/decimal.test.e2e.js rename to packages/core/content-manager/server/tests/fields/decimal.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/email.test.e2e.js b/packages/core/content-manager/server/tests/fields/email.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/email.test.e2e.js rename to packages/core/content-manager/server/tests/fields/email.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/enumeration.test.e2e.js b/packages/core/content-manager/server/tests/fields/enumeration.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/enumeration.test.e2e.js rename to packages/core/content-manager/server/tests/fields/enumeration.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/float.test.e2e.js b/packages/core/content-manager/server/tests/fields/float.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/float.test.e2e.js rename to packages/core/content-manager/server/tests/fields/float.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/integer.test.e2e.js b/packages/core/content-manager/server/tests/fields/integer.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/integer.test.e2e.js rename to packages/core/content-manager/server/tests/fields/integer.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/json.test.e2e.js b/packages/core/content-manager/server/tests/fields/json.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/json.test.e2e.js rename to packages/core/content-manager/server/tests/fields/json.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/password.test.e2e.js b/packages/core/content-manager/server/tests/fields/password.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/password.test.e2e.js rename to packages/core/content-manager/server/tests/fields/password.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/richtext.test.e2e.js b/packages/core/content-manager/server/tests/fields/richtext.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/richtext.test.e2e.js rename to packages/core/content-manager/server/tests/fields/richtext.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/string.test.e2e.js b/packages/core/content-manager/server/tests/fields/string.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/string.test.e2e.js rename to packages/core/content-manager/server/tests/fields/string.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/text.test.e2e.js b/packages/core/content-manager/server/tests/fields/text.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/text.test.e2e.js rename to packages/core/content-manager/server/tests/fields/text.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/time.test.e2e.js b/packages/core/content-manager/server/tests/fields/time.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/time.test.e2e.js rename to packages/core/content-manager/server/tests/fields/time.test.api.js diff --git a/packages/core/content-manager/server/tests/fields/uid.test.e2e.js b/packages/core/content-manager/server/tests/fields/uid.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/fields/uid.test.e2e.js rename to packages/core/content-manager/server/tests/fields/uid.test.api.js diff --git a/packages/core/content-manager/server/tests/index.test.e2e.js b/packages/core/content-manager/server/tests/index.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/index.test.e2e.js rename to packages/core/content-manager/server/tests/index.test.api.js diff --git a/packages/core/content-manager/server/tests/relation-list.test.e2e.js b/packages/core/content-manager/server/tests/relation-list.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/relation-list.test.e2e.js rename to packages/core/content-manager/server/tests/relation-list.test.api.js diff --git a/packages/core/content-manager/server/tests/search.test.e2e.js b/packages/core/content-manager/server/tests/search.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/search.test.e2e.js rename to packages/core/content-manager/server/tests/search.test.api.js diff --git a/packages/core/content-manager/server/tests/single-type.test.e2e.js b/packages/core/content-manager/server/tests/single-type.test.api.js similarity index 100% rename from packages/core/content-manager/server/tests/single-type.test.e2e.js rename to packages/core/content-manager/server/tests/single-type.test.api.js diff --git a/packages/core/content-type-builder/tests/__snapshots__/collection-type.test.e2e.js.snap b/packages/core/content-type-builder/tests/__snapshots__/collection-type.test.api.js.snap similarity index 100% rename from packages/core/content-type-builder/tests/__snapshots__/collection-type.test.e2e.js.snap rename to packages/core/content-type-builder/tests/__snapshots__/collection-type.test.api.js.snap diff --git a/packages/core/content-type-builder/tests/__snapshots__/single-type.test.e2e.js.snap b/packages/core/content-type-builder/tests/__snapshots__/single-type.test.api.js.snap similarity index 100% rename from packages/core/content-type-builder/tests/__snapshots__/single-type.test.e2e.js.snap rename to packages/core/content-type-builder/tests/__snapshots__/single-type.test.api.js.snap diff --git a/packages/core/content-type-builder/tests/collection-type.test.e2e.js b/packages/core/content-type-builder/tests/collection-type.test.api.js similarity index 100% rename from packages/core/content-type-builder/tests/collection-type.test.e2e.js rename to packages/core/content-type-builder/tests/collection-type.test.api.js diff --git a/packages/core/content-type-builder/tests/components.test.e2e.js b/packages/core/content-type-builder/tests/components.test.api.js similarity index 100% rename from packages/core/content-type-builder/tests/components.test.e2e.js rename to packages/core/content-type-builder/tests/components.test.api.js diff --git a/packages/core/content-type-builder/tests/single-type.test.e2e.js b/packages/core/content-type-builder/tests/single-type.test.api.js similarity index 100% rename from packages/core/content-type-builder/tests/single-type.test.e2e.js rename to packages/core/content-type-builder/tests/single-type.test.api.js diff --git a/packages/core/strapi/tests/api/basic-compo-repeatable.test.e2e.js b/packages/core/strapi/tests/api/basic-compo-repeatable.test.api.js similarity index 100% rename from packages/core/strapi/tests/api/basic-compo-repeatable.test.e2e.js rename to packages/core/strapi/tests/api/basic-compo-repeatable.test.api.js diff --git a/packages/core/strapi/tests/api/basic-compo.test.e2e.js b/packages/core/strapi/tests/api/basic-compo.test.api.js similarity index 100% rename from packages/core/strapi/tests/api/basic-compo.test.e2e.js rename to packages/core/strapi/tests/api/basic-compo.test.api.js diff --git a/packages/core/strapi/tests/api/basic-dp-compo-repeatable.test.e2e.js b/packages/core/strapi/tests/api/basic-dp-compo-repeatable.test.api.js similarity index 100% rename from packages/core/strapi/tests/api/basic-dp-compo-repeatable.test.e2e.js rename to packages/core/strapi/tests/api/basic-dp-compo-repeatable.test.api.js diff --git a/packages/core/strapi/tests/api/basic-dp-compo.test.e2e.js b/packages/core/strapi/tests/api/basic-dp-compo.test.api.js similarity index 100% rename from packages/core/strapi/tests/api/basic-dp-compo.test.e2e.js rename to packages/core/strapi/tests/api/basic-dp-compo.test.api.js diff --git a/packages/core/strapi/tests/api/basic-dp.test.e2e.js b/packages/core/strapi/tests/api/basic-dp.test.api.js similarity index 100% rename from packages/core/strapi/tests/api/basic-dp.test.e2e.js rename to packages/core/strapi/tests/api/basic-dp.test.api.js diff --git a/packages/core/strapi/tests/api/basic-dz.test.e2e.js b/packages/core/strapi/tests/api/basic-dz.test.api.js similarity index 100% rename from packages/core/strapi/tests/api/basic-dz.test.e2e.js rename to packages/core/strapi/tests/api/basic-dz.test.api.js diff --git a/packages/core/strapi/tests/api/basic.test.e2e.js b/packages/core/strapi/tests/api/basic.test.api.js similarity index 100% rename from packages/core/strapi/tests/api/basic.test.e2e.js rename to packages/core/strapi/tests/api/basic.test.api.js diff --git a/packages/core/strapi/tests/api/populate/filtering/index.test.e2e.js b/packages/core/strapi/tests/api/populate/filtering/index.test.api.js similarity index 100% rename from packages/core/strapi/tests/api/populate/filtering/index.test.e2e.js rename to packages/core/strapi/tests/api/populate/filtering/index.test.api.js diff --git a/packages/core/strapi/tests/api/populate/sanitize.test.e2e.js b/packages/core/strapi/tests/api/populate/sanitize.test.api.js similarity index 100% rename from packages/core/strapi/tests/api/populate/sanitize.test.e2e.js rename to packages/core/strapi/tests/api/populate/sanitize.test.api.js diff --git a/packages/core/strapi/tests/components/repeatable-not-required-min-max.test.e2e.js b/packages/core/strapi/tests/components/repeatable-not-required-min-max.test.api.js similarity index 100% rename from packages/core/strapi/tests/components/repeatable-not-required-min-max.test.e2e.js rename to packages/core/strapi/tests/components/repeatable-not-required-min-max.test.api.js diff --git a/packages/core/strapi/tests/components/repeatable-not-required.test.e2e.js b/packages/core/strapi/tests/components/repeatable-not-required.test.api.js similarity index 100% rename from packages/core/strapi/tests/components/repeatable-not-required.test.e2e.js rename to packages/core/strapi/tests/components/repeatable-not-required.test.api.js diff --git a/packages/core/strapi/tests/components/repeatable-required-min-max.test.e2e.js b/packages/core/strapi/tests/components/repeatable-required-min-max.test.api.js similarity index 100% rename from packages/core/strapi/tests/components/repeatable-required-min-max.test.e2e.js rename to packages/core/strapi/tests/components/repeatable-required-min-max.test.api.js diff --git a/packages/core/strapi/tests/components/repeatable-required.test.e2e.js b/packages/core/strapi/tests/components/repeatable-required.test.api.js similarity index 100% rename from packages/core/strapi/tests/components/repeatable-required.test.e2e.js rename to packages/core/strapi/tests/components/repeatable-required.test.api.js diff --git a/packages/core/strapi/tests/components/single-not-required.test.e2e.js b/packages/core/strapi/tests/components/single-not-required.test.api.js similarity index 100% rename from packages/core/strapi/tests/components/single-not-required.test.e2e.js rename to packages/core/strapi/tests/components/single-not-required.test.api.js diff --git a/packages/core/strapi/tests/components/single-required.test.e2e.js b/packages/core/strapi/tests/components/single-required.test.api.js similarity index 100% rename from packages/core/strapi/tests/components/single-required.test.e2e.js rename to packages/core/strapi/tests/components/single-required.test.api.js diff --git a/packages/core/strapi/tests/deepFiltering.test.e2e.js b/packages/core/strapi/tests/deepFiltering.test.api.js similarity index 100% rename from packages/core/strapi/tests/deepFiltering.test.e2e.js rename to packages/core/strapi/tests/deepFiltering.test.api.js diff --git a/packages/core/strapi/tests/dynamiczones/simple.test.e2e.js b/packages/core/strapi/tests/dynamiczones/simple.test.api.js similarity index 100% rename from packages/core/strapi/tests/dynamiczones/simple.test.e2e.js rename to packages/core/strapi/tests/dynamiczones/simple.test.api.js diff --git a/packages/core/strapi/tests/dynamiczones/with-media.test.e2e.js b/packages/core/strapi/tests/dynamiczones/with-media.test.api.js similarity index 100% rename from packages/core/strapi/tests/dynamiczones/with-media.test.e2e.js rename to packages/core/strapi/tests/dynamiczones/with-media.test.api.js diff --git a/packages/core/strapi/tests/endpoint.test.e2e.js b/packages/core/strapi/tests/endpoint.test.api.js similarity index 100% rename from packages/core/strapi/tests/endpoint.test.e2e.js rename to packages/core/strapi/tests/endpoint.test.api.js diff --git a/packages/core/strapi/tests/filtering.test.e2e.js b/packages/core/strapi/tests/filtering.test.api.js similarity index 100% rename from packages/core/strapi/tests/filtering.test.e2e.js rename to packages/core/strapi/tests/filtering.test.api.js diff --git a/packages/core/strapi/tests/lifecycles/before-delete.test.e2e.js b/packages/core/strapi/tests/lifecycles/before-delete.test.api.js similarity index 100% rename from packages/core/strapi/tests/lifecycles/before-delete.test.e2e.js rename to packages/core/strapi/tests/lifecycles/before-delete.test.api.js diff --git a/packages/core/strapi/tests/migrations/migration-draft-publish.test.e2e.js b/packages/core/strapi/tests/migrations/migration-draft-publish.test.api.js similarity index 100% rename from packages/core/strapi/tests/migrations/migration-draft-publish.test.e2e.js rename to packages/core/strapi/tests/migrations/migration-draft-publish.test.api.js diff --git a/packages/core/strapi/tests/migrations/migration-required-attribute.test.e2e.js b/packages/core/strapi/tests/migrations/migration-required-attribute.test.api.js similarity index 100% rename from packages/core/strapi/tests/migrations/migration-required-attribute.test.e2e.js rename to packages/core/strapi/tests/migrations/migration-required-attribute.test.api.js diff --git a/packages/core/strapi/tests/migrations/migration-unique-attribute.test.e2e.js b/packages/core/strapi/tests/migrations/migration-unique-attribute.test.api.js similarity index 100% rename from packages/core/strapi/tests/migrations/migration-unique-attribute.test.e2e.js rename to packages/core/strapi/tests/migrations/migration-unique-attribute.test.api.js diff --git a/packages/core/strapi/tests/publication-state.test.e2e.js b/packages/core/strapi/tests/publication-state.test.api.js similarity index 100% rename from packages/core/strapi/tests/publication-state.test.e2e.js rename to packages/core/strapi/tests/publication-state.test.api.js diff --git a/packages/core/strapi/tests/search.test.e2e.js b/packages/core/strapi/tests/search.test.api.js similarity index 100% rename from packages/core/strapi/tests/search.test.e2e.js rename to packages/core/strapi/tests/search.test.api.js diff --git a/packages/core/strapi/tests/single-type.test.e2e.js b/packages/core/strapi/tests/single-type.test.api.js similarity index 100% rename from packages/core/strapi/tests/single-type.test.e2e.js rename to packages/core/strapi/tests/single-type.test.api.js diff --git a/packages/core/upload/tests/admin/file-folder.test.e2e.js b/packages/core/upload/tests/admin/file-folder.test.api.js similarity index 100% rename from packages/core/upload/tests/admin/file-folder.test.e2e.js rename to packages/core/upload/tests/admin/file-folder.test.api.js diff --git a/packages/core/upload/tests/admin/file-image.test.e2e.js b/packages/core/upload/tests/admin/file-image.test.api.js similarity index 100% rename from packages/core/upload/tests/admin/file-image.test.e2e.js rename to packages/core/upload/tests/admin/file-image.test.api.js diff --git a/packages/core/upload/tests/admin/file.test.e2e.js b/packages/core/upload/tests/admin/file.test.api.js similarity index 100% rename from packages/core/upload/tests/admin/file.test.e2e.js rename to packages/core/upload/tests/admin/file.test.api.js diff --git a/packages/core/upload/tests/admin/folder-file.test.e2e.js b/packages/core/upload/tests/admin/folder-file.test.api.js similarity index 100% rename from packages/core/upload/tests/admin/folder-file.test.e2e.js rename to packages/core/upload/tests/admin/folder-file.test.api.js diff --git a/packages/core/upload/tests/admin/folder-structure.test.e2e.js b/packages/core/upload/tests/admin/folder-structure.test.api.js similarity index 100% rename from packages/core/upload/tests/admin/folder-structure.test.e2e.js rename to packages/core/upload/tests/admin/folder-structure.test.api.js diff --git a/packages/core/upload/tests/admin/folder.test.e2e.js b/packages/core/upload/tests/admin/folder.test.api.js similarity index 100% rename from packages/core/upload/tests/admin/folder.test.e2e.js rename to packages/core/upload/tests/admin/folder.test.api.js diff --git a/packages/core/upload/tests/admin/image-dimension.test.e2e.js b/packages/core/upload/tests/admin/image-dimension.test.api.js similarity index 100% rename from packages/core/upload/tests/admin/image-dimension.test.e2e.js rename to packages/core/upload/tests/admin/image-dimension.test.api.js diff --git a/packages/core/upload/tests/admin/settings.test.e2e.js b/packages/core/upload/tests/admin/settings.test.api.js similarity index 100% rename from packages/core/upload/tests/admin/settings.test.e2e.js rename to packages/core/upload/tests/admin/settings.test.api.js diff --git a/packages/core/upload/tests/content-api/graphql-upload-automatic-folder.test.e2e.js b/packages/core/upload/tests/content-api/graphql-upload-automatic-folder.test.api.js similarity index 100% rename from packages/core/upload/tests/content-api/graphql-upload-automatic-folder.test.e2e.js rename to packages/core/upload/tests/content-api/graphql-upload-automatic-folder.test.api.js diff --git a/packages/core/upload/tests/content-api/graphql-upload.test.e2e.js b/packages/core/upload/tests/content-api/graphql-upload.test.api.js similarity index 100% rename from packages/core/upload/tests/content-api/graphql-upload.test.e2e.js rename to packages/core/upload/tests/content-api/graphql-upload.test.api.js diff --git a/packages/core/upload/tests/content-api/upload-automatic-folder.test.e2e.js b/packages/core/upload/tests/content-api/upload-automatic-folder.test.api.js similarity index 100% rename from packages/core/upload/tests/content-api/upload-automatic-folder.test.e2e.js rename to packages/core/upload/tests/content-api/upload-automatic-folder.test.api.js diff --git a/packages/core/upload/tests/content-api/upload.test.e2e.js b/packages/core/upload/tests/content-api/upload.test.api.js similarity index 100% rename from packages/core/upload/tests/content-api/upload.test.e2e.js rename to packages/core/upload/tests/content-api/upload.test.api.js diff --git a/packages/plugins/graphql/tests/crud.test.e2e.js b/packages/plugins/graphql/tests/crud.test.api.js similarity index 100% rename from packages/plugins/graphql/tests/crud.test.e2e.js rename to packages/plugins/graphql/tests/crud.test.api.js diff --git a/packages/plugins/graphql/tests/fields/date.test.e2e.js b/packages/plugins/graphql/tests/fields/date.test.api.js similarity index 100% rename from packages/plugins/graphql/tests/fields/date.test.e2e.js rename to packages/plugins/graphql/tests/fields/date.test.api.js diff --git a/packages/plugins/graphql/tests/fields/datetime.test.e2e.js b/packages/plugins/graphql/tests/fields/datetime.test.api.js similarity index 100% rename from packages/plugins/graphql/tests/fields/datetime.test.e2e.js rename to packages/plugins/graphql/tests/fields/datetime.test.api.js diff --git a/packages/plugins/graphql/tests/relations.test.e2e.js b/packages/plugins/graphql/tests/relations.test.api.js similarity index 100% rename from packages/plugins/graphql/tests/relations.test.e2e.js rename to packages/plugins/graphql/tests/relations.test.api.js diff --git a/packages/plugins/graphql/tests/single-type.test.e2e.js b/packages/plugins/graphql/tests/single-type.test.api.js similarity index 100% rename from packages/plugins/graphql/tests/single-type.test.e2e.js rename to packages/plugins/graphql/tests/single-type.test.api.js diff --git a/packages/plugins/i18n/tests/content-api/content-api.test.e2e.js b/packages/plugins/i18n/tests/content-api/content-api.test.api.js similarity index 100% rename from packages/plugins/i18n/tests/content-api/content-api.test.e2e.js rename to packages/plugins/i18n/tests/content-api/content-api.test.api.js diff --git a/packages/plugins/i18n/tests/content-api/content-types.test.e2e.js b/packages/plugins/i18n/tests/content-api/content-types.test.api.js similarity index 100% rename from packages/plugins/i18n/tests/content-api/content-types.test.e2e.js rename to packages/plugins/i18n/tests/content-api/content-types.test.api.js diff --git a/packages/plugins/i18n/tests/content-manager/crud.test.e2e.js b/packages/plugins/i18n/tests/content-manager/crud.test.api.js similarity index 100% rename from packages/plugins/i18n/tests/content-manager/crud.test.e2e.js rename to packages/plugins/i18n/tests/content-manager/crud.test.api.js diff --git a/packages/plugins/i18n/tests/content-manager/list-relation.test.e2e.js b/packages/plugins/i18n/tests/content-manager/list-relation.test.api.js similarity index 100% rename from packages/plugins/i18n/tests/content-manager/list-relation.test.e2e.js rename to packages/plugins/i18n/tests/content-manager/list-relation.test.api.js diff --git a/packages/plugins/i18n/tests/graphql.test.e2e.js b/packages/plugins/i18n/tests/graphql.test.api.js similarity index 100% rename from packages/plugins/i18n/tests/graphql.test.e2e.js rename to packages/plugins/i18n/tests/graphql.test.api.js diff --git a/packages/plugins/i18n/tests/locales.test.e2e.js b/packages/plugins/i18n/tests/locales.test.api.js similarity index 100% rename from packages/plugins/i18n/tests/locales.test.e2e.js rename to packages/plugins/i18n/tests/locales.test.api.js diff --git a/packages/plugins/users-permissions/tests/admin/roles-api.test.e2e.js b/packages/plugins/users-permissions/tests/admin/roles-api.test.api.js similarity index 100% rename from packages/plugins/users-permissions/tests/admin/roles-api.test.e2e.js rename to packages/plugins/users-permissions/tests/admin/roles-api.test.api.js diff --git a/packages/plugins/users-permissions/tests/content-api/auth.test.e2e.js b/packages/plugins/users-permissions/tests/content-api/auth.test.api.js similarity index 100% rename from packages/plugins/users-permissions/tests/content-api/auth.test.e2e.js rename to packages/plugins/users-permissions/tests/content-api/auth.test.api.js diff --git a/packages/plugins/users-permissions/tests/content-api/users-api.test.e2e.js b/packages/plugins/users-permissions/tests/content-api/users-api.test.api.js similarity index 100% rename from packages/plugins/users-permissions/tests/content-api/users-api.test.e2e.js rename to packages/plugins/users-permissions/tests/content-api/users-api.test.api.js diff --git a/packages/plugins/users-permissions/tests/graphql.test.e2e.js b/packages/plugins/users-permissions/tests/graphql.test.api.js similarity index 100% rename from packages/plugins/users-permissions/tests/graphql.test.e2e.js rename to packages/plugins/users-permissions/tests/graphql.test.api.js diff --git a/packages/plugins/users-permissions/tests/users-graphql.test.e2e.js b/packages/plugins/users-permissions/tests/users-graphql.test.api.js similarity index 100% rename from packages/plugins/users-permissions/tests/users-graphql.test.e2e.js rename to packages/plugins/users-permissions/tests/users-graphql.test.api.js diff --git a/test/e2e.js b/test/api.js similarity index 69% rename from test/e2e.js rename to test/api.js index c4b6a81da0e..97af2e8e0da 100644 --- a/test/e2e.js +++ b/test/api.js @@ -41,11 +41,19 @@ const databases = { }, }; +const jestCmd = + 'jest --config jest.config.api.js --verbose --runInBand --forceExit --detectOpenHandles'.split( + ' ' + ); + const runAllTests = async (args) => { - return execa('yarn', ['test:e2e', ...args], { + console.log(args); + return execa('yarn', [...jestCmd, ...args], { stdio: 'inherit', cwd: path.resolve(__dirname, '..'), env: { + // if STRAPI_LICENSE is in the env the test will run in ee automatically + STRAPI_DISABLE_EE: !process.env.STRAPI_LICENSE, FORCE_COLOR: 1, ENV_PATH: process.env.ENV_PATH, JWT_SECRET: 'aSecret', @@ -53,10 +61,12 @@ const runAllTests = async (args) => { }); }; -const main = async (database, args) => { +const main = async ({ database, generateApp }, args) => { try { - await cleanTestApp(appName); - await generateTestApp({ appName, database }); + if (generateApp) { + await cleanTestApp(appName); + await generateTestApp({ appName, database }); + } await runAllTests(args).catch(() => { process.stdout.write('Tests failed\n', () => { @@ -74,6 +84,9 @@ const main = async (database, args) => { }; yargs + .parserConfiguration({ + 'unknown-options-as-args': true, + }) .command( '$0', 'run end to end tests', @@ -84,11 +97,13 @@ yargs choices: Object.keys(databases), default: 'sqlite', }); + + yarg.boolean('generate-app'); }, (argv) => { - const { database, _: args } = argv; + const { database, generateApp = true } = argv; - main(databases[database], args); + main({ generateApp, database: databases[database] }, argv._); } ) .help() diff --git a/test/create-test-app.js b/test/create-test-app.js index 721327c74ef..9df9bd9cec4 100644 --- a/test/create-test-app.js +++ b/test/create-test-app.js @@ -33,6 +33,7 @@ const databases = { connection: { filename: './tmp/data.db', }, + useNullAsDefault: true, }, }; diff --git a/test/jest2e2.setup.js b/test/jest-api.setup.js similarity index 100% rename from test/jest2e2.setup.js rename to test/jest-api.setup.js diff --git a/yarn.lock b/yarn.lock index 69f80338f39..cc0b8da2204 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7045,7 +7045,7 @@ ansi-styles@^2.2.1: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" integrity sha512-kmCevFghRiWM7HB5zTPULl4r9bVFSWjz62MhqizDGUrq2NWuNMQyuv4tHHoKJHs69M/MF64lEcHdYIocrdWQYA== -ansi-styles@^3.2.0, ansi-styles@^3.2.1: +ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== @@ -8484,7 +8484,7 @@ camelcase@^2.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" integrity sha512-DLIsRzJVBQu72meAKPkWQOLcujdXT32hwdfnkI1frSiSRMK1MofjKHf+MEx0SB6fjEFXL8fBDv1dKymBlOp4Qw== -camelcase@^5.0.0, camelcase@^5.3.1: +camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== @@ -8842,15 +8842,6 @@ cli-width@^3.0.0: resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== -cliui@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" - integrity sha512-PYeGSEmmHM6zvoef2w8TPzlrnNpXIjTipYK780YswmIP9vjxmd6Y2a3CB2Ks6/AU8NHjZugXvo8w3oWM2qnwXA== - dependencies: - string-width "^3.1.0" - strip-ansi "^5.2.0" - wrap-ansi "^5.1.0" - cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -8860,6 +8851,15 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" + clone-deep@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" @@ -10459,11 +10459,6 @@ emittery@^0.10.2: resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.10.2.tgz#902eec8aedb8c41938c46e9385e9db7e03182933" integrity sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw== -emoji-regex@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" - integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== - emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -12077,7 +12072,7 @@ gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -get-caller-file@^2.0.1, get-caller-file@^2.0.5: +get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== @@ -13632,11 +13627,6 @@ is-finite@^1.0.0: resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.1.0.tgz#904135c77fb42c0641d6aa1bcdbc4daa8da082f3" integrity sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w== -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w== - is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -19688,11 +19678,6 @@ require-from-string@2.0.2, require-from-string@^2.0.2: resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== -require-main-filename@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" - integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== - requires-port@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" @@ -20829,15 +20814,6 @@ string-length@^5.0.1: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string-width@^3.0.0, string-width@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" - integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== - dependencies: - emoji-regex "^7.0.1" - is-fullwidth-code-point "^2.0.0" - strip-ansi "^5.1.0" - string-width@^5.0.0: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -20923,7 +20899,7 @@ strip-ansi@^3.0.0, strip-ansi@^3.0.1: dependencies: ansi-regex "^2.0.0" -strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: +strip-ansi@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== @@ -22759,11 +22735,6 @@ which-boxed-primitive@^1.0.2: is-string "^1.0.5" is-symbol "^1.0.3" -which-module@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" - integrity sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q== - which-typed-array@^1.1.2: version "1.1.8" resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.8.tgz#0cfd53401a6f334d90ed1125754a42ed663eb01f" @@ -22857,15 +22828,6 @@ worker-rpc@^0.1.0: dependencies: microevent.ts "~0.1.1" -wrap-ansi@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-5.1.0.tgz#1fd1f67235d5b6d0fee781056001bfb694c03b09" - integrity sha512-QC1/iN/2/RPVJ5jYK8BGttj5z83LmSKmvbvrXPNCLZSEb32KKVDJDl/MOt2N01qU2H/FkzEa9PKto1BqDjtd7Q== - dependencies: - ansi-styles "^3.2.0" - string-width "^3.0.0" - strip-ansi "^5.0.0" - wrap-ansi@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" @@ -23073,34 +23035,23 @@ yargs-parser@21.0.1, yargs-parser@^21.0.0: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35" integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg== -yargs-parser@^13.1.2: - version "13.1.2" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" - integrity sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg== - dependencies: - camelcase "^5.0.0" - decamelize "^1.2.0" - yargs-parser@^20.2.2, yargs-parser@^20.2.3, yargs-parser@^20.2.9: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs@13.3.2: - version "13.3.2" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" - integrity sha512-AX3Zw5iPruN5ie6xGRIDgqkT+ZhnRlZMLMHAs8tg7nRruy2Nb+i5o9bwghAogtM08q1dpr2LVoS8KSTMYpWXUw== +yargs@17.6.0: + version "17.6.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.0.tgz#e134900fc1f218bc230192bdec06a0a5f973e46c" + integrity sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g== dependencies: - cliui "^5.0.0" - find-up "^3.0.0" - get-caller-file "^2.0.1" + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" require-directory "^2.1.1" - require-main-filename "^2.0.0" - set-blocking "^2.0.0" - string-width "^3.0.0" - which-module "^2.0.0" - y18n "^4.0.0" - yargs-parser "^13.1.2" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.0.0" yargs@^16.2.0: version "16.2.0" From 6ae9c6f5ddb0f8e5b66e637fa6978c4f0f9b0fe9 Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Mon, 7 Nov 2022 16:30:12 +0100 Subject: [PATCH 2/3] Cleanup logs --- CONTRIBUTING.md | 2 +- .../core/admin/server/tests/admin-api-token-crud.test.api.js | 2 +- packages/core/admin/server/tests/admin-auth.test.api.js | 2 +- packages/core/admin/server/tests/admin-user.test.api.js | 4 ++-- test/api.js | 1 - 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5f3d18adca4..4fb5b176b7c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -114,7 +114,7 @@ The administration panel should now be available at http://localhost:4000/admin. - `yarn test:front` runs front-end related tests. - `yarn test:front:watch` runs an interactive test watcher for the front-end. - `yarn test:unit` runs the back-end unit tests. -- `yarn test:api` runs an end-to-end test suite. +- `yarn test:api` runs the api integration tests. - `yarn test:generate-app` generates a test application. - `yarn test:start-app` starts the test application. diff --git a/packages/core/admin/server/tests/admin-api-token-crud.test.api.js b/packages/core/admin/server/tests/admin-api-token-crud.test.api.js index 583ea6ceef7..6a6045aeac6 100644 --- a/packages/core/admin/server/tests/admin-api-token-crud.test.api.js +++ b/packages/core/admin/server/tests/admin-api-token-crud.test.api.js @@ -5,7 +5,7 @@ const { createStrapiInstance } = require('../../../../../test/helpers/strapi'); const { createAuthRequest } = require('../../../../../test/helpers/request'); const constants = require('../services/constants'); -describe('Admin API Token v2 CRUD (e2e)', () => { +describe('Admin API Token v2 CRUD (api)', () => { let rq; let strapi; diff --git a/packages/core/admin/server/tests/admin-auth.test.api.js b/packages/core/admin/server/tests/admin-auth.test.api.js index 4678e48af37..7a38beb353b 100644 --- a/packages/core/admin/server/tests/admin-auth.test.api.js +++ b/packages/core/admin/server/tests/admin-auth.test.api.js @@ -24,7 +24,7 @@ describe('Admin Auth End to End', () => { if (edition === 'EE') { internals.role = await utils.createRole({ name: 'auth_test_role', - description: 'Only used for auth crud test (e2e)', + description: 'Only used for auth crud test (api)', }); } else { internals.role = await utils.getSuperAdminRole(); diff --git a/packages/core/admin/server/tests/admin-user.test.api.js b/packages/core/admin/server/tests/admin-user.test.api.js index 72abfd9b80d..7a04853aa21 100644 --- a/packages/core/admin/server/tests/admin-user.test.api.js +++ b/packages/core/admin/server/tests/admin-user.test.api.js @@ -33,7 +33,7 @@ const omitRegistrationToken = omit(['registrationToken']); * 16. Finds a list of users (missing user) */ -describe('Admin User CRUD (e2e)', () => { +describe('Admin User CRUD (api)', () => { let rq; let utils; let strapi; @@ -50,7 +50,7 @@ describe('Admin User CRUD (e2e)', () => { const createUserRole = async () => utils.createRole({ name: 'user_test_role', - description: 'Only used for user crud test (e2e)', + description: 'Only used for user crud test (api)', }); // Initialization Actions diff --git a/test/api.js b/test/api.js index 97af2e8e0da..572e8e0df81 100644 --- a/test/api.js +++ b/test/api.js @@ -47,7 +47,6 @@ const jestCmd = ); const runAllTests = async (args) => { - console.log(args); return execa('yarn', [...jestCmd, ...args], { stdio: 'inherit', cwd: path.resolve(__dirname, '..'), From 15696c21d65b7655492491e02894a2571e7f9481 Mon Sep 17 00:00:00 2001 From: Alexandre Bodin Date: Tue, 8 Nov 2022 10:11:56 +0100 Subject: [PATCH 3/3] Update CONTRIBUTING.md --- CONTRIBUTING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4fb5b176b7c..aa96d15630a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -130,13 +130,13 @@ $ yarn test:generate-app postgres $ yarn test:generate-app mysql ``` -A new app is required every time you run the API integration tests otherwise, the test suite will fail. A command is available to make this process easier: `yarn test:api`. +A new app is required every time you run the API integration tests, otherwise the test suite will fail. A command is available to make this process easier: `yarn test:api`. -This command runs tests using jest behing the scenes. Options for jest can be passed in the command. (e.g. to update snapshots `yarn test:api -u`). +This command runs tests using jest behind the scenes. Options for jest can be passed to the command. (e.g. to update snapshots `yarn test:api -u`). ### Changing the database -By default the script test commmand creates an app that uses `sqlite`. But you can run the test suites using different databases: +By default the script run by `test:api` an app that uses `sqlite` as a database. But you can run the test suites using different databases: ```bash $ yarn test:api --db=sqlite