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

11559 deploy regression test w46 #11596

Merged
merged 9 commits into from
Nov 21, 2023
59 changes: 58 additions & 1 deletion frontend/testing/cypress/src/integration/studio/datamodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ context('datamodel', () => {
cy.deleteAllApps(Cypress.env('autoTestUser'), Cypress.env('accessToken'));
});

it('add a new data model, and then add an object to the data model', () => {
it('Add a new data model, include an object in the data model, and rename it. After that, add two strings (text1 and text2) and one integer (number1) to the object (test). Finally, check if generating the model is okay.', () => {
JamalAlabdullah marked this conversation as resolved.
Show resolved Hide resolved
datamodel.getCreateNewButton().click();
cy.findByRole('textbox').type('datamodel');
cy.findByRole('button', { name: texts['schema_editor.create_model_confirm_button'] }).click();
Expand All @@ -37,8 +37,65 @@ context('datamodel', () => {
.then(() => {
datamodel.getProperty('name').should('exist');
datamodel.getNameField().clear().type('test');
cy.get('body').click();
datamodel.getNameField().invoke('val').should('eq', 'test');
datamodel.getProperty('test').should('exist').click();
});

// Add text1
cy.findAllByRole('button', { name: texts['schema_editor.open_action_menu'] }).last().click();
cy.findByRole('menuitem', { name: texts['schema_editor.add_field'] })
.should('exist')
.click()
.then(() => {
datamodel.getProperty('name').should('exist');
datamodel.getNameField().clear().type('text1');
cy.get('body').click();
datamodel.getNameField().invoke('val').should('eq', 'text1');
datamodel.getProperty('text1').should('exist');
});

// Add text2
cy.findAllByRole('button', { name: texts['schema_editor.open_action_menu'] })
.should('exist')
.then((button) => {
button[3].click();
JamalAlabdullah marked this conversation as resolved.
Show resolved Hide resolved
});
cy.findByRole('menuitem', { name: texts['schema_editor.add_field'] })
.should('exist')
.click()
.then(() => {
datamodel.getProperty('name').should('exist');
datamodel.getNameField().clear().type('text2');
cy.get('body').click();
datamodel.getNameField().invoke('val').should('eq', 'text2');
datamodel.getProperty('text2').should('exist');
});

//Add number1
cy.findAllByRole('button', { name: texts['schema_editor.open_action_menu'] })
.should('exist')
.then((button) => {
button[3].click();
});
cy.findByRole('menuitem', { name: texts['schema_editor.add_field'] })
.should('exist')
.click()
.then(() => {
datamodel.getTypeField().click();
cy.findByRole('option', { name: texts['schema_editor.integer'] }).should('exist').click();
datamodel.getProperty('name').should('exist');
datamodel.getTypeField().invoke('val').should('eq', texts['schema_editor.integer']);
datamodel.getNameField().clear().type('number1');
cy.get('body').click();
datamodel.getProperty('number1').should('exist');
});

// Generate model
cy.findByRole('button', { name: texts['schema_editor.generate_model_files'] }).click();
cy.findByRole('alert', { name: texts['schema_editor.model_generation_success'] }).should(
'be.visible',
);
});

it('edit a data model', () => {
Expand Down