Skip to content

Commit

Permalink
Merge pull request #188 from jhipster/feature/protractor-issue101
Browse files Browse the repository at this point in the history
Feature/protractor issue101
  • Loading branch information
Angelo Manganiello committed Dec 1, 2020
2 parents df15c0e + 754517e commit 920d3d7
Show file tree
Hide file tree
Showing 58 changed files with 957 additions and 200 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ jobs:
name: npm test
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
timeout-minutes: 20
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
node_version: [12.16.2]
node_version: [12.16.1]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v1
Expand Down
100 changes: 76 additions & 24 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,107 @@ jobs:
name: ${{ matrix.app-type }}
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
timeout-minutes: 20
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
node_version: [12.16.2]
node_version: [12.16.1]
os: [ubuntu-latest]
app-type:
- monolith-react-oauth2-dev
- monolith-angular-jwt-i18n-dev
- monolith-react-jwt-jdl
- monolith-react-jwt-i18n-jdl
- monolith-react-oauth2-jdl
- monolith-react-oauth2-i18n-jdl
- monolith-angular-jwt-jdl
- monolith-angular-jwt-i18n-jdl
- monolith-angular-oauth2-jdl
- monolith-angular-oauth2-i18n-jdl
- monolith-angular-jwt-i18n-dev
- monolith-react-oauth2-dev
- microservice-oauth2-jdl
include:
- app-type: monolith-react-oauth2-dev
arg: 'no'
- app-type: monolith-angular-jwt-i18n-dev
arg: 'no'
- app-type: monolith-react-jwt-jdl
arg: import-jdl
app-folder: monolith-client-auth-template-jdl
entity: import-jdl
e2e: jwt
- app-type: monolith-react-jwt-i18n-jdl
app-folder: monolith-client-auth-i18n-template-jdl
entity: import-jdl
e2e: jwt
- app-type: monolith-react-oauth2-jdl
app-folder: monolith-client-auth-template-jdl
entity: import-jdl
e2e: 'oauth2'
- app-type: monolith-react-oauth2-i18n-jdl
arg: import-jdl
app-folder: monolith-client-auth-i18n-template-jdl
entity: import-jdl
e2e: oauth2
- app-type: monolith-angular-jwt-jdl
app-folder: monolith-client-auth-template-jdl
entity: import-jdl
e2e: jwt
- app-type: monolith-angular-jwt-i18n-jdl
app-folder: monolith-client-auth-i18n-template-jdl
entity: import-jdl
e2e: jwt
- app-type: monolith-angular-oauth2-jdl
app-folder: monolith-client-auth-template-jdl
entity: import-jdl
e2e: oauth2
- app-type: monolith-angular-oauth2-i18n-jdl
app-folder: monolith-client-auth-i18n-template-jdl
entity: import-jdl
e2e: oauth2
- app-type: monolith-angular-jwt-i18n-dev
app-folder: monolith-angular-jwt-i18n-dev
entity: 'no'
e2e: jwt
- app-type: monolith-react-oauth2-dev
app-folder: monolith-react-oauth2-dev
entity: 'no'
e2e: oauth2
- app-type: microservice-oauth2-jdl
arg: post-import-jdl
app-folder: microservice-oauth2-jdl
entity: post-import-jdl
e2e: 'no'
env:
JHI_APP: ${{ matrix.app-type }}
JHI_ARG: ${{ matrix.arg }}
NHI_APP: ${{ matrix.app-type }}
NHI_APP_FOLDER: ${{ matrix.app-folder }}
NHI_ENTITY: ${{ matrix.entity }}
NHI_E2E: ${{ matrix.e2e }}

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: git history
- name: GIT HISTORY
run: git --no-pager log -n 10 --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) <%an>%Creset' --abbrev-commit
- name: DOWNLOAD LATEST CHROME binary
run: |
sudo apt update
sudo apt install google-chrome-stable
- name: PREPARE jhipster env
run: sudo sh test-integration/00-install-all-jhipster.sh
- name: 'CONFIGURE EVENTUAL TEMPLATE APP'
if: contains(env.NHI_APP_FOLDER, 'template')
run: sudo bash test-integration/0x-configure-template.sh $NHI_APP_FOLDER $NHI_APP
- name: 'GENERATE NHipster app'
run: sudo sh test-integration/01-generate-app-sample.sh $JHI_APP $JHI_ARG
run: sudo sh test-integration/01-generate-app-sample.sh $NHI_APP_FOLDER $NHI_ENTITY
- name: 'INSTALL DEPENDENCIES of generated app'
run: sudo sh test-integration/02-install-dependencies-app-sample.sh $JHI_APP
run: sudo sh test-integration/02-install-dependencies-app-sample.sh $NHI_APP_FOLDER
- name: 'GENERATE bar SERVER SERVICE'
run: sudo sh test-integration/03-generate-component-sample.sh $JHI_APP service bar
run: sudo sh test-integration/03-generate-component-sample.sh $NHI_APP_FOLDER service bar
- name: 'GENERATE foo SERVER CONTROLLER'
run: sudo sh test-integration/03-generate-component-sample.sh $JHI_APP controller foo
run: sudo sh test-integration/03-generate-component-sample.sh $NHI_APP_FOLDER controller foo
- name: 'RUN UNIT TESTS of generated app'
run: sudo sh test-integration/04-run-generated-unit-tests-of-sample.sh $JHI_APP
- name: 'RUN E2E TESTS of generated app'
run: sudo sh test-integration/05-run-generated-e2e-tests-of-sample.sh $JHI_APP
run: sudo sh test-integration/04-run-generated-unit-tests-of-sample.sh $NHI_APP_FOLDER
- name: 'RUN SERVER E2E TESTS of generated app'
run: sudo sh test-integration/05-run-generated-e2e-tests-of-sample.sh $NHI_APP_FOLDER
- name: 'BUILD AND RUN SERVER APP'
run: sudo sh test-integration/06-run-generated-app-sample.sh $JHI_APP build
- name: 'START APP'
run: sudo sh test-integration/06-run-generated-app-sample.sh $JHI_APP run
run: sudo sh test-integration/07-run-generated-app-sample.sh $NHI_APP_FOLDER build
- name: 'RUN DOCKER KEYCLOAK for CLIENT E2E oauth2 TESTS'
if: "env.NHI_E2E == 'oauth2'"
run: sudo sh test-integration/06-docker-compose.sh $NHI_APP_FOLDER
- name: 'START APP WITH EVENTUAL CLIENT E2E TESTS'
run: sudo sh test-integration/07-run-generated-app-sample.sh $NHI_APP_FOLDER $NHI_E2E
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

# [1.4.0](https://github.com/jhipster/generator-jhipster-nodejs/tree/v1.4.0)

- Protractor or another tool for client e2e tests [issue #101](https://github.com/jhipster/generator-jhipster-nodejs/issues/101)
- Support the account management with user registration, delete, creation and changes password with settings [issue #166](https://github.com/jhipster/generator-jhipster-nodejs/issues/166)
- NestJS migration from 6 to 7 version [issue #183](https://github.com/jhipster/generator-jhipster-nodejs/issues/183)

# [1.3.0](https://github.com/jhipster/generator-jhipster-nodejs/tree/v1.3.0) - 02/11/2020 released date
Expand Down
5 changes: 4 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ To contribute for the next featues, fork the repo and open a pull request regard
- Swagger support
- Entity ORM generation for prod database (sql) and dev database (default db is sqlite already configured)
- Basic security management with jwt and oauth2
- Jest e2e tests for server and jhipster e2e client tests
- All subgenerators

> Let it free to give advices or tips!
Expand Down Expand Up @@ -47,6 +48,8 @@ To contribute for the next featues, fork the repo and open a pull request regard
- [x] OAuth2 feature for Keycloack
- [x] Encrypt user password in db
- [x] Languages subgenerator support i18n: translate home page for NHipster and remove spring boot resources message
- [x] Jhipster client e2e protractor tests integrated
- [x] Other core/admin jhipster management api

## To DO for next release

Expand All @@ -57,4 +60,4 @@ To contribute for the next featues, fork the repo and open a pull request regard
- [ ] pagination options in client
- [ ] Elastic Search support
- [ ] Search api
- [ ] Other core/admin jhipster management api and services with sending email
- [ ] Admin services sending email (for new user and change password api)
9 changes: 7 additions & 2 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,13 @@ module.exports = class extends AppGenerator {
validateJava() {},

customSettings() {
this.testFrameworks = [];
this.protractorTests = false;
if (!this.skipClient) {
this.testFrameworks = ['protractor'];
this.protractorTests = true;
} else {
this.testFrameworks = [];
this.protractorTests = false;
}
if (this.options['skip-i18n']) {
this.enableTranslation = false;
this.skipI18n = true;
Expand Down
28 changes: 27 additions & 1 deletion generators/client/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,44 @@ const clientFiles = {
file: 'react/shared/layout/header/header.tsx',
method: 'processJsx',
renameTo: () => `${REACT_DIR}shared/layout/header/header.tsx`
},
{
file: 'react/shared/layout/menus/admin.tsx',
method: 'processJsx',
renameTo: () => `${REACT_DIR}shared/layout/menus/admin.tsx`
}
]
}
],
testMain: [
testE2EWithMain: [
{
condition: generator => generator.clientFramework === 'react',
templates: [
{
file: 'react/shared/layout/header/header.spec.tsx',
method: 'processJsx',
renameTo: () => `${TEST_DIR}spec/app/shared/layout/header/header.spec.tsx`
},
{
file: 'react/test/protractor.conf.js',
renameTo: () => `${TEST_DIR}protractor.conf.js`
},
{
file: 'react/test/e2e/administration.spec.ts',
renameTo: () => `${TEST_DIR}e2e/modules/administration/administration.spec.ts`
}
]
},
{
condition: generator => generator.clientFramework === 'angularX',
templates: [
{
file: 'angular/test/protractor.conf.js',
renameTo: () => `${TEST_DIR}protractor.conf.js`
},
{
file: 'angular/test/e2e/administration.spec.ts',
renameTo: () => `${TEST_DIR}e2e/admin/administration.spec.ts`
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<span class="hipster img-fluid rounded"></span>
</div>
<div class="col-md-9">
<h1 class="display-4" jhiTranslate="home.title">Welcome, Node Hipster Official Blueprint!</h1>
<h1 class="display-4" jhiTranslate="home.title">Welcome, Java Hipster!</h1>
<p class="lead" jhiTranslate="home.subtitle">This is your homepage</p>

<div [ngSwitch]="isAuthenticated()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,33 @@
<!-- jhipster-needle-add-entity-to-menu - JHipster will add entities to the menu here -->
</ul>
</li>
<li *<%= jhiPrefix %>HasAnyAuthority="'ROLE_ADMIN'" ngbDropdown class="nav-item dropdown pointer" display="dynamic" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">
<a class="nav-link dropdown-toggle" ngbDropdownToggle href="javascript:void(0);" id="admin-menu">
<span>
<fa-icon icon="user-plus"></fa-icon>
<span jhiTranslate="global.menu.admin.main">Administration</span>
</span>
</a>
<ul class="dropdown-menu" ngbDropdownMenu aria-labelledby="admin-menu">
<%_ if (applicationType === 'gateway' && serviceDiscoveryType) { _%>
<li>
<a class="dropdown-item" routerLink="admin/gateway" routerLinkActive="active" (click)="collapseNavbar()">
<fa-icon icon="road" fixedWidth="true"></fa-icon>
<span jhiTranslate="global.menu.admin.gateway">Gateway</span>
</a>
</li>
<%_ } _%>
<%_ if (!skipUserManagement) { _%>
<li>
<a class="dropdown-item" routerLink="admin/user-management" routerLinkActive="active" (click)="collapseNavbar()">
<fa-icon icon="user" fixedWidth="true"></fa-icon>
<span jhiTranslate="global.menu.admin.userManagement">User management</span>
</a>
</li>
<%_ } _%>
<!-- jhipster-needle-add-element-to-admin-menu - JHipster will add entities to the admin menu here -->
</ul>
</li>
<%_ if (enableTranslation) { _%>
<li ngbDropdown class="nav-item dropdown pointer" display="dynamic" *ngIf="languages && languages.length > 1">
<a class="nav-link dropdown-toggle" ngbDropdownToggle href="javascript:void(0);" id="languagesnavBarDropdown">
Expand Down
4 changes: 2 additions & 2 deletions generators/client/templates/angular/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"postcss-loader": "3.0.0",
"prettier": "1.19.1",
<%_ if (protractorTests) { _%>
"protractor": "5.4.2",
"protractor": "5.4.3",
<%_ } _%>
"reflect-metadata": "0.1.13",
"rimraf": "3.0.0",
Expand Down Expand Up @@ -178,7 +178,7 @@
"postinstall": "node node_modules/protractor/bin/webdriver-manager update --gecko false",
<%_ } _%>
<%_ if (!skipServer) { _%>
"postInstall": "cd server && npm run lint:fix",
"preinstall": "cd server && npm run lint:fix",
<%_ } _%>
"start": "<%= clientPackageManager %> run webpack:dev",
<%_ if (skipServer) { _%>
Expand Down
Loading

0 comments on commit 920d3d7

Please sign in to comment.