Skip to content

Commit dc2659c

Browse files
authored
test(ember): Update ember tests to use E2E structure (#11827)
This gets rid of the Ember canary tests that are always failing, probably due to ember-try (which we use there) not playing nicely with the monorepo etc. Instead, this now uses the proper E2E setup. I added two tests, for classic ember and modern embroider-based ember. While doing this I also noticed two bugs I fixed along the way :O This also removed the ember canary tests, IMHO the e2e tests are good enough for us there now.
1 parent ef7e5b6 commit dc2659c

File tree

97 files changed

+2623
-43
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+2623
-43
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,6 +1015,8 @@ jobs:
10151015
'node-express-esm-without-loader',
10161016
'node-express-cjs-preload',
10171017
'node-otel-sdk-node',
1018+
'ember-classic',
1019+
'ember-embroider',
10181020
'nextjs-app-dir',
10191021
'nextjs-14',
10201022
'nextjs-15',

.github/workflows/canary.yml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -151,45 +151,3 @@ jobs:
151151
with:
152152
filename: .github/CANARY_FAILURE_TEMPLATE.md
153153
update_existing: true
154-
155-
job_ember_canary_test:
156-
name: Ember Canary Tests
157-
runs-on: ubuntu-20.04
158-
timeout-minutes: 30
159-
strategy:
160-
fail-fast: false
161-
matrix:
162-
# scenario: [ember-release, embroider-optimized, ember-4.0]
163-
scenario: [ember-4.0]
164-
steps:
165-
- name: 'Check out current commit'
166-
uses: actions/checkout@v4
167-
with:
168-
ref: ${{ env.HEAD_COMMIT }}
169-
- name: Set up Node
170-
uses: actions/setup-node@v4
171-
with:
172-
node-version-file: 'package.json'
173-
- name: Install dependencies
174-
run: yarn install --ignore-engines --frozen-lockfile
175-
176-
- name: Build dependencies
177-
run: |
178-
yarn lerna run build:types --scope=@sentry/ember --include-dependencies
179-
yarn lerna run build:transpile --scope=@sentry/ember --include-dependencies
180-
181-
- name: Run Ember tests
182-
run: |
183-
cd packages/ember
184-
yarn ember try:one ${{ matrix.scenario }} --skip-cleanup=true
185-
186-
- name: Create Issue
187-
if: failure() && github.event_name == 'schedule'
188-
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5
189-
env:
190-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
191-
RUN_LINK: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
192-
TITLE: Ember Canary ${{ matrix.scenario }} Test Failed
193-
with:
194-
filename: .github/CANARY_FAILURE_TEMPLATE.md
195-
update_existing: true

dev-packages/e2e-tests/test-applications/aws-lambda-layer-cjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"devDependencies": {
1616
"@sentry-internal/test-utils": "link:../../../test-utils",
17-
"@playwright/test": "^1.41.1",
17+
"@playwright/test": "^1.44.1",
1818
"wait-port": "1.0.4"
1919
},
2020
"volta": {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
indent_style = space
13+
indent_size = 2
14+
15+
[*.hbs]
16+
insert_final_newline = false
17+
18+
[*.{diff,md}]
19+
trim_trailing_whitespace = false
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
/**
3+
Ember CLI sends analytics information by default. The data is completely
4+
anonymous, but there are times when you might want to disable this behavior.
5+
6+
Setting `disableAnalytics` to true will prevent any data from being sent.
7+
*/
8+
"disableAnalytics": false,
9+
10+
/**
11+
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
12+
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
13+
*/
14+
"isTypeScriptProject": false
15+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist/
5+
/tmp/
6+
7+
# dependencies
8+
/bower_components/
9+
/node_modules/
10+
11+
# misc
12+
/.env*
13+
/.pnp*
14+
/.sass-cache
15+
/.eslintcache
16+
/connect.lock
17+
/coverage/
18+
/libpeerconnection.log
19+
/npm-debug.log*
20+
/testem.log
21+
/yarn-error.log
22+
23+
# ember-try
24+
/.node_modules.ember-try/
25+
/bower.json.ember-try
26+
/npm-shrinkwrap.json.ember-try
27+
/package.json.ember-try
28+
/package-lock.json.ember-try
29+
/yarn.lock.ember-try
30+
31+
# broccoli-debug
32+
/DEBUG/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@sentry:registry=http://127.0.0.1:4873
2+
@sentry-internal:registry=http://127.0.0.1:4873
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"ignore_dirs": ["tmp", "dist"]
3+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# ember-classic
2+
3+
This README outlines the details of collaborating on this Ember application. A short introduction of this app could
4+
easily go here.
5+
6+
## Prerequisites
7+
8+
You will need the following things properly installed on your computer.
9+
10+
- [Git](https://git-scm.com/)
11+
- [Node.js](https://nodejs.org/) (with npm)
12+
- [Ember CLI](https://cli.emberjs.com/release/)
13+
- [Google Chrome](https://google.com/chrome/)
14+
15+
## Installation
16+
17+
- `git clone <repository-url>` this repository
18+
- `cd ember-classic`
19+
- `npm install`
20+
21+
## Running / Development
22+
23+
- `ember serve`
24+
- Visit your app at [http://localhost:4200](http://localhost:4200).
25+
- Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).
26+
27+
### Code Generators
28+
29+
Make use of the many generators for code, try `ember help generate` for more details
30+
31+
### Running Tests
32+
33+
- `ember test`
34+
- `ember test --server`
35+
36+
### Linting
37+
38+
- `npm run lint`
39+
- `npm run lint:fix`
40+
41+
### Building
42+
43+
- `ember build` (development)
44+
- `ember build --environment production` (production)
45+
46+
### Deploying
47+
48+
Specify what it takes to deploy your app.
49+
50+
## Further Reading / Useful Links
51+
52+
- [ember.js](https://emberjs.com/)
53+
- [ember-cli](https://cli.emberjs.com/release/)
54+
- Development Browser Extensions
55+
- [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
56+
- [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Application from '@ember/application';
2+
import * as Sentry from '@sentry/ember';
3+
import loadInitializers from 'ember-load-initializers';
4+
import Resolver from 'ember-resolver';
5+
6+
import config from './config/environment';
7+
8+
Sentry.init({
9+
replaysSessionSampleRate: 1,
10+
replaysOnErrorSampleRate: 1,
11+
tunnel: `http://localhost:3031/`, // proxy server
12+
});
13+
14+
export default class App extends Application {
15+
public modulePrefix = config.modulePrefix;
16+
public podModulePrefix = config.podModulePrefix;
17+
public Resolver = Resolver;
18+
}
19+
20+
loadInitializers(App, config.modulePrefix);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<a href={{this.href}} class={{if this.isActive 'active'}} {{on 'click' this.onClick}}>
2+
{{yield}}
3+
</a>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { action } from '@ember/object';
2+
import type RouterService from '@ember/routing/router-service';
3+
import { inject as service } from '@ember/service';
4+
import Component from '@glimmer/component';
5+
6+
interface Args {
7+
route: string;
8+
}
9+
10+
/*
11+
Note: We use this custom component instead of the built-in `<LinkTo>`,
12+
as that is an ember component in older versions, and a glimmer component in newer versions.
13+
14+
Since glimmer components are, as of now, not instrumented, this leads to different test results.
15+
*/
16+
export default class LinkComponent extends Component<Args> {
17+
@service public declare router: RouterService;
18+
19+
public get href(): string {
20+
return this.router.urlFor(this.args.route);
21+
}
22+
23+
public get isActive(): boolean {
24+
return this.router.currentRouteName === this.args.route;
25+
}
26+
27+
@action
28+
public onClick(event: MouseEvent): void {
29+
event.preventDefault();
30+
31+
void this.router.transitionTo(this.args.route);
32+
}
33+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* eslint-disable ember/no-empty-glimmer-component-classes */
2+
import Component from '@glimmer/component';
3+
4+
export default class SlowLoadingGCList extends Component {}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* eslint-disable ember/no-classic-classes */
2+
/* eslint-disable ember/no-classic-components */
3+
import Component from '@ember/component';
4+
import { computed } from '@ember/object';
5+
6+
interface Args {
7+
title?: string;
8+
items: number;
9+
}
10+
11+
export default Component.extend({
12+
tagName: '',
13+
14+
_title: computed('title', function () {
15+
return (this as Args).title || 'Slow Loading List';
16+
}),
17+
18+
rowItems: computed('items', function () {
19+
return new Array((this as Args).items).fill(0).map((_, index) => {
20+
return {
21+
index: index + 1,
22+
};
23+
});
24+
}),
25+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* eslint-disable ember/no-classic-classes */
2+
/* eslint-disable ember/no-classic-components */
3+
/* eslint-disable ember/require-tagless-components */
4+
import Component from '@ember/component';
5+
6+
export default Component.extend({});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Type declarations for
3+
* import config from './config/environment'
4+
*
5+
* For now these need to be managed by the developer
6+
* since different ember addons can materialize new entries.
7+
*/
8+
declare const config: {
9+
environment: string;
10+
modulePrefix: string;
11+
podModulePrefix: string;
12+
locationType: 'history' | 'hash' | 'none' | 'auto';
13+
rootURL: string;
14+
APP: Record<string, unknown>;
15+
};
16+
17+
export default config;
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import Controller from '@ember/controller';
2+
import { action } from '@ember/object';
3+
import { scheduleOnce } from '@ember/runloop';
4+
import { tracked } from '@glimmer/tracking';
5+
import { Promise } from 'rsvp';
6+
7+
export default class IndexController extends Controller {
8+
@tracked public showComponents = false;
9+
10+
@action
11+
public createError(): void {
12+
// @ts-expect-error this is fine
13+
this.nonExistentFunction();
14+
}
15+
16+
@action
17+
public createEmberError(): void {
18+
throw new Error('Whoops, looks like you have an EmberError');
19+
}
20+
21+
@action
22+
public createCaughtEmberError(): void {
23+
try {
24+
throw new Error('Looks like you have a caught EmberError');
25+
} catch (e) {
26+
// do nothing
27+
}
28+
}
29+
30+
@action
31+
public createFetchError(): void {
32+
void fetch('http://doesntexist.example');
33+
}
34+
35+
@action
36+
public createAfterRenderError(): void {
37+
function throwAfterRender(): void {
38+
throw new Error('After Render Error');
39+
}
40+
scheduleOnce('afterRender', null, throwAfterRender);
41+
}
42+
43+
@action
44+
public createRSVPRejection(): Promise<void> {
45+
const promise = new Promise<void>((resolve, reject) => {
46+
reject('Promise rejected');
47+
});
48+
return promise;
49+
}
50+
51+
@action
52+
public createRSVPError(): Promise<void> {
53+
const promise = new Promise<void>(() => {
54+
throw new Error('Error within RSVP Promise');
55+
});
56+
return promise;
57+
}
58+
59+
@action
60+
public toggleShowComponents(): void {
61+
this.showComponents = !this.showComponents;
62+
}
63+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Controller from '@ember/controller';
2+
import { action } from '@ember/object';
3+
import type RouterService from '@ember/routing/router-service';
4+
import { inject as service } from '@ember/service';
5+
6+
export default class SlowLoadingRouteController extends Controller {
7+
@service public declare router: RouterService;
8+
9+
@action
10+
public back(): void {
11+
void this.router.transitionTo('tracing');
12+
}
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Controller from '@ember/controller';
2+
3+
export default class SlowLoadingRouteController extends Controller {
4+
public slowLoadingTemplateOnlyItems = new Array(2000).fill(0).map((_, index) => index);
5+
}

0 commit comments

Comments
 (0)