question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React: protractor failed with existing data (master)

See original GitHub issue
Overview of the issue

Ping @jdubois @DanielFran

Current master builds are broken. As Julien said, it’s not related to Faker.js, but related to Protractor+React.

For React application, Protractor tests for entities failed if there are already data. We can’t detect it with prod profile, only in dev profile.

The CSRF error in console is another problem, but not related to this one.

Motivation for or Use Case
Reproduce the error
Related issues
Suggest a Fix
JHipster Version(s)
travis-react@0.0.0 /home/pgrimaud/tmp/react-noi18n-es-ws-gradle-session
└── generator-jhipster@5.8.1 

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "baseName": "travisReact",
    "packageName": "io.github.jhipster.travis",
    "packageFolder": "io/github/jhipster/travis",
    "serverPort": "8080",
    "authenticationType": "session",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": "spring-websocket",
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": "elasticsearch",
    "useSass": false,
    "buildTool": "gradle",
    "enableTranslation": false,
    "messageBroker": false,
    "rememberMeKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "applicationType": "monolith",
    "testFrameworks": ["protractor"],
    "jhiPrefix": "myPrefix",
    "travis": true,
    "serviceDiscoveryType": false,
    "clientPackageManager": "npm",
    "clientFramework": "react",
    "jhipsterVersion": "5.8.1",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": []
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity BankAccount {
  name String required,
  bankNumber Integer,
  agencyNumber Long,
  lastOperationDuration Float,
  meanOperationDuration Double,
  balance BigDecimal required,
  openingDay LocalDate,
  lastOperationDate Instant,
  active Boolean,
  accountType BankAccountType,
  attachment AnyBlob,
  description TextBlob
}
entity Label {
  labelName String required minlength(3)
}
entity Operation {
  date Instant required,
  description String,
  amount BigDecimal required
}
entity FieldTestEntity {
  stringTom String,
  stringRequiredTom String required,
  stringMinlengthTom String minlength(0),
  stringMaxlengthTom String maxlength(20),
  stringPatternTom String pattern(/^[a-zA-Z0-9]*$/),
  integerTom Integer,
  integerRequiredTom Integer required,
  integerMinTom Integer min(0),
  integerMaxTom Integer max(100),
  longTom Long,
  longRequiredTom Long required,
  longMinTom Long min(0),
  longMaxTom Long max(100),
  floatTom Float,
  floatRequiredTom Float required,
  floatMinTom Float min(0),
  floatMaxTom Float max(100),
  doubleRequiredTom Double required,
  doubleMinTom Double min(0),
  doubleMaxTom Double max(100),
  bigDecimalRequiredTom BigDecimal required,
  bigDecimalMinTom BigDecimal min(0),
  bigDecimalMaxTom BigDecimal max(100),
  localDateTom LocalDate,
  localDateRequiredTom LocalDate required,
  instantTom Instant,
  instantRequiredTom Instant required,
  zonedDateTimeTom ZonedDateTime,
  zonedDateTimeRequiredTom ZonedDateTime required,
  booleanTom Boolean,
  booleanRequiredTom Boolean required,
  enumTom EnumFieldClass,
  enumRequiredTom EnumRequiredFieldClass required,
  byteImageTom ImageBlob,
  byteImageRequiredTom ImageBlob required,
  byteImageMinbytesTom ImageBlob minbytes(0),
  byteImageMaxbytesTom ImageBlob maxbytes(10000),
  byteAnyTom AnyBlob,
  byteAnyRequiredTom AnyBlob required,
  byteAnyMinbytesTom AnyBlob minbytes(0),
  byteAnyMaxbytesTom AnyBlob maxbytes(10000),
  byteTextTom TextBlob,
  byteTextRequiredTom TextBlob required,
  byteTextMinbytesTom TextBlob minbytes(0),
  byteTextMaxbytesTom TextBlob maxbytes(10000)
}
entity FieldTestPagerEntity {
  stringJade String,
  stringRequiredJade String required,
  stringMinlengthJade String minlength(0),
  stringMaxlengthJade String maxlength(20),
  stringPatternJade String pattern(/^[a-zA-Z0-9]*$/),
  integerJade Integer,
  integerRequiredJade Integer required,
  integerMinJade Integer min(0),
  integerMaxJade Integer max(100),
  longJade Long,
  longRequiredJade Long required,
  longMinJade Long min(0),
  longMaxJade Long max(100),
  floatJade Float,
  floatRequiredJade Float required,
  floatMinJade Float min(0),
  floatMaxJade Float max(100),
  doubleRequiredJade Double required,
  doubleMinJade Double min(0),
  doubleMaxJade Double max(100),
  bigDecimalRequiredJade BigDecimal required,
  bigDecimalMinJade BigDecimal min(0),
  bigDecimalMaxJade BigDecimal max(100),
  localDateJade LocalDate,
  localDateRequiredJade LocalDate required,
  instantJade Instant,
  instanteRequiredJade Instant required,
  zonedDateTimeJade ZonedDateTime,
  zonedDateTimeRequiredJade ZonedDateTime required,
  booleanJade Boolean,
  booleanRequiredJade Boolean required,
  enumJade EnumFieldClass,
  enumRequiredJade EnumRequiredFieldClass required,
  byteImageJade ImageBlob,
  byteImageRequiredJade ImageBlob required,
  byteImageMinbytesJade ImageBlob minbytes(0),
  byteImageMaxbytesJade ImageBlob maxbytes(10000),
  byteAnyJade AnyBlob,
  byteAnyRequiredJade AnyBlob required,
  byteAnyMinbytesJade AnyBlob minbytes(0),
  byteAnyMaxbytesJade AnyBlob maxbytes(10000),
  byteTextJade TextBlob,
  byteTextRequiredJade TextBlob required,
  byteTextMinbytesJade TextBlob minbytes(0),
  byteTextMaxbytesJade TextBlob maxbytes(10000)
}
entity FieldTestMapstructEntity {
  stringEva String,
  stringRequiredEva String required,
  stringMinlengthEva String minlength(0),
  stringMaxlengthEva String maxlength(20),
  stringPatternEva String pattern(/^[a-zA-Z0-9]*$/),
  integerEva Integer,
  integerRequiredEva Integer required,
  integerMinEva Integer min(0),
  integerMaxEva Integer max(100),
  longEva Long,
  longRequiredEva Long required,
  longMinEva Long min(0),
  longMaxEva Long max(100),
  floatEva Float,
  floatRequiredEva Float required,
  floatMinEva Float min(0),
  floatMaxEva Float max(100),
  doubleRequiredEva Double required,
  doubleMinEva Double min(0),
  doubleMaxEva Double max(100),
  bigDecimalRequiredEva BigDecimal required,
  bigDecimalMinEva BigDecimal min(0),
  bigDecimalMaxEva BigDecimal max(100),
  localDateEva LocalDate,
  localDateRequiredEva LocalDate required,
  instantEva Instant,
  instanteRequiredEva Instant required,
  zonedDateTimeEva ZonedDateTime,
  zonedDateTimeRequiredEva ZonedDateTime required,
  booleanEva Boolean,
  booleanRequiredEva Boolean required,
  enumEva EnumFieldClass,
  enumRequiredEva EnumRequiredFieldClass required,
  byteImageEva ImageBlob,
  byteImageRequiredEva ImageBlob required,
  byteImageMinbytesEva ImageBlob minbytes(0),
  byteImageMaxbytesEva ImageBlob maxbytes(10000),
  byteAnyEva AnyBlob,
  byteAnyRequiredEva AnyBlob required,
  byteAnyMinbytesEva AnyBlob minbytes(0),
  byteAnyMaxbytesEva AnyBlob maxbytes(10000),
  byteTextEva TextBlob,
  byteTextRequiredEva TextBlob required,
  byteTextMinbytesEva TextBlob minbytes(0),
  byteTextMaxbytesEva TextBlob maxbytes(10000)
}
entity FieldTestServiceImplEntity {
  stringMika String,
  stringRequiredMika String required,
  stringMinlengthMika String minlength(0),
  stringMaxlengthMika String maxlength(20),
  stringPatternMika String pattern(/^[a-zA-Z0-9]*$/),
  integerMika Integer,
  integerRequiredMika Integer required,
  integerMinMika Integer min(0),
  integerMaxMika Integer max(100),
  longMika Long,
  longRequiredMika Long required,
  longMinMika Long min(0),
  longMaxMika Long max(100),
  floatMika Float,
  floatRequiredMika Float required,
  floatMinMika Float min(0),
  floatMaxMika Float max(100),
  doubleRequiredMika Double required,
  doubleMinMika Double min(0),
  doubleMaxMika Double max(100),
  bigDecimalRequiredMika BigDecimal required,
  bigDecimalMinMika BigDecimal min(0),
  bigDecimalMaxMika BigDecimal max(100),
  localDateMika LocalDate,
  localDateRequiredMika LocalDate required,
  instantMika Instant,
  instanteRequiredMika Instant required,
  zonedDateTimeMika ZonedDateTime,
  zonedDateTimeRequiredMika ZonedDateTime required,
  booleanMika Boolean,
  booleanRequiredMika Boolean required,
  enumMika EnumFieldClass,
  enumRequiredMika EnumRequiredFieldClass required,
  byteImageMika ImageBlob,
  byteImageRequiredMika ImageBlob required,
  byteImageMinbytesMika ImageBlob minbytes(0),
  byteImageMaxbytesMika ImageBlob maxbytes(10000),
  byteAnyMika AnyBlob,
  byteAnyRequiredMika AnyBlob required,
  byteAnyMinbytesMika AnyBlob minbytes(0),
  byteAnyMaxbytesMika AnyBlob maxbytes(10000),
  byteTextMika TextBlob,
  byteTextRequiredMika TextBlob required,
  byteTextMinbytesMika TextBlob minbytes(0),
  byteTextMaxbytesMika TextBlob maxbytes(10000)
}
entity FieldTestInfiniteScrollEntity {
  stringHugo String,
  stringRequiredHugo String required,
  stringMinlengthHugo String minlength(0),
  stringMaxlengthHugo String maxlength(20),
  stringPatternHugo String pattern(/^[a-zA-Z0-9]*$/),
  integerHugo Integer,
  integerRequiredHugo Integer required,
  integerMinHugo Integer min(0),
  integerMaxHugo Integer max(100),
  longHugo Long,
  longRequiredHugo Long required,
  longMinHugo Long min(0),
  longMaxHugo Long max(100),
  floatHugo Float,
  floatRequiredHugo Float required,
  floatMinHugo Float min(0),
  floatMaxHugo Float max(100),
  doubleRequiredHugo Double required,
  doubleMinHugo Double min(0),
  doubleMaxHugo Double max(100),
  bigDecimalRequiredHugo BigDecimal required,
  bigDecimalMinHugo BigDecimal min(0),
  bigDecimalMaxHugo BigDecimal max(100),
  localDateHugo LocalDate,
  localDateRequiredHugo LocalDate required,
  instantHugo Instant,
  instanteRequiredHugo Instant required,
  zonedDateTimeHugo ZonedDateTime,
  zonedDateTimeRequiredHugo ZonedDateTime required,
  booleanHugo Boolean,
  booleanRequiredHugo Boolean required,
  enumHugo EnumFieldClass,
  enumRequiredHugo EnumRequiredFieldClass required,
  byteImageHugo ImageBlob,
  byteImageRequiredHugo ImageBlob required,
  byteImageMinbytesHugo ImageBlob minbytes(0),
  byteImageMaxbytesHugo ImageBlob maxbytes(10000),
  byteAnyHugo AnyBlob,
  byteAnyRequiredHugo AnyBlob required,
  byteAnyMinbytesHugo AnyBlob minbytes(0),
  byteAnyMaxbytesHugo AnyBlob maxbytes(10000),
  byteTextHugo TextBlob,
  byteTextRequiredHugo TextBlob required,
  byteTextMinbytesHugo TextBlob minbytes(0),
  byteTextMaxbytesHugo TextBlob maxbytes(10000)
}
entity FieldTestServiceClassEntity {
  stringBob String,
  stringRequiredBob String required,
  stringMinlengthBob String minlength(0),
  stringMaxlengthBob String maxlength(20),
  stringPatternBob String pattern(/^[a-zA-Z0-9]*$/),
  integerBob Integer,
  integerRequiredBob Integer required,
  integerMinBob Integer min(0),
  integerMaxBob Integer max(100),
  longBob Long,
  longRequiredBob Long required,
  longMinBob Long min(0),
  longMaxBob Long max(100),
  floatBob Float,
  floatRequiredBob Float required,
  floatMinBob Float min(0),
  floatMaxBob Float max(100),
  doubleRequiredBob Double required,
  doubleMinBob Double min(0),
  doubleMaxBob Double max(100),
  bigDecimalRequiredBob BigDecimal required,
  bigDecimalMinBob BigDecimal min(0),
  bigDecimalMaxBob BigDecimal max(100),
  localDateBob LocalDate,
  localDateRequiredBob LocalDate required,
  instantBob Instant,
  instanteRequiredBob Instant required,
  zonedDateTimeBob ZonedDateTime,
  zonedDateTimeRequiredBob ZonedDateTime required,
  booleanBob Boolean,
  booleanRequiredBob Boolean required,
  enumBob EnumFieldClass,
  enumRequiredBob EnumRequiredFieldClass required,
  byteImageBob ImageBlob,
  byteImageRequiredBob ImageBlob required,
  byteImageMinbytesBob ImageBlob minbytes(0),
  byteImageMaxbytesBob ImageBlob maxbytes(10000),
  byteAnyBob AnyBlob,
  byteAnyRequiredBob AnyBlob required,
  byteAnyMinbytesBob AnyBlob minbytes(0),
  byteAnyMaxbytesBob AnyBlob maxbytes(10000),
  byteTextBob TextBlob,
  byteTextRequiredBob TextBlob required,
  byteTextMinbytesBob TextBlob minbytes(0),
  byteTextMaxbytesBob TextBlob maxbytes(10000)
}
entity FieldTestPaginationEntity {
  stringAlice String,
  stringRequiredAlice String required,
  stringMinlengthAlice String minlength(0),
  stringMaxlengthAlice String maxlength(20),
  stringPatternAlice String pattern(/^[a-zA-Z0-9]*$/),
  integerAlice Integer,
  integerRequiredAlice Integer required,
  integerMinAlice Integer min(0),
  integerMaxAlice Integer max(100),
  longAlice Long,
  longRequiredAlice Long required,
  longMinAlice Long min(0),
  longMaxAlice Long max(100),
  floatAlice Float,
  floatRequiredAlice Float required,
  floatMinAlice Float min(0),
  floatMaxAlice Float max(100),
  doubleRequiredAlice Double required,
  doubleMinAlice Double min(0),
  doubleMaxAlice Double max(100),
  bigDecimalRequiredAlice BigDecimal required,
  bigDecimalMinAlice BigDecimal min(0),
  bigDecimalMaxAlice BigDecimal max(100),
  localDateAlice LocalDate,
  localDateRequiredAlice LocalDate required,
  instantAlice Instant,
  instanteRequiredAlice Instant required,
  zonedDateTimeAlice ZonedDateTime,
  zonedDateTimeRequiredAlice ZonedDateTime required,
  booleanAlice Boolean,
  booleanRequiredAlice Boolean required,
  enumAlice EnumFieldClass,
  enumRequiredAlice EnumRequiredFieldClass required,
  byteImageAlice ImageBlob,
  byteImageRequiredAlice ImageBlob required,
  byteImageMinbytesAlice ImageBlob minbytes(0),
  byteImageMaxbytesAlice ImageBlob maxbytes(10000),
  byteAnyAlice AnyBlob,
  byteAnyRequiredAlice AnyBlob required,
  byteAnyMinbytesAlice AnyBlob minbytes(0),
  byteAnyMaxbytesAlice AnyBlob maxbytes(10000),
  byteTextAlice TextBlob,
  byteTextRequiredAlice TextBlob required,
  byteTextMinbytesAlice TextBlob minbytes(0),
  byteTextMaxbytesAlice TextBlob maxbytes(10000)
}
entity EntityWithDTO {
  emma String
}
entity EntityWithServiceClass {
  zoe String
}
entity EntityWithServiceImpl {
  clara String
}
entity EntityWithPagination {
  nathan String
}
entity EntityWithServiceClassAndPagination {
  enzo String
}
entity EntityWithServiceImplAndPagination {
  hugo String
}
entity EntityWithServiceClassAndDTO {
  lucas String
}
entity EntityWithServiceImplAndDTO {
  louis String
}
entity EntityWithPaginationAndDTO {
  lea String
}
entity EntityWithServiceClassPaginationAndDTO {
  lena String
}
entity EntityWithServiceImplPaginationAndDTO {
  theo String
}

