mirror of
https://github.com/strapi/strapi.git
synced 2025-06-27 00:41:25 +00:00
chore: move cli-tests to tests/cli
This commit is contained in:
parent
791bc2c971
commit
7b669622a6
2
.gitignore
vendored
2
.gitignore
vendored
@ -147,6 +147,8 @@ playwright-report
|
||||
test-results
|
||||
!tests/e2e/data/*.tar
|
||||
tests/e2e/.env
|
||||
!tests/cli/data/*.tar.gz
|
||||
tests/cli/.env
|
||||
|
||||
############################
|
||||
# Strapi
|
||||
|
@ -75,7 +75,7 @@ The test-app you create uses a [template](https://docs.strapi.io/developer-docs/
|
||||
|
||||
If you add anything to the template, be sure to add this information to [the docs](/testing/e2e/app-template).
|
||||
|
||||
## Running tests with environment variables
|
||||
## Running tests with environment variables (needed to run EE tests)
|
||||
|
||||
To set specific environment variables for your tests, a `.env` file can be created in the root of the e2e folder. This is useful if you need to run tests with a Strapi license or set future flags.
|
||||
|
||||
@ -89,14 +89,6 @@ Playwright enables reliable end-to-end testing for modern web apps. It's cross b
|
||||
|
||||
For more information check out their [docs](https://playwright.dev/docs/intro). If you're struggling with their APIs, then check out their specific [API documentation](https://playwright.dev/docs/api/class-playwright).
|
||||
|
||||
## Running tests with environment variables
|
||||
|
||||
To set specific environment variables for your tests, a `.env` file can be created in the root of the e2e folder. This is useful if you need to run tests with a Strapi license or set future flags.
|
||||
|
||||
## Running tests with future flags
|
||||
|
||||
If you are writing tests for an unstable future feature you will need to add `app-template/config/features.js`. Currently the app template generation does not take the config folder into consideration. However, the run-e2e-tests script will apply the features config to the generated app. See the documentation for [features.js](https://docs.strapi.io/dev-docs/configurations/features#enabling-a-future-flag)
|
||||
|
||||
## What makes a good end to end test?
|
||||
|
||||
This is the million dollar question. E2E tests typically test complete user flows that touch numerous points of the application it's testing, we're not interested in what happens during a process, only the user perspective and end results. Consider writing them with your story hat on. E.g. "As a user I want to create a new entity, publish that entity, and then be able to retrieve its data from the content API".
|
||||
|
@ -4,7 +4,7 @@ module.exports = {
|
||||
displayName: 'CLI tests',
|
||||
testMatch: ['**/?(*.)+(spec|test).cli.(js|ts)'],
|
||||
testEnvironment: 'node',
|
||||
setupFilesAfterEnv: ['<rootDir>/../../../test/setup/jest-cli.setup.js'],
|
||||
setupFilesAfterEnv: ['<rootDir>/../../../../tests/setup/jest-cli.setup.js'],
|
||||
coveragePathIgnorePatterns: [
|
||||
'<rootDir>/dist/',
|
||||
'<rootDir>/node_modules/',
|
||||
|
@ -49,9 +49,9 @@
|
||||
"setup": "yarn && yarn clean && yarn build --skip-nx-cache",
|
||||
"test:api": "node tests/scripts/run-api-tests.js",
|
||||
"test:clean": "rimraf ./coverage",
|
||||
"test:cli": "node test/scripts/run-cli-tests.js",
|
||||
"test:cli:clean": "node test/scripts/run-cli-tests.js clean",
|
||||
"test:cli:debug": "node test/scripts/run-cli-tests.js --debug",
|
||||
"test:cli": "node tests/scripts/run-cli-tests.js",
|
||||
"test:cli:clean": "node tests/scripts/run-cli-tests.js clean",
|
||||
"test:cli:debug": "node tests/scripts/run-cli-tests.js --debug",
|
||||
"test:e2e": "node tests/scripts/run-e2e-tests.js",
|
||||
"test:e2e:clean": "node tests/scripts/run-e2e-tests.js clean",
|
||||
"test:e2e:debug": "node tests/scripts/run-e2e-tests.js --debug",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { describeOnCondition } from '../../utils/shared';
|
||||
import { describeOnCondition, navToHeader } from '../../utils/shared';
|
||||
import { resetDatabaseAndImportDataFromPath } from '../../scripts/dts-import';
|
||||
import { login } from '../../utils/login';
|
||||
|
||||
@ -92,11 +92,9 @@ describeOnCondition(edition === 'EE')('Releases page', () => {
|
||||
await expect(page.getByRole('link', { name: `${newReleaseName}` })).toBeVisible();
|
||||
});
|
||||
|
||||
test('A user should be able to perform bulk release on entries', async ({ page }) => {
|
||||
await page.getByRole('link', { name: 'Content Manager' }).click();
|
||||
test.skip('A user should be able to perform bulk release on entries', async ({ page }) => {
|
||||
await navToHeader(page, ['Content Manager', 'Article'], 'Article');
|
||||
|
||||
await expect(page).toHaveTitle('Content Manager');
|
||||
await expect(page.getByRole('heading', { name: 'Article' })).toBeVisible();
|
||||
const publishedItems = page.getByRole('gridcell', { name: 'published' });
|
||||
expect(publishedItems).toHaveCount(2);
|
||||
const checkbox = page.getByRole('checkbox', { name: 'Select all entries' });
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { login } from '../../../utils/login';
|
||||
import { resetDatabaseAndImportDataFromPath } from '../../../scripts/dts-import';
|
||||
import { navToHeader } from '../../../utils/shared';
|
||||
import { login } from '../../utils/login';
|
||||
import { resetDatabaseAndImportDataFromPath } from '../../scripts/dts-import';
|
||||
import { navToHeader } from '../../utils/shared';
|
||||
|
||||
const createTransferToken = async (page, tokenName, duration, type) => {
|
||||
await navToHeader(
|
||||
|
@ -10,7 +10,7 @@ const { cleanTestApp, generateTestApp } = require('../helpers/test-app');
|
||||
|
||||
const cwd = path.resolve(__dirname, '../..');
|
||||
const testAppDirectory = path.join(cwd, 'test-apps', 'cli');
|
||||
const testRoot = path.join(cwd, 'cli-tests');
|
||||
const testRoot = path.join(cwd, 'tests', 'cli');
|
||||
const testsDir = path.join(testRoot, 'tests');
|
||||
const templateDir = path.join(testRoot, 'app-template');
|
||||
|
||||
@ -222,7 +222,7 @@ yargs
|
||||
'jest',
|
||||
[
|
||||
'--config',
|
||||
'../../../jest.config.cli.js',
|
||||
'../../../../jest.config.cli.js',
|
||||
'--rootDir',
|
||||
domainDir,
|
||||
'--color',
|
||||
|
@ -62,7 +62,7 @@ yargs
|
||||
* This lets us pass any other arguments to playwright
|
||||
* e.g. the name of a specific test or the project we want to run
|
||||
*/
|
||||
'unknown-options-as-args': true,
|
||||
'unknown-options-as-args': false,
|
||||
})
|
||||
.command({
|
||||
command: '*',
|
||||
|
Loading…
x
Reference in New Issue
Block a user