Skip to content

Commit

Permalink
e2e: wait instead of scrollTo.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyd1997 authored Dec 19, 2023
1 parent b50a2ac commit c4b62cf
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions generators/entity/templates/entity-e2e-test.js.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const {
<%_ if (context.fieldsContainDate) { _%>
setDateTimePickerValue,
<%_ } _%>
scrollTo,
wait,
} = require('../utils');
<%_
context.resetFakerSeed(`entity-cypress-${context.entityNameCapitalized}`);
Expand Down Expand Up @@ -61,7 +61,8 @@ describe('<%= context.entityNameCapitalized %> Screen Tests', () => {
const navigateTo<%= context.entityNameCapitalized %>Screen = async () => {
await openAndTapDrawerMenuItemByLabel('Entities');
await waitForElementToBeVisibleById('entityScreenScrollList')
await scrollTo('<%= context.entityInstance %>EntityScreenButton', 'entityScreenScrollList')
// await scrollTo('<%= context.entityInstance %>EntityScreenButton', 'entityScreenScrollList')
await wait(3000)
await element(by.id('<%= context.entityInstance %>EntityScreenButton')).tap()
await waitForElementToBeVisibleById('<%= context.entityInstance %>Screen');
}
Expand All @@ -77,7 +78,7 @@ describe('<%= context.entityNameCapitalized %> Screen Tests', () => {
<%_ context.fields.filter(field => !field.id).forEach((field, index) => { _%>
<%_ let formFieldType = context.getEntityFormFieldType(field); _%>
// <%= field.fieldName %>
await scrollTo('<%= field.fieldName %>Input', '<%= context.entityInstance %>EditScrollView')
// await scrollTo('<%= field.fieldName %>Input', '<%= context.entityInstance %>EditScrollView')
<%_ if (formFieldType === 'text') { _%>
<%_ if (field.fieldType === 'byte[]') { _%>
<%_ if (field.fieldTypeBlobContent !== 'text') { _%>
Expand Down Expand Up @@ -110,7 +111,7 @@ describe('<%= context.entityNameCapitalized %> Screen Tests', () => {
<%_ } _%>
<%_ }) _%>
// save
await scrollTo('submitButton', '<%= context.entityInstance %>EditScrollView')
// await scrollTo('submitButton', '<%= context.entityInstance %>EditScrollView')
await waitThenTapButton('submitButton')

/*
Expand Down Expand Up @@ -151,13 +152,13 @@ describe('<%= context.entityNameCapitalized %> Screen Tests', () => {
/*
* Update <%= context.entityNameCapitalized %>
*/
await scrollTo('<%= context.entityInstance %>EditButton', '<%= context.entityInstance %>DetailScrollView')
// await scrollTo('<%= context.entityInstance %>EditButton', '<%= context.entityInstance %>DetailScrollView')
await tapFirstElementByLabel('<%= context.entityNameCapitalized %> Edit Button');
await waitForElementToBeVisibleById('<%= context.entityInstance %>EditScrollView');
<%_ context.fields.filter(field => !field.id).forEach((field, index) => { _%>
<%_ let formFieldType = context.getEntityFormFieldType(field); _%>
// <%= field.fieldName %>
await scrollTo('<%= field.fieldName %>Input', '<%= context.entityInstance %>EditScrollView')
// await scrollTo('<%= field.fieldName %>Input', '<%= context.entityInstance %>EditScrollView')
<%_ if (formFieldType === 'text') { _%>
<%_ if (field.fieldType === 'byte[]') { _%>
<%_ if (field.fieldTypeBlobContent !== 'text') { _%>
Expand Down Expand Up @@ -190,7 +191,7 @@ describe('<%= context.entityNameCapitalized %> Screen Tests', () => {
<%_ } _%>
<%_ }) _%>
// save
await scrollTo('submitButton', '<%= context.entityInstance %>EditScrollView')
// await scrollTo('submitButton', '<%= context.entityInstance %>EditScrollView')
await waitThenTapButton('submitButton')

/*
Expand Down Expand Up @@ -231,7 +232,7 @@ describe('<%= context.entityNameCapitalized %> Screen Tests', () => {
/*
* Delete
*/
await scrollTo('<%= context.entityInstance %>DeleteButton', '<%= context.entityInstance %>DetailScrollView')
// await scrollTo('<%= context.entityInstance %>DeleteButton', '<%= context.entityInstance %>DetailScrollView')
await waitThenTapButton('<%= context.entityInstance %>DeleteButton');
await waitForElementToBeVisibleById('<%= context.entityInstance %>DeleteModal');
await waitThenTapButton('deleteButton')
Expand Down

0 comments on commit c4b62cf

Please sign in to comment.