Error "Must not change a property before it has been read" only in OPA test

125 Views Asked by At

I have a UI to test that looks like this:

enter image description here

I am trying to navigate to another view when user enters the value in description fields and presses save button. I have the following code:

opaTest("Should trigger a press event", function (Given, When, Then) { 
  When.onTheTeleworkingView.iDescriptionAdded("description").and.iPressOnTheSaveButton();
  Then.onTheTeleworkingView.iShouldSeeTheTable();
});
iPressOnTheSaveButton: function () {
  return this.waitFor({
    id: "save",
      viewName: ".component.EditObject",
      errorMessage: "The save button is not found."
  });
},

iDescriptionAdded: function (sGroup) {
  return this.waitFor({
    id: "description",
    actions: new EnterText({ text: sGroup }),
    errorMessage: "Could not find input idGroupInput"
  });
},

iShouldSeeTheTable: function () {
  return this.waitFor({
    id: "Table",
    viewName: ".Table",
    success: function () {
      Opa5.assert.ok(true, "The  table is visible");
    },
    errorMessage: "Was not able to see the table."
  });
},

The view looks like this:

<Page id="editObjectPage" showHeader="true">
  <customHeader>
    <Bar id="headerBar">
      <contentLeft>
        <Text id="titleText" />
      </contentLeft>
      <contentRight>
        <Button id="save" text="{i18n>save}" type="Emphasized" visible="true" press="onSave" />
        <Button id="cancel" text="{i18n>cancel}" visible="true" press="onCancel" />
      </contentRight>
    </Bar>
  </customHeader>
  <f:SimpleForm id="objectEditForm"
    editable="true"
    layout="ResponsiveGridLayout">
    <f:content>
      <Label id="externalLabel" text="{i18n>id}" />
      <ObjectIdentifier title="{ExternalId}" id="textExternalId" />
      <Label id="descriptionLabel" text="{i18n>description}" />
      <Input id="description" value="{Description}" required="true" />
      <Label id="companyLabel" text="{i18n>company}" />

      <MultiInput
        id="companyMultiInput"
        class="sapUiSmallMarginBottom"
        width="100%"
        showValueHelp="false"
        showSuggestion="true"
        suggestionRows="{/Company}"
        tokens="{ path: 'Company', sorter: { path: 'Company/Description' } }">
        <suggestionColumns>
          <Column hAlign="Begin" popinDisplay="Inline" demandPopin="true" id="cIdColumn">
            <Label id="cIdLabel" text="{i18n>id}" />
          </Column>
          <Column hAlign="Center" popinDisplay="Inline" demandPopin="true" id="cDescColumn">
            <Label id="cDescLabel" text="{i18n>description}" />
          </Column>
          <Column hAlign="Center" popinDisplay="Inline" demandPopin="false" id="cValidColumn">
            <Label id="cValidLabel" text="{i18n>valid}" />
          </Column>
        </suggestionColumns>
        <suggestionRows>
          <ColumnListItem id="cListItem">
            <cells>
              <ObjectIdentifier title="{ExternalId}" id="textCExternalId" />
              <Label text="{Description}" id="textCDesc" />
              <Label text="{Invalid}" id="textCInvalid" />
            </cells>
          </ColumnListItem>
        </suggestionRows>
        <tokens>
          <Token id="tokenId" key="{Company_ID}" text="{Company/Description}" />
        </tokens>
      </MultiInput>

      <Label id="invalidLabel" text="{i18n>valid}" />
      <ComboBox id="invalidCombo" selectedKey="{Invalid}" required="true">
        <core:Item id="itemValid" key="0" text="{i18n>valid}" />
        <core:Item id="itemNotValid" key="1" text="{i18n>invalid}" />
      </ComboBox>
    </f:content>
  </f:SimpleForm>
</Page>

The data binding is in controller like this:

var oTable = this.byId(oTableId);
var oTemplate = oTable.removeItem(0);
oTable.bindItems({
  path: oPath,
  parameters: {
    $expand: oCustomExpand ? oCustomExpand : 'Gesellschaft($expand=Company($select=ID,Description))'
  },
  sorter: oSorter,
  key: 'ID',
  template: oTemplate,
  templateShareable: true
});

I am getting the following error:

Uncaught Error: Must not change a property before it has been read
Expected: null
Message: Diff suppressed as the expected and actual results have an equivalent serialization

The error only occurs in test cases. The actual UI is working fine. The error arises when I try to add data in description and validity fields since both are required (validity is a combo box).

Can someone provide a solution to this?

0

There are 0 best solutions below