Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport E2E tests + update CI configuration #1107

Merged
merged 34 commits into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ffb9188
ci: add e2e target
edbzn Oct 1, 2024
e6264c8
chore: fix publish script for e2e packages
edbzn Oct 1, 2024
3497768
test(capacitor-e2e): add e2e tests for capacitor
edbzn Oct 1, 2024
e7f5b7b
chore: fix publish for e2e packages
edbzn Oct 1, 2024
80cfdcc
ci: debug
edbzn Oct 1, 2024
ffb1d40
chore: publish only once
edbzn Oct 2, 2024
e73b693
chore: debug
edbzn Oct 2, 2024
002fa5f
chore: remove verbose mode
edbzn Oct 2, 2024
3f8f357
ci: add cancel + update nx-cloud image + improve commands
edbzn Oct 2, 2024
34d0e91
chore: fix e2e + versioning
edbzn Oct 2, 2024
0eee775
chore: fix e2e
edbzn Oct 2, 2024
7314fd3
chore: bump to Nx v19.8.3
edbzn Oct 2, 2024
77cec1f
chore: disable e2e parallelism
edbzn Oct 2, 2024
5d7fe4f
fix: bump deps
edbzn Oct 2, 2024
b94e463
chore: move e2e config to target defaults
edbzn Oct 4, 2024
e243761
chore: fix build pre-command
edbzn Oct 4, 2024
e8487f8
chore: cache e2e target
edbzn Oct 4, 2024
300f50f
refactor(stencil): fix .sort() on readonly Node array
edbzn Oct 4, 2024
4fc34d7
test: add e2e tests for ionic-angular
edbzn Oct 4, 2024
374ffb4
test: add e2e tests for ionic-react
edbzn Oct 4, 2024
baa1eae
chore: drop resolve version from dist
edbzn Oct 4, 2024
dd9d662
chore: update e2e source roots
edbzn Oct 4, 2024
e447abc
fix(ionic-angular): resolve routes import correctly
edbzn Oct 4, 2024
3db7d8c
chore: update ionic-angular pkg description
edbzn Oct 4, 2024
4395ecd
chore: change (again) build pre-command for e2e release
edbzn Oct 4, 2024
2e352fa
Merge branch 'main' into e2e
edbzn Oct 4, 2024
7a72b00
chore: update (again) version config
edbzn Oct 4, 2024
104065e
fix(ionic-angular): move main.ts to src
edbzn Oct 4, 2024
91003d1
fix(ionic-angular): update jest config to work with ionic
edbzn Oct 4, 2024
b0a6ef8
fix(ionic-angular): update jest config correctly
edbzn Oct 4, 2024
b370873
chore: remove e2e target temporary for failing projects
edbzn Oct 4, 2024
7d81b48
test: add strip ansi util fn
edbzn Oct 5, 2024
43ed794
refactor(ionic-angular): ensure jest config exist
edbzn Oct 5, 2024
d5e2b84
chore: remove migrations file
edbzn Oct 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ on:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

jobs:
main:
name: Nx Cloud - Main Job
uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.13.0
uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.15
with:
main-branch-name: main
number-of-agents: 3
init-commands: |
pnpm exec nx-cloud start-ci-run --stop-agents-after="build" --agent-count=3
pnpm exec nx-cloud start-ci-run --stop-agents-after="e2e" --agent-count=3
parallel-commands: |
pnpm exec nx-cloud record -- pnpm exec nx format:check
parallel-commands-on-agents: |
pnpm exec nx affected --target=lint --parallel=3
pnpm exec nx affected --target=test --parallel=3 --ci --code-coverage
pnpm exec nx affected --target=build --parallel=3
pnpm exec nx affected --target lint build test e2e

agents:
name: Nx Cloud - Agents
uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.13.0
uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.15
with:
number-of-agents: 3
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ e2e/stencil-e2e/tests/dev.test.ts

.nx/cache
.nx/workspace-data
migrations.json
21 changes: 21 additions & 0 deletions e2e/capacitor-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const baseConfig = require('../../eslint.config.js');
module.exports = [
...baseConfig,
{
files: [
'e2e/capacitor-e2e/**/*.ts',
'e2e/capacitor-e2e/**/*.tsx',
'e2e/capacitor-e2e/**/*.js',
'e2e/capacitor-e2e/**/*.jsx',
],
rules: {},
},
{
files: ['e2e/capacitor-e2e/**/*.ts', 'e2e/capacitor-e2e/**/*.tsx'],
rules: {},
},
{
files: ['e2e/capacitor-e2e/**/*.js', 'e2e/capacitor-e2e/**/*.jsx'],
rules: {},
},
];
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-disable */
export default {
displayName: 'vue-e2e',
displayName: 'capacitor-e2e',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/e2e/vue-e2e',
coverageDirectory: '../../coverage/e2e/capacitor-e2e',
globalSetup: '../../tools/scripts/start-local-registry.ts',
globalTeardown: '../../tools/scripts/stop-local-registry.ts',
};
15 changes: 15 additions & 0 deletions e2e/capacitor-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "capacitor-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "e2e/capacitor-e2e/tests",
"targets": {
"e2e": {},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
}
},
"tags": [],
"implicitDependencies": ["capacitor"]
}
57 changes: 57 additions & 0 deletions e2e/capacitor-e2e/tests/capacitor.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { runNxCommandAsync, uniq } from '@nx/plugin/testing';
import { createTestProject, installPlugin, stripAnsi } from '@nxext/e2e-utils';
import { rmSync } from 'fs';

describe('capacitor-project e2e', () => {
let projectDirectory: string;
const app = uniq('capacitor');

beforeAll(async () => {
projectDirectory = createTestProject();
installPlugin(projectDirectory, 'capacitor');

await runNxCommandAsync(
`generate @nx/web:application ${app} --style=css --bundler=vite --e2eTestRunner=none --linter=none --projectNameAndRootFormat=derived --skipFormat=true`
);
await runNxCommandAsync(
`generate @nxext/capacitor:configuration --project=${app} --appName=test --appId=test --skipFormat=true`
);
});

afterAll(() => {
// Cleanup the test project
rmSync(projectDirectory, {
recursive: true,
force: true,
});
});

it('should build successfully', async () => {
const buildResults = await runNxCommandAsync(`build ${app}`);
expect(stripAnsi(buildResults.stdout)).toContain(
`Successfully ran target build for project ${app}`
);
});

it('should run tests successfully', async () => {
const testResults = await runNxCommandAsync(`test ${app}`);
expect(stripAnsi(testResults.stdout)).toContain(
`Successfully ran target test for project ${app}`
);
});

it('should run cap successfully', async () => {
const capResults = await runNxCommandAsync(`run ${app}:cap`);
expect(capResults.stdout).toContain('Usage');

const capPackageInstallResults = await runNxCommandAsync(
`run ${app}:cap --packageInstall false`
);
expect(capPackageInstallResults.stdout).toContain('Usage: cap');

const capHelpResults = await runNxCommandAsync(
`run ${app}:cap --cmd="--help"`
);
expect(capHelpResults.stdout).toContain('Usage: cap');
});
});
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@
"module": "commonjs",
"types": ["jest", "node"]
},
"include": [
"jest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
"include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
}
21 changes: 21 additions & 0 deletions e2e/ionic-angular-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const baseConfig = require('../../eslint.config.js');
module.exports = [
...baseConfig,
{
files: [
'e2e/ionic-angular-e2e/**/*.ts',
'e2e/ionic-angular-e2e/**/*.tsx',
'e2e/ionic-angular-e2e/**/*.js',
'e2e/ionic-angular-e2e/**/*.jsx',
],
rules: {},
},
{
files: ['e2e/ionic-angular-e2e/**/*.ts', 'e2e/ionic-angular-e2e/**/*.tsx'],
rules: {},
},
{
files: ['e2e/ionic-angular-e2e/**/*.js', 'e2e/ionic-angular-e2e/**/*.jsx'],
rules: {},
},
];
12 changes: 12 additions & 0 deletions e2e/ionic-angular-e2e/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable */
export default {
displayName: 'ionic-angular-e2e',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/e2e/ionic-angular-e2e',
globalSetup: '../../tools/scripts/start-local-registry.ts',
globalTeardown: '../../tools/scripts/stop-local-registry.ts',
};
15 changes: 15 additions & 0 deletions e2e/ionic-angular-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "ionic-angular-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "e2e/ionic-angular-e2e/tests",
"targets": {
"e2e": {},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
}
},
"tags": [],
"implicitDependencies": ["ionic-angular"]
}
57 changes: 57 additions & 0 deletions e2e/ionic-angular-e2e/tests/ionic-angular.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { runNxCommandAsync, uniq } from '@nx/plugin/testing';
import { createTestProject, installPlugin, stripAnsi } from '@nxext/e2e-utils';
import { rmSync } from 'fs';

describe('ionic-angular-project e2e', () => {
let projectDirectory: string;
const app = uniq('ionic-angular');

beforeAll(async () => {
projectDirectory = createTestProject();
installPlugin(projectDirectory, 'ionic-angular');

await runNxCommandAsync(
`generate @nx/angular:application ${app} --style=css --minimal --e2eTestRunner=none --linter=none --projectNameAndRootFormat=derived --skipFormat=true`
);
await runNxCommandAsync(
`generate @nxext/ionic-angular:configuration --project=${app} --appName=test --appId=test --skipFormat=true`
);
});

afterAll(() => {
// Cleanup the test project
rmSync(projectDirectory, {
recursive: true,
force: true,
});
});

it('should build successfully', async () => {
const buildResults = await runNxCommandAsync(`build ${app}`);
expect(stripAnsi(buildResults.stdout)).toContain(
`Successfully ran target build for project ${app}`
);
});

it('should run tests successfully', async () => {
const testResults = await runNxCommandAsync(`test ${app}`);
expect(stripAnsi(testResults.stdout)).toContain(
`Successfully ran target test for project ${app}`
);
});

it('should run cap successfully', async () => {
const capResults = await runNxCommandAsync(`run ${app}:cap`);
expect(capResults.stdout).toContain('Usage');

const capPackageInstallResults = await runNxCommandAsync(
`run ${app}:cap --packageInstall false`
);
expect(capPackageInstallResults.stdout).toContain('Usage: cap');

const capHelpResults = await runNxCommandAsync(
`run ${app}:cap --cmd="--help"`
);
expect(capHelpResults.stdout).toContain('Usage: cap');
});
});
10 changes: 10 additions & 0 deletions e2e/ionic-angular-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.spec.json"
}
]
}
9 changes: 9 additions & 0 deletions e2e/ionic-angular-e2e/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
}
21 changes: 21 additions & 0 deletions e2e/ionic-react-e2e/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const baseConfig = require('../../eslint.config.js');
module.exports = [
...baseConfig,
{
files: [
'e2e/ionic-react-e2e/**/*.ts',
'e2e/ionic-react-e2e/**/*.tsx',
'e2e/ionic-react-e2e/**/*.js',
'e2e/ionic-react-e2e/**/*.jsx',
],
rules: {},
},
{
files: ['e2e/ionic-react-e2e/**/*.ts', 'e2e/ionic-react-e2e/**/*.tsx'],
rules: {},
},
{
files: ['e2e/ionic-react-e2e/**/*.js', 'e2e/ionic-react-e2e/**/*.jsx'],
rules: {},
},
];
12 changes: 12 additions & 0 deletions e2e/ionic-react-e2e/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* eslint-disable */
export default {
displayName: 'ionic-react-e2e',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/e2e/ionic-react-e2e',
globalSetup: '../../tools/scripts/start-local-registry.ts',
globalTeardown: '../../tools/scripts/stop-local-registry.ts',
};
14 changes: 14 additions & 0 deletions e2e/ionic-react-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "ionic-react-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "e2e/ionic-react-e2e/tests",
"targets": {
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
}
},
"tags": [],
"implicitDependencies": ["ionic-react"]
}
Loading