enum BankAccountType {
  CHECKING,
  SAVINGS,
  LOAN
}

enum EnumFieldClass {
  ENUM_VALUE_1,
  ENUM_VALUE_2,
  ENUM_VALUE_3
}

enum EnumRequiredFieldClass {
  ENUM_VALUE_1,
  ENUM_VALUE_2,
  ENUM_VALUE_3
}

relationship OneToMany {
  BankAccount{operation} to Operation{bankAccount(name)}
}
relationship ManyToOne {
  BankAccount{user(login)} to User
}
relationship ManyToMany {
  Operation{label(labelName)} to Label{operation}
}

dto BankAccount, FieldTestMapstructEntity, EntityWithDTO, EntityWithServiceClassAndDTO, EntityWithServiceImplAndDTO, EntityWithPaginationAndDTO, EntityWithServiceClassPaginationAndDTO, EntityWithServiceImplPaginationAndDTO with mapstruct
service BankAccount, FieldTestServiceImplEntity, EntityWithServiceImpl, EntityWithServiceImplAndPagination, EntityWithServiceImplAndDTO, EntityWithServiceImplPaginationAndDTO with serviceImpl
service Label, FieldTestMapstructEntity, FieldTestServiceClassEntity, EntityWithServiceClass, EntityWithServiceClassAndPagination, EntityWithServiceClassAndDTO, EntityWithServiceClassPaginationAndDTO with serviceClass
angularSuffix BankAccount with mySuffix
filter BankAccount, FieldTestServiceClassEntity
clientRootFolder BankAccount, Label, Operation with test-root
paginate Label, FieldTestPaginationEntity, EntityWithPagination, EntityWithServiceClassAndPagination, EntityWithServiceImplAndPagination, EntityWithPaginationAndDTO, EntityWithServiceClassPaginationAndDTO, EntityWithServiceImplPaginationAndDTO with pagination
paginate Operation, FieldTestInfiniteScrollEntity with infinite-scroll
paginate FieldTestPagerEntity with pager

Environment and Tools

openjdk version “1.8.0_191” OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

git version 2.20.1

node: v10.15.0

npm: 6.7.0

yeoman: 2.0.5

yarn: 1.13.0

Docker version 18.03.0-ce, build 0520e24

docker-compose version 1.21.2, build a133471

INFO! Congratulations, JHipster execution is complete!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
DanielFrancommented, Feb 15, 2019

@jdubois Sometimes react tests are still failing…

1reaction
jduboiscommented, Feb 14, 2019

OK I got this, but it’s a bit tricky so I’ll do the PR in the next few hours.

  • The issue is that when there is a list of data, it is not displayed immediately at page load (there is a REST call getting the data, so it takes some time to load)
  • As we are counting the number of “delete” buttons to know how much lines there are on the page, we always have “0” as the data isn’t loaded yet. So it works only when there is no data 😃
  • Please note that this will still fail if you have more than 20 lines of paginated data, as the paginated data will be hidden. But for the moment we can ignore this.

My current solution is in fact to add 2 lines of data, so I am sure there is at least on line (even when there is initially no data), so I can start counting the “delete” buttons correctly, and thus know if I added one line or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: before is not defined (mocha/protractor)
I was able to manage by adding framework: jasmine2 to protractor.conf.js and instead of before() and after() I wrote beforeAll() and ...
Read more >
Why I Moved from Protractor to Cypress and the 7 Steps ...
1) It doesn't test like a real user · 2) It will fail when you have a transparent overlay · 4) It is...
Read more >
angular/protractor
Hello, I'm having troubles to get working my testing environment in Gitlab CI. I using a kubernetes runner to run a job with...
Read more >
spawn Unknown system error -86 >> From: Task: WebDriver ...
So I have been working in Protractor for my end to end tests of my Angular application. It has been working for as...
Read more >
Angular vs React: A Detailed Side-by-Side Comparison
Unlike other frameworks, Angular offers two-way data-binding. ... Virtual DOMS: React provides a virtual DOM that copies the existing DOM ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found