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

Feature/entity #287

Merged
merged 10 commits into from Apr 2, 2020
Merged

Feature/entity #287

merged 10 commits into from Apr 2, 2020

Conversation

ghost
Copy link

@ghost ghost commented Apr 1, 2020

For #170 . You can review @mraible ;)

I had a lot of troubles for protractor issues (ion button click): ionic-team/ionic-unit-testing-example#62.
But now the e2e tests run for jwt and oauth2 generation, as shown in my last travis build: https://travis-ci.org/github/amanganiello90/generator-jhipster-ionic/builds/669676571?utm_source=github_status&utm_medium=notification.
I have modified also your jdl to test my templates with relationship and field types.

// todo: figure out why more than one element exists
username = element.all(by.name('username')).get(1);
password = element.all(by.name('password')).get(1);
username = element(by.css('ion-input[name="username"] input'));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this type of element get (using type that is ion-input with name), you have resolved the thing that are more element with name attribute for username and password

@@ -12,28 +12,28 @@ application {
entities *
}

enum Typology {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated this jdl to tests more generation for e2e with enum, integer, and minLenght

@@ -23,5 +23,7 @@ jhipster import-jdl "$JHIPSTER".jdl --force --no-insight --skip-checks --skip-gi
cd "$HOME"
yo jhipster-ionic default --force --no-insight
cd "$IONIC_FOLDER"
# to use last version linked
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For entity generation, in CI it was always used the ionic generator installed locally in the project. So to use the last code, it was necessary to link that in the generated project.

@ghost
Copy link
Author

ghost commented Apr 1, 2020

I have updated templates with correct year and resolved the random protractor latency.

Copy link
Collaborator

@mraible mraible left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments to cleanup code. I'll see if I can get Travis unstuck.

<%_ } _%>
} from './<%= entityFileName %>.po';


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra blank line.

<%_ if (authenticationType !== 'oauth2') { _%>
await browser.wait(ec.visibilityOf(loginPage.logoutButton), 1000);
<%_ }_%>

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra blank line.

<%_ if (authenticationType !== 'oauth2') { _%>
await browser.wait(ec.elementToBeClickable(loginPage.loginButton), 3000);
<%_ } _%>
await loginPage.login('admin', 'admin'); // use process.env.E2E_USERNAME if you want to use env variables
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to make this similar to what I have pending for JHipster. jhipster/generator-jhipster#11448

const username = process.env.E2E_USERNAME || 'admin';
const password = process.env.E2E_PASSWORD || 'admin';

const tabEntities = element(by.css('ion-tab-button[tab="entities"]'));
await browser.wait(ec.elementToBeClickable(tabEntities), 3000);
await tabEntities.click();
await element.all(by.css('ion-item')).filter(async el => (await el.element(by.css('h2')).getText()) === '<%= entityClass %>').first().click();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier might reformat this to be on 2-3 lines and wrap (el), not sure.

<%= entityInstance %>ComponentsPage = new <%= entityClass %>ComponentsPage();
await browser.wait(ec.visibilityOf(<%= entityInstance %>ComponentsPage.title), 5000);
expect(await <%= entityInstance %>ComponentsPage.getTitle())
.toEqual(COMPONENT_TITLE);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this could be on the previous line.

}


}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra line breaks above this line.

}


}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra line breaks above this line.

import { <%= entityAngularName %>DetailPage } from './<%= entityFileName %>-detail';


describe('<%= entityAngularName %>DetailPage', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra line break above this line.

import { <%= entityAngularName %>UpdatePage } from './<%= entityFileName %>-update';


describe('<%= entityAngularName %>UpdatePage', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra line break above this line.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

import { <%= entityAngularName %>Page } from './<%= entityFileName %>';


describe('<%= entityAngularName %>Page', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra line break above this line.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@mraible
Copy link
Collaborator

mraible commented Apr 1, 2020

Aahhh, just realized Travis is passing, it's just not being reported to GitHub properly. This is why we need to migrate to GitHub Actions!

@ghost
Copy link
Author

ghost commented Apr 2, 2020

Minor comments to cleanup code. I'll see if I can get Travis unstuck.

I have fix blank lines and run prettier on project.

@mraible
Copy link
Collaborator

mraible commented Apr 2, 2020

Thanks, @amanganiello90! You rock!! 🤘

@mraible mraible merged commit 154e664 into jhipster:master Apr 2, 2020
@ghost
Copy link
Author

ghost commented Apr 2, 2020

Thanks, @amanganiello90! You rock!! 🤘

Thank you very much! But for the timeout that in some cases occours, now I open another PR.

@ghost ghost mentioned this pull request Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant