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
65 changes: 64 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('Allows to add a datamodel, include an object with custom name and fields in it, and generate a C# model from it', () => {
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,71 @@ 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
datamodel
.getProperty(/^test /)
.within(() =>
cy
.findAllByRole('button', { name: texts['schema_editor.open_action_menu'] })
.first()
.click(),
);
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
datamodel
.getProperty(/^test /)
.within(() =>
cy
.findAllByRole('button', { name: texts['schema_editor.open_action_menu'] })
.first()
.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
12 changes: 8 additions & 4 deletions frontend/testing/cypress/src/selectors/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ import * as testids from '../../../testids';
const getAllAppsHeader = () => cy.findByRole('heading', { name: texts['dashboard.all_apps'] });
const getUserAppsListHeader = () => cy.findByRole('heading', { name: texts['dashboard.my_apps'] });
const getFavouritesHeader = () => cy.findByRole('heading', { name: texts['dashboard.favourites'] });
const getSearchResultsHeader = () => cy.findByRole('heading', { name: texts['dashboard.search_result'] });
const getOrgAppsHeader = (org) => cy.findByRole('heading', { name: texts['dashboard.org_apps'].replace('{{orgName}}', org) });
const getSearchResultsHeader = () =>
cy.findByRole('heading', { name: texts['dashboard.search_result'] });
const getOrgAppsHeader = (org) =>
cy.findByRole('heading', { name: texts['dashboard.org_apps'].replace('{{orgName}}', org) });
const getUserAppsList = () => getUserAppsListHeader().next();
const getSearchResults = () => getSearchResultsHeader().next();
const getLinksCellForApp = (table, name) => table.findByRole('cell', { name }).siblings('div[data-field=\'links\']');
const getLinksCellForApp = (table, name) =>
table.findByRole('cell', { name }).siblings("div[data-field='links']");

export const dashboard = {
getAllAppsHeader,
getAppOwnerField: () => cy.findByRole('combobox', { name: texts['general.service_owner'] }),
getCancelButton: () => cy.findByRole('button', { name: texts['general.cancel'] }),
getCreateAppButton: () => cy.findByRole('button', { name: texts['dashboard.create_service_btn'] }),
getCreateAppButton: () =>
cy.findByRole('button', { name: texts['dashboard.create_service_btn'] }),
getFavourites: () => getFavouritesHeader().next(),
getFavouritesHeader,
getLinksCellForSearchResultApp: (name) => getLinksCellForApp(getSearchResults(), name),
Expand Down