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
This commit is contained in:
Hannah Wolfe 2021-10-06 12:25:49 +01:00
parent f5f24d9cbc
commit 1dec3d56b1
No known key found for this signature in database
GPG Key ID: 9F8C7532D0A6BA55
41 changed files with 16 additions and 18 deletions

View File

@ -105,7 +105,7 @@ jobs:
mysql root password: 'root' mysql root password: 'root'
- run: yarn - run: yarn
- run: yarn test:acceptance - run: yarn test:e2e
env: env:
database__connection__filename: /dev/shm/ghost-test.db database__connection__filename: /dev/shm/ghost-test.db
- run: yarn test:unit - run: yarn test:unit

View File

@ -27,13 +27,13 @@
"main": "grunt shell:main && grunt subgrunt:init", "main": "grunt shell:main && grunt subgrunt:init",
"build": "grunt build", "build": "grunt build",
"test": "mocha --require=./test/utils/overrides.js --exit --trace-warnings --recursive --extension=test.js --timeout=60000", "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: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: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: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: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", "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:server": "eslint --ignore-path .eslintignore 'core/server/**/*.js' 'core/*.js' '*.js'",
"lint:shared": "eslint --ignore-path .eslintignore 'core/shared/**/*.js'", "lint:shared": "eslint --ignore-path .eslintignore 'core/shared/**/*.js'",

View File

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

6
test/e2e-api/README.md Normal file
View File

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

View File

@ -7,8 +7,8 @@ const urlUtils = require('../utils/urlUtils');
let request; let request;
/** /**
* This file contains extra acceptance tests for complex URL configurations * This file contains extra e2e tests for complex URL configurations
* Examples of acceptance tests that belong here: * Examples of e2e tests that belong here:
* - subdirectories * - subdirectories
* - https * - https
* - (maybe) admin + frontend URL are different * - (maybe) admin + frontend URL are different

View File

@ -8,7 +8,7 @@ const _ = require('lodash');
const models = require('../../core/server/models'); const models = require('../../core/server/models');
// Other Test Utilities // Other Test Utilities
const acceptanceUtils = require('./acceptance-utils'); const e2eUtils = require('./e2e-utils');
const APIUtils = require('./api'); const APIUtils = require('./api');
const dbUtils = require('./db-utils'); const dbUtils = require('./db-utils');
const fixtureUtils = require('./fixture-utils'); const fixtureUtils = require('./fixture-utils');
@ -93,9 +93,9 @@ const createEmailedPost = async function createEmailedPost({postOptions, emailOp
}; };
module.exports = { module.exports = {
startGhost: acceptanceUtils.startGhost, startGhost: e2eUtils.startGhost,
stopGhost: acceptanceUtils.stopGhost, stopGhost: e2eUtils.stopGhost,
getExistingData: acceptanceUtils.getExistingData, getExistingData: e2eUtils.getExistingData,
teardownDb: dbUtils.teardown, teardownDb: dbUtils.teardown,
truncate: dbUtils.truncate, truncate: dbUtils.truncate,