Repository: hasura/graphql-engine
File: console/cypress/integration/data/modify/spec.ts (TypeScript)

Code before:
  cy.get(getElementFromAlias('modify-table-fk-0-save')).click();
  cy.wait(10000);
};

export const passRemoveForeignKey = () => {
  cy.get(getElementFromAlias('modify-table-edit-fk-0')).click();
  cy.get(getElementFromAlias('modify-table-fk-0-remove')).click();
  cy.wait(10000);
};

export const passModifyPkey = () => {
  cy.get(getElementFromAlias('modify-table-edit-pks')).click();
  cy.get(getElementFromAlias('primary-key-select-1')).select('1');
  cy.get(getElementFromAlias('modify-table-pks-save')).click();
  cy.get(getElementFromAlias('pk-config-text')).within(() =>
    cy.get('b').contains(getColName(0))
  );
  cy.wait(5000);

  // TODO
  // test disappearance expect
  // cy.get(getElementFromAlias('modify-table-column-1-remove')).not.to.exist;

  cy.get(getElementFromAlias('remove-pk-column-1')).click();
  cy.get(getElementFromAlias('modify-table-pks-save')).click();
  cy.get(getElementFromAlias('pk-config-text')).get('b').contains('id');
  cy.get(getElementFromAlias('pk-config-text')).within(() => {
    cy.get('b').should('not.contain', getColName(0));
  });
  cy.get(getElementFromAlias('modify-table-close-pks')).click();
  cy.wait(3000);
};

export const passCreateUniqueKey = () => {
  cy.get(getElementFromAlias('modify-table-edit-unique-key-0')).click();
  cy.get(getElementFromAlias('unique-key-0-column-0')).select('0');
  cy.get(getElementFromAlias('unique-key-0-column-1')).select('1');
  cy.wait(1000);
  cy.get(getElementFromAlias('modify-table-unique-key-0-save')).click();
  cy.wait(5000);
  cy.get('div').contains(
    `${getTableName(0, testName)}_id_${getColName(0)}_key`
  );
};

export const passModifyUniqueKey = () => {
  cy.get(getElementFromAlias('modify-table-edit-unique-key-0')).click();
  cy.get(getElementFromAlias('remove-uk-0-column-0')).click();
  cy.get(getElementFromAlias('modify-table-unique-key-0-save')).click();
  cy.wait(5000);
  cy.get('div').contains(`${getTableName(0, testName)}_${getColName(0)}_key`);

Review comment (suggestion):
use within
```suggestion
  cy.get(getElementFromAlias('pk-config-text')).within(() => {
    cy.get('b').contains('id');
  });
```

Code after:
  cy.get(getElementFromAlias('modify-table-fk-0-save')).click();
  cy.wait(10000);
};

export const passRemoveForeignKey = () => {
  cy.get(getElementFromAlias('modify-table-edit-fk-0')).click();
  cy.get(getElementFromAlias('modify-table-fk-0-remove')).click();
  cy.wait(10000);
};

export const passModifyPkey = () => {
  cy.get(getElementFromAlias('modify-table-edit-pks')).click();
  cy.get(getElementFromAlias('primary-key-select-1')).select('1');
  cy.get(getElementFromAlias('modify-table-pks-save')).click();
  cy.get(getElementFromAlias('pk-config-text')).within(() => {
    cy.get('b').contains(getColName(0));
    cy.get('b').contains('id');
  });
  cy.wait(5000);

  cy.get(getElementFromAlias('remove-pk-column-1')).click();
  cy.get(getElementFromAlias('modify-table-pks-save')).click();
  cy.get(getElementFromAlias('pk-config-text')).within(() => {
    cy.get('b').contains('id');
  });
  cy.get(getElementFromAlias('pk-config-text')).within(() => {
    cy.get('b').should('not.contain', getColName(0));
  });
  cy.get(getElementFromAlias('modify-table-close-pks')).click();
  cy.wait(3000);
};

export const passCreateUniqueKey = () => {
  cy.get(getElementFromAlias('modify-table-edit-unique-key-0')).click();
  cy.get(getElementFromAlias('unique-key-0-column-0')).select('0');
  cy.get(getElementFromAlias('unique-key-0-column-1')).select('1');
  cy.wait(1000);
  cy.get(getElementFromAlias('modify-table-unique-key-0-save')).click();
  cy.wait(5000);
  cy.get('div').contains(
    `${getTableName(0, testName)}_id_${getColName(0)}_key`
  );
};

export const passModifyUniqueKey = () => {
  cy.get(getElementFromAlias('modify-table-edit-unique-key-0')).click();
  cy.get(getElementFromAlias('remove-uk-0-column-0')).click();
  cy.get(getElementFromAlias('modify-table-unique-key-0-save')).click();
  cy.wait(5000);
  cy.get('div').contains(`${getTableName(0, testName)}_${getColName(0)}_key`);
};