From 1dec3d56b1cf35cb5ae4a112dec4b96faa711dbc Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Wed, 6 Oct 2021 12:25:49 +0100 Subject: [PATCH] Renamed our acceptance tests to "e2e" - These are end-to-end tests, make it clearer what they are and what they are supposed to do --- .github/workflows/test.yml | 2 +- package.json | 6 +++--- test/api-acceptance/README.md | 8 -------- test/e2e-api/README.md | 6 ++++++ test/{api-acceptance => e2e-api}/admin/actions.test.js | 0 test/{api-acceptance => e2e-api}/admin/config.test.js | 0 test/{api-acceptance => e2e-api}/admin/db.test.js | 0 .../admin/email_preview.test.js | 0 test/{api-acceptance => e2e-api}/admin/emails.test.js | 0 test/{api-acceptance => e2e-api}/admin/images.test.js | 0 .../admin/integrations.test.js | 0 test/{api-acceptance => e2e-api}/admin/invites.test.js | 0 .../admin/key_authentication.test.js | 0 test/{api-acceptance => e2e-api}/admin/labels.test.js | 0 test/{api-acceptance => e2e-api}/admin/mail.test.js | 0 test/{api-acceptance => e2e-api}/admin/members.test.js | 0 .../admin/notifications.test.js | 0 test/{api-acceptance => e2e-api}/admin/oembed.test.js | 0 test/{api-acceptance => e2e-api}/admin/pages.test.js | 0 test/{api-acceptance => e2e-api}/admin/posts.test.js | 0 test/{api-acceptance => e2e-api}/admin/roles.test.js | 0 test/{api-acceptance => e2e-api}/admin/settings.test.js | 0 test/{api-acceptance => e2e-api}/admin/slugs.test.js | 0 test/{api-acceptance => e2e-api}/admin/snippets.test.js | 0 test/{api-acceptance => e2e-api}/admin/tags.test.js | 0 test/{api-acceptance => e2e-api}/admin/themes.test.js | 0 test/{api-acceptance => e2e-api}/admin/users.test.js | 0 test/{api-acceptance => e2e-api}/admin/utils.js | 0 test/{api-acceptance => e2e-api}/admin/webhooks.test.js | 0 test/{api-acceptance => e2e-api}/content/authors.test.js | 0 .../content/key_authentication.test.js | 0 test/{api-acceptance => e2e-api}/content/pages.test.js | 0 test/{api-acceptance => e2e-api}/content/posts.test.js | 0 test/{api-acceptance => e2e-api}/content/settings.test.js | 0 test/{api-acceptance => e2e-api}/content/tags.test.js | 0 test/{api-acceptance => e2e-api}/content/utils.js | 0 .../advanced_url_config.test.js | 4 ++-- .../default_routes.test.js | 0 .../{frontend-acceptance => e2e-frontend}/members.test.js | 0 test/utils/{acceptance-utils.js => e2e-utils.js} | 0 test/utils/index.js | 8 ++++---- 41 files changed, 16 insertions(+), 18 deletions(-) delete mode 100644 test/api-acceptance/README.md create mode 100644 test/e2e-api/README.md rename test/{api-acceptance => e2e-api}/admin/actions.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/config.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/db.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/email_preview.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/emails.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/images.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/integrations.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/invites.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/key_authentication.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/labels.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/mail.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/members.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/notifications.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/oembed.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/pages.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/posts.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/roles.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/settings.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/slugs.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/snippets.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/tags.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/themes.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/users.test.js (100%) rename test/{api-acceptance => e2e-api}/admin/utils.js (100%) rename test/{api-acceptance => e2e-api}/admin/webhooks.test.js (100%) rename test/{api-acceptance => e2e-api}/content/authors.test.js (100%) rename test/{api-acceptance => e2e-api}/content/key_authentication.test.js (100%) rename test/{api-acceptance => e2e-api}/content/pages.test.js (100%) rename test/{api-acceptance => e2e-api}/content/posts.test.js (100%) rename test/{api-acceptance => e2e-api}/content/settings.test.js (100%) rename test/{api-acceptance => e2e-api}/content/tags.test.js (100%) rename test/{api-acceptance => e2e-api}/content/utils.js (100%) rename test/{frontend-acceptance => e2e-frontend}/advanced_url_config.test.js (96%) rename test/{frontend-acceptance => e2e-frontend}/default_routes.test.js (100%) rename test/{frontend-acceptance => e2e-frontend}/members.test.js (100%) rename test/utils/{acceptance-utils.js => e2e-utils.js} (100%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ea78083477..93a7d3c65f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -105,7 +105,7 @@ jobs: mysql root password: 'root' - run: yarn - - run: yarn test:acceptance + - run: yarn test:e2e env: database__connection__filename: /dev/shm/ghost-test.db - run: yarn test:unit diff --git a/package.json b/package.json index 604e0f8475..1989fffc37 100644 --- a/package.json +++ b/package.json @@ -27,13 +27,13 @@ "main": "grunt shell:main && grunt subgrunt:init", "build": "grunt build", "test": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js --timeout=60000", - "test:all": "yarn test:unit && yarn test:acceptance && yarn lint", + "test:all": "yarn test:unit && yarn test:e2e && yarn lint", "test:debug": "DEBUG=ghost:test* yarn test", "test:unit": "c8 --all -n 'core/{*.js,frontend,server,shared}' --reporter text-summary mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/unit' --timeout=2000", - "test:acceptance": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/api-acceptance' './test/frontend-acceptance' --timeout=10000", + "test:e2e": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/e2e-api' './test/e2e-frontend' --timeout=10000", "test:regression": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/regression' --timeout=60000", "test:reg:slow": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js './test/regression' --timeout=60000 --reporter=mocha-slow-test-reporter", - "test:slow": "yarn test:unit --reporter=mocha-slow-test-reporter && yarn test:acceptance --reporter=mocha-slow-test-reporter", + "test:slow": "yarn test:unit --reporter=mocha-slow-test-reporter && yarn test:e2e --reporter=mocha-slow-test-reporter", "cov:unit": "c8 report --all -n 'core/{*.js,frontend,server,shared}' --reporter text --reporter html", "lint:server": "eslint --ignore-path .eslintignore 'core/server/**/*.js' 'core/*.js' '*.js'", "lint:shared": "eslint --ignore-path .eslintignore 'core/shared/**/*.js'", diff --git a/test/api-acceptance/README.md b/test/api-acceptance/README.md deleted file mode 100644 index 10f00f9634..0000000000 --- a/test/api-acceptance/README.md +++ /dev/null @@ -1,8 +0,0 @@ -## Acceptance Tests - -This folder should only contain a set of basic API use cases. - -The goal for acceptance tests is to keep test cases to basic usecases e.g. upload an image, schedule a post, download a theme. Otherwise tests should be written as a part of regression test suite. - -Future improvement notes: -- We probably need a differentiation for the acceptance tests for session and api_key authentication. diff --git a/test/e2e-api/README.md b/test/e2e-api/README.md new file mode 100644 index 0000000000..5335d410b5 --- /dev/null +++ b/test/e2e-api/README.md @@ -0,0 +1,6 @@ +## End to End (e2e) API Tests + +This folder should contain a set of typtical API use cases. +If we have complex cases (e.g. that require config changes) these should be managed via unit tests for services + +More detail TBD diff --git a/test/api-acceptance/admin/actions.test.js b/test/e2e-api/admin/actions.test.js similarity index 100% rename from test/api-acceptance/admin/actions.test.js rename to test/e2e-api/admin/actions.test.js diff --git a/test/api-acceptance/admin/config.test.js b/test/e2e-api/admin/config.test.js similarity index 100% rename from test/api-acceptance/admin/config.test.js rename to test/e2e-api/admin/config.test.js diff --git a/test/api-acceptance/admin/db.test.js b/test/e2e-api/admin/db.test.js similarity index 100% rename from test/api-acceptance/admin/db.test.js rename to test/e2e-api/admin/db.test.js diff --git a/test/api-acceptance/admin/email_preview.test.js b/test/e2e-api/admin/email_preview.test.js similarity index 100% rename from test/api-acceptance/admin/email_preview.test.js rename to test/e2e-api/admin/email_preview.test.js diff --git a/test/api-acceptance/admin/emails.test.js b/test/e2e-api/admin/emails.test.js similarity index 100% rename from test/api-acceptance/admin/emails.test.js rename to test/e2e-api/admin/emails.test.js diff --git a/test/api-acceptance/admin/images.test.js b/test/e2e-api/admin/images.test.js similarity index 100% rename from test/api-acceptance/admin/images.test.js rename to test/e2e-api/admin/images.test.js diff --git a/test/api-acceptance/admin/integrations.test.js b/test/e2e-api/admin/integrations.test.js similarity index 100% rename from test/api-acceptance/admin/integrations.test.js rename to test/e2e-api/admin/integrations.test.js diff --git a/test/api-acceptance/admin/invites.test.js b/test/e2e-api/admin/invites.test.js similarity index 100% rename from test/api-acceptance/admin/invites.test.js rename to test/e2e-api/admin/invites.test.js diff --git a/test/api-acceptance/admin/key_authentication.test.js b/test/e2e-api/admin/key_authentication.test.js similarity index 100% rename from test/api-acceptance/admin/key_authentication.test.js rename to test/e2e-api/admin/key_authentication.test.js diff --git a/test/api-acceptance/admin/labels.test.js b/test/e2e-api/admin/labels.test.js similarity index 100% rename from test/api-acceptance/admin/labels.test.js rename to test/e2e-api/admin/labels.test.js diff --git a/test/api-acceptance/admin/mail.test.js b/test/e2e-api/admin/mail.test.js similarity index 100% rename from test/api-acceptance/admin/mail.test.js rename to test/e2e-api/admin/mail.test.js diff --git a/test/api-acceptance/admin/members.test.js b/test/e2e-api/admin/members.test.js similarity index 100% rename from test/api-acceptance/admin/members.test.js rename to test/e2e-api/admin/members.test.js diff --git a/test/api-acceptance/admin/notifications.test.js b/test/e2e-api/admin/notifications.test.js similarity index 100% rename from test/api-acceptance/admin/notifications.test.js rename to test/e2e-api/admin/notifications.test.js diff --git a/test/api-acceptance/admin/oembed.test.js b/test/e2e-api/admin/oembed.test.js similarity index 100% rename from test/api-acceptance/admin/oembed.test.js rename to test/e2e-api/admin/oembed.test.js diff --git a/test/api-acceptance/admin/pages.test.js b/test/e2e-api/admin/pages.test.js similarity index 100% rename from test/api-acceptance/admin/pages.test.js rename to test/e2e-api/admin/pages.test.js diff --git a/test/api-acceptance/admin/posts.test.js b/test/e2e-api/admin/posts.test.js similarity index 100% rename from test/api-acceptance/admin/posts.test.js rename to test/e2e-api/admin/posts.test.js diff --git a/test/api-acceptance/admin/roles.test.js b/test/e2e-api/admin/roles.test.js similarity index 100% rename from test/api-acceptance/admin/roles.test.js rename to test/e2e-api/admin/roles.test.js diff --git a/test/api-acceptance/admin/settings.test.js b/test/e2e-api/admin/settings.test.js similarity index 100% rename from test/api-acceptance/admin/settings.test.js rename to test/e2e-api/admin/settings.test.js diff --git a/test/api-acceptance/admin/slugs.test.js b/test/e2e-api/admin/slugs.test.js similarity index 100% rename from test/api-acceptance/admin/slugs.test.js rename to test/e2e-api/admin/slugs.test.js diff --git a/test/api-acceptance/admin/snippets.test.js b/test/e2e-api/admin/snippets.test.js similarity index 100% rename from test/api-acceptance/admin/snippets.test.js rename to test/e2e-api/admin/snippets.test.js diff --git a/test/api-acceptance/admin/tags.test.js b/test/e2e-api/admin/tags.test.js similarity index 100% rename from test/api-acceptance/admin/tags.test.js rename to test/e2e-api/admin/tags.test.js diff --git a/test/api-acceptance/admin/themes.test.js b/test/e2e-api/admin/themes.test.js similarity index 100% rename from test/api-acceptance/admin/themes.test.js rename to test/e2e-api/admin/themes.test.js diff --git a/test/api-acceptance/admin/users.test.js b/test/e2e-api/admin/users.test.js similarity index 100% rename from test/api-acceptance/admin/users.test.js rename to test/e2e-api/admin/users.test.js diff --git a/test/api-acceptance/admin/utils.js b/test/e2e-api/admin/utils.js similarity index 100% rename from test/api-acceptance/admin/utils.js rename to test/e2e-api/admin/utils.js diff --git a/test/api-acceptance/admin/webhooks.test.js b/test/e2e-api/admin/webhooks.test.js similarity index 100% rename from test/api-acceptance/admin/webhooks.test.js rename to test/e2e-api/admin/webhooks.test.js diff --git a/test/api-acceptance/content/authors.test.js b/test/e2e-api/content/authors.test.js similarity index 100% rename from test/api-acceptance/content/authors.test.js rename to test/e2e-api/content/authors.test.js diff --git a/test/api-acceptance/content/key_authentication.test.js b/test/e2e-api/content/key_authentication.test.js similarity index 100% rename from test/api-acceptance/content/key_authentication.test.js rename to test/e2e-api/content/key_authentication.test.js diff --git a/test/api-acceptance/content/pages.test.js b/test/e2e-api/content/pages.test.js similarity index 100% rename from test/api-acceptance/content/pages.test.js rename to test/e2e-api/content/pages.test.js diff --git a/test/api-acceptance/content/posts.test.js b/test/e2e-api/content/posts.test.js similarity index 100% rename from test/api-acceptance/content/posts.test.js rename to test/e2e-api/content/posts.test.js diff --git a/test/api-acceptance/content/settings.test.js b/test/e2e-api/content/settings.test.js similarity index 100% rename from test/api-acceptance/content/settings.test.js rename to test/e2e-api/content/settings.test.js diff --git a/test/api-acceptance/content/tags.test.js b/test/e2e-api/content/tags.test.js similarity index 100% rename from test/api-acceptance/content/tags.test.js rename to test/e2e-api/content/tags.test.js diff --git a/test/api-acceptance/content/utils.js b/test/e2e-api/content/utils.js similarity index 100% rename from test/api-acceptance/content/utils.js rename to test/e2e-api/content/utils.js diff --git a/test/frontend-acceptance/advanced_url_config.test.js b/test/e2e-frontend/advanced_url_config.test.js similarity index 96% rename from test/frontend-acceptance/advanced_url_config.test.js rename to test/e2e-frontend/advanced_url_config.test.js index dd80daa84c..ea52b69c66 100644 --- a/test/frontend-acceptance/advanced_url_config.test.js +++ b/test/e2e-frontend/advanced_url_config.test.js @@ -7,8 +7,8 @@ const urlUtils = require('../utils/urlUtils'); let request; /** - * This file contains extra acceptance tests for complex URL configurations - * Examples of acceptance tests that belong here: + * This file contains extra e2e tests for complex URL configurations + * Examples of e2e tests that belong here: * - subdirectories * - https * - (maybe) admin + frontend URL are different diff --git a/test/frontend-acceptance/default_routes.test.js b/test/e2e-frontend/default_routes.test.js similarity index 100% rename from test/frontend-acceptance/default_routes.test.js rename to test/e2e-frontend/default_routes.test.js diff --git a/test/frontend-acceptance/members.test.js b/test/e2e-frontend/members.test.js similarity index 100% rename from test/frontend-acceptance/members.test.js rename to test/e2e-frontend/members.test.js diff --git a/test/utils/acceptance-utils.js b/test/utils/e2e-utils.js similarity index 100% rename from test/utils/acceptance-utils.js rename to test/utils/e2e-utils.js diff --git a/test/utils/index.js b/test/utils/index.js index a4a84daee0..74e27ddbb5 100644 --- a/test/utils/index.js +++ b/test/utils/index.js @@ -8,7 +8,7 @@ const _ = require('lodash'); const models = require('../../core/server/models'); // Other Test Utilities -const acceptanceUtils = require('./acceptance-utils'); +const e2eUtils = require('./e2e-utils'); const APIUtils = require('./api'); const dbUtils = require('./db-utils'); const fixtureUtils = require('./fixture-utils'); @@ -93,9 +93,9 @@ const createEmailedPost = async function createEmailedPost({postOptions, emailOp }; module.exports = { - startGhost: acceptanceUtils.startGhost, - stopGhost: acceptanceUtils.stopGhost, - getExistingData: acceptanceUtils.getExistingData, + startGhost: e2eUtils.startGhost, + stopGhost: e2eUtils.stopGhost, + getExistingData: e2eUtils.getExistingData, teardownDb: dbUtils.teardown, truncate: dbUtils.truncate,