This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(schematic): Schematics for dt-e2e component.
Co-authored-by: Fabian Friedl <ffriedl89@gmail.com>
- Loading branch information
1 parent
ee205ef
commit 4c0231a
Showing
23 changed files
with
789 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Shipped schematics | ||
|
||
This schematics generates the component for barista e2e tests. The only needed | ||
parameter is the name of the component. | ||
|
||
## Usage | ||
|
||
- Please run: `ng build workspace` and after that, | ||
`ng g ./dist/libs/workspace:dt-e2e --name={name of your component}` | ||
|
||
### Testing | ||
|
||
The schematics can be tested with the `ng test workspace` command. |
176 changes: 176 additions & 0 deletions
176
libs/workspace/src/schematics/dt-component-e2e/__snapshots__/index.spec.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,176 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Add E2E Component should change files appropriately 1`] = ` | ||
"/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the \\"License\\"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an \\"AS IS\\" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
// @ts-nocheck | ||
// Code copy pasted from original app.routing.module | ||
// Used only for testing purposes | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
export const routes: Routes = [ | ||
{ | ||
path: 'autocomplete', | ||
loadChildren: () => | ||
import('').then((module) => module.DtE2EAutocompleteModule), | ||
}, | ||
{ | ||
path: 'button', | ||
loadChildren: () => import('').then((module) => module.DtE2EButtonModule), | ||
}, | ||
{ | ||
path: 'alert', | ||
loadChildren: () => | ||
import('../components/alert/alert.module').then( | ||
(module) => module.DtE2EAlertModule, | ||
), | ||
}, | ||
]; | ||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
RouterModule.forRoot(routes, { | ||
scrollPositionRestoration: 'enabled', | ||
anchorScrolling: 'enabled', | ||
paramsInheritanceStrategy: 'always', | ||
enableTracing: false, // Can be set for debugging the router | ||
initialNavigation: 'enabled', | ||
}), | ||
], | ||
exports: [RouterModule], | ||
}) | ||
export class AppRoutingModule {} | ||
" | ||
`; | ||
|
||
exports[`Add E2E Component should generate files with the appropriate content 1`] = ` | ||
"/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the \\"License\\"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an \\"AS IS\\" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { alert } from './alert.po'; | ||
fixture('Alert').page('http://localhost:4200/alert'); | ||
test('should exists', async (testController: TestController) => { | ||
await testController.expect(alert.exists).ok(); | ||
}); | ||
" | ||
`; | ||
|
||
exports[`Add E2E Component should generate files with the appropriate content 2`] = ` | ||
"<dt-alert id=\\"test-alert\\"></dt-alert> | ||
" | ||
`; | ||
exports[`Add E2E Component should generate files with the appropriate content 3`] = ` | ||
"/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the \\"License\\"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an \\"AS IS\\" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { Route, RouterModule } from '@angular/router'; | ||
import { DtAlertModule } from '@dynatrace/barista-components/alert'; | ||
import { DtE2EAlert } from './alert'; | ||
const routes: Route[] = [{ path: '', component: DtE2EAlert }]; | ||
@NgModule({ | ||
declarations: [DtE2EAlert], | ||
imports: [CommonModule, RouterModule.forChild(routes), DtAlertModule], | ||
}) | ||
export class DtE2EAlertModule {} | ||
" | ||
`; | ||
exports[`Add E2E Component should generate files with the appropriate content 4`] = ` | ||
"/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the \\"License\\"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an \\"AS IS\\" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { Selector } from 'testcafe'; | ||
export const alert = Selector('#test-alert'); | ||
" | ||
`; | ||
exports[`Add E2E Component should generate files with the appropriate content 5`] = ` | ||
"/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the \\"License\\"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an \\"AS IS\\" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import { Component } from '@angular/core'; | ||
@Component({ | ||
selector: 'dt-e2e-alert', | ||
templateUrl: 'alert.html', | ||
}) | ||
export class DtE2EAlert {} | ||
" | ||
`; |
23 changes: 23 additions & 0 deletions
23
...e2e/files/apps/components-e2e/src/components/__name@dasherize__/__name@dasherize__.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { <%= camelize(name) %> } from './<%= dasherize(name) %>.po'; | ||
|
||
fixture('<%= capitalize(name) %>').page('http://localhost:4200/<%= dasherize(name) %>'); | ||
|
||
test('should exists', async (testController: TestController) => { | ||
await testController.expect(<%= camelize(name) %>.exists).ok(); | ||
}); |
1 change: 1 addition & 0 deletions
1
...t-e2e/files/apps/components-e2e/src/components/__name@dasherize__/__name@dasherize__.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<<%= selector %> id="test-<%= dasherize(name) %>"></<%= selector %>> |
29 changes: 29 additions & 0 deletions
29
.../files/apps/components-e2e/src/components/__name@dasherize__/__name@dasherize__.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { Route, RouterModule } from '@angular/router'; | ||
import { <%= componentModule.name %> } from '<%= componentModule.package %>'; | ||
import { <%= e2eComponent.component %> } from './<%= dasherize(name) %>'; | ||
|
||
const routes: Route[] = [{ path: '', component: <%= e2eComponent.component %> }]; | ||
|
||
@NgModule({ | ||
declarations: [<%= e2eComponent.component %>], | ||
imports: [CommonModule, RouterModule.forChild(routes), <%= componentModule.name %>], | ||
}) | ||
export class <%= e2eComponent.module %> {} |
19 changes: 19 additions & 0 deletions
19
...-e2e/files/apps/components-e2e/src/components/__name@dasherize__/__name@dasherize__.po.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { Selector } from 'testcafe'; | ||
|
||
export const <%= camelize(name) %> = Selector('#test-<%= dasherize(name) %>'); |
25 changes: 25 additions & 0 deletions
25
...ent-e2e/files/apps/components-e2e/src/components/__name@dasherize__/__name@dasherize__.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'dt-e2e-<%= dasherize(name) %>', | ||
templateUrl: '<%= dasherize(name) %>.html', | ||
}) | ||
export class <%= e2eComponent.component %> { | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
libs/workspace/src/schematics/dt-component-e2e/fixtures/alert.fixture.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// @ts-nocheck | ||
// this is an empty file for testing purposes |
Oops, something went wrong.