-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/dev-3277-image-regions-are-not-highl…
…ighted-in-chrome-after-clicking * main: test: e2e data model tests (DEV-2379, DEV-2341, DEV-2339, DEV-2338) (#1475) fix: removed absolute image size restriction, added sample image (DEV-3304) (#1484) refactor: remove unused code in ontology component (#1472) fix: image region comment field validation removed(DEV-3315) (#1487) chore(main): release 11.6.5 (#1486) fix: submit button on upload resource does not load indefinitely (#1485) chore(main): release 11.6.4 (#1482) fix: ontology initialisation (DEV-3317) (#1483) fix: new list node field error is not displayed (#1481) chore(main): release 11.6.3 (#1470) chore: update dsp-js to v.9.1.12 (#1478) fix: highlits section by clicked region in image viewer (DEV-3277) (#1468)
- Loading branch information
Showing
45 changed files
with
761 additions
and
496 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
146 changes: 146 additions & 0 deletions
146
apps/dsp-app/cypress/e2e/system-admin/data-model-class.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
import { ResourceClassDefinitionWithAllLanguages } from '@dasch-swiss/dsp-js'; | ||
import { faker } from '@faker-js/faker'; | ||
import { ClassType, PropertyType } from '../../support/helpers/constants'; | ||
import { DataModelClassProperty } from '../../support/helpers/interfaces'; | ||
import ProjectPage from '../../support/pages/project-page'; | ||
|
||
describe('Data Model Class', () => { | ||
const projectPage = new ProjectPage(); | ||
|
||
beforeEach(() => { | ||
projectPage.requestProject(); | ||
}); | ||
|
||
it('should create new data model class', () => { | ||
const textClass: ResourceClassDefinitionWithAllLanguages = { | ||
id: faker.lorem.word(), | ||
subClassOf: [], | ||
propertiesList: [], | ||
canBeInstantiated: true, | ||
label: faker.lorem.words(5), | ||
comment: faker.lorem.words(10), | ||
comments: [], | ||
labels: [], | ||
}; | ||
|
||
const resourceClass: ResourceClassDefinitionWithAllLanguages = { | ||
id: faker.lorem.word(), | ||
subClassOf: [], | ||
propertiesList: [], | ||
canBeInstantiated: true, | ||
label: faker.lorem.words(5), | ||
comment: faker.lorem.words(10), | ||
comments: [], | ||
labels: [], | ||
}; | ||
|
||
cy.intercept('POST', '/v2/ontologies/classes').as('createRequest'); | ||
|
||
cy.createOntology(projectPage); | ||
|
||
cy.get('[data-cy=create-class-button]').scrollIntoView().should('be.visible').click(); | ||
cy.get(`[data-cy=${ClassType.TextRepresentation}]`).scrollIntoView().should('be.visible').click({ force: true }); | ||
cy.get('[data-cy=name-input]').clear().type(textClass.id); | ||
cy.get('[data-cy=label-input]').clear().type(textClass.label); | ||
cy.get('[data-cy=comment-textarea]').type(textClass.comment); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@createRequest'); | ||
cy.get('[data-cy=class-card]').should('be.visible').get('mat-card-title').contains(textClass.label.split(' ')[0]); | ||
cy.get('[data-cy=create-class-button]').scrollIntoView().should('be.visible').click(); | ||
cy.get(`[data-cy=${ClassType.Resource}]`).scrollIntoView().should('be.visible').click({ force: true }); | ||
cy.get('[data-cy=name-input]').clear().type(resourceClass.id); | ||
cy.get('[data-cy=label-input]').clear().type(resourceClass.label); | ||
cy.get('[data-cy=comment-textarea]').type(resourceClass.comment); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@createRequest'); | ||
cy.get('[data-cy=class-card]') | ||
.should('be.visible') | ||
.get('mat-card-title') | ||
.contains(resourceClass.label.split(' ')[0]); | ||
}); | ||
|
||
it('should cancel to create data model class', () => { | ||
cy.createOntology(projectPage); | ||
|
||
cy.get('[data-cy=create-class-button]').scrollIntoView().should('be.visible').click(); | ||
cy.get(`[data-cy=${ClassType.TextRepresentation}]`).scrollIntoView().should('be.visible').click({ force: true }); | ||
cy.get('.mat-mdc-dialog-container').should('be.visible'); | ||
cy.get('[data-cy=cancel-button]').scrollIntoView().should('be.visible').click(); | ||
cy.get('.mat-mdc-dialog-container').should('not.exist'); | ||
|
||
cy.get('[data-cy=create-class-button]').scrollIntoView().should('be.visible').click(); | ||
cy.get(`[data-cy=${ClassType.TextRepresentation}]`).scrollIntoView().click({ force: true }); | ||
cy.get('.mat-mdc-dialog-container').should('be.visible'); | ||
cy.get('.cdk-overlay-backdrop').click(-50, -50, { force: true }); | ||
cy.get('.mat-mdc-dialog-container').should('not.exist'); | ||
}); | ||
|
||
it('should create properties', () => { | ||
const textProperty = <DataModelClassProperty>{ | ||
name: faker.lorem.word(), | ||
label: faker.lorem.words(5), | ||
comment: faker.lorem.words(10), | ||
}; | ||
|
||
const pageNumberProperty = <DataModelClassProperty>{ | ||
name: faker.lorem.word(), | ||
label: faker.lorem.words(5), | ||
comment: faker.lorem.words(10), | ||
}; | ||
|
||
cy.intercept('POST', '/v2/ontologies/properties').as('createPropertyRequest'); | ||
cy.createOntology(projectPage); | ||
|
||
cy.get('[data-cy=properties-button]').should('be.visible').click({ force: true }); | ||
|
||
cy.get('[data-cy=create-property-button]').should('be.visible').click({ force: true }); | ||
cy.get(`[data-cy=${PropertyType.Text}]`).should('be.visible').click(); | ||
cy.get(`[data-cy=${PropertyType.Short}]`).should('be.visible').click(); | ||
cy.get('[data-cy=name-input]').clear().type(textProperty.name); | ||
cy.get('[data-cy=property-label] input').clear().type(textProperty.label); | ||
cy.get('[data-cy=property-comment] textarea').type(textProperty.comment); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@createPropertyRequest'); | ||
cy.get('[data-cy=property-label]').should('be.visible').should('include.text', textProperty.label); | ||
|
||
cy.get('[data-cy=create-property-button]').should('be.visible').click({ force: true }); | ||
cy.get(`[data-cy=${PropertyType.Number}]`).should('be.visible').click(); | ||
cy.get(`[data-cy="${PropertyType.PageNumber}"]`).should('be.visible').click(); | ||
cy.get('[data-cy=name-input]').clear().type(pageNumberProperty.name); | ||
cy.get('[data-cy=property-label] input').clear().type(pageNumberProperty.label); | ||
cy.get('[data-cy=property-comment] textarea').type(pageNumberProperty.comment); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@createPropertyRequest'); | ||
cy.get('[data-cy=property-label]').should('be.visible').should('include.text', pageNumberProperty.label); | ||
}); | ||
|
||
it('should add property to a data model class', () => { | ||
const textProperty = <DataModelClassProperty>{ | ||
name: faker.lorem.word(), | ||
label: faker.lorem.words(5), | ||
comment: faker.lorem.words(10), | ||
}; | ||
|
||
cy.intercept('POST', '/v2/ontologies/properties').as('createPropertyRequest'); | ||
cy.createDataModelClass(projectPage); | ||
|
||
cy.get('[data-cy=class-card]').should('be.visible'); | ||
cy.get('[data-cy=resource-class-properties-empty-list]').should('be.visible'); | ||
cy.get('[data-cy=add-property-button]').should('be.visible').click(); | ||
cy.get('[data-cy=create-new-property-from-type-button]').should('be.visible').click({ force: true }); | ||
cy.get(`[data-cy=${PropertyType.Text}]`).should('be.visible').click(); | ||
cy.get(`[data-cy=${PropertyType.Short}]`).should('be.visible').click(); | ||
|
||
cy.get('[data-cy=name-input]').clear().type(textProperty.name); | ||
cy.get('[data-cy=property-label] input').clear().type(textProperty.label); | ||
cy.get('[data-cy=property-comment] textarea').type(textProperty.comment); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@createPropertyRequest'); | ||
cy.get('[data-cy=property-label]').should('be.visible').should('include.text', textProperty.label); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { CreateOntology } from '@dasch-swiss/dsp-js'; | ||
import { faker } from '@faker-js/faker'; | ||
import ProjectPage from '../../support/pages/project-page'; | ||
|
||
describe('Ontology', () => { | ||
const projectPage = new ProjectPage(); | ||
|
||
beforeEach(() => { | ||
projectPage.requestProject(); | ||
}); | ||
|
||
it('should create new ontology', () => { | ||
const data = { | ||
name: faker.string.alpha({ length: { min: 3, max: 16 } }), | ||
label: faker.lorem.words(5), | ||
comment: faker.lorem.words(10), | ||
}; | ||
|
||
cy.intercept('POST', '/v2/ontologies').as('submitRequest'); | ||
cy.visit(`/project/${projectPage.projectUuid}/data-models`); | ||
cy.url().should('include', `project\/${projectPage.projectUuid}\/data-models`); | ||
|
||
cy.get('[data-cy=data-models-container]') | ||
.find('[data-cy=create-button]') | ||
.scrollIntoView() | ||
.should('be.visible') | ||
.click(); | ||
|
||
cy.get('[data-cy=name-input]').type(data.name); | ||
cy.get('[data-cy=label-input]').clear().type(data.label); | ||
cy.get('[data-cy=comment-textarea]').type(data.comment); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@submitRequest'); | ||
cy.url().should('include', `project/${projectPage.projectUuid}/ontology/${data.name}/editor/classes`); | ||
cy.get('[data-cy=ontology-label]').contains(data.label).should('be.visible'); | ||
}); | ||
|
||
it('should update ontology', () => { | ||
const data = <CreateOntology>{ | ||
name: faker.string.alpha({ length: { min: 3, max: 16 } }), | ||
label: faker.lorem.words(5), | ||
comment: faker.lorem.words(10), | ||
}; | ||
|
||
cy.intercept('PUT', '/v2/ontologies/metadata').as('updateRequest'); | ||
|
||
cy.createOntology(projectPage).then(ontology => { | ||
cy.get('[data-cy=edit-ontology-button]').scrollIntoView().should('be.visible').click(); | ||
cy.get('[data-cy=label-input]').clear().type(data.label); | ||
cy.get('[data-cy=comment-textarea]').type(data.comment); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@updateRequest'); | ||
cy.url().should( | ||
'include', | ||
`project/${projectPage.projectUuid}/ontology/${ontology.ontology.name}/editor/classes` | ||
); | ||
cy.get('[data-cy=ontology-label]').contains(data.label).should('be.visible'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.