-
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-2995-add-form-to-update-restrict…
…ed-view-settings-watermark-and * main: fix(dsp-das): image viewer padding, arrows style. Resource list name css adjustments (DEV-3276) (#1456) fix: loads all projects when membership dialog is opened (DEV-3268) (#1450) test: add projects, list and auth end to end tests (#1454) fix: add instrumentation to faro sdk (#1455) feat(dsp-app): image settings updates and fixes (DEV-2995) (#1451) fix: remove old "edit project" page url (#1452) chore(main): release 11.5.1 (#1449) chore: update dsp-js to v9.1.11 (#1447) chore(main): release 11.5.0 (#1442) fix: list item delete (DEV-3267) (#1446) # Conflicts: # apps/dsp-app/src/app/project/image-settings/image-settings.component.html # apps/dsp-app/src/app/project/image-settings/image-settings.component.scss # apps/dsp-app/src/app/project/image-settings/image-settings.component.ts # apps/dsp-app/src/app/project/image-settings/project-image-settings.ts # apps/dsp-app/src/assets/i18n/de.json # apps/dsp-app/src/assets/i18n/en.json
- Loading branch information
Showing
39 changed files
with
793 additions
and
116 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { faker } from '@faker-js/faker'; | ||
import { UserProfiles } from '../../models/user-profiles'; | ||
|
||
describe('Authentication', () => { | ||
const po = { | ||
loginButton: '[data-cy=login-button]', | ||
username: '[data-cy=username-input]', | ||
password: '[data-cy=password-input]', | ||
submitButton: '[data-cy=submit-button]', | ||
}; | ||
it('Logged out user can login', () => { | ||
cy.readFile('cypress/fixtures/user_profiles.json').then((users: UserProfiles) => { | ||
cy.visit('/'); | ||
|
||
cy.get(po.loginButton).click(); | ||
|
||
cy.get(po.username).type(users.systemAdmin_username_root); | ||
cy.get(po.password).type(users.systemAdmin_password_root); | ||
cy.get(po.submitButton).click(); | ||
|
||
cy.get(po.loginButton).should('not.be.visible'); | ||
}); | ||
}); | ||
|
||
it('Logged out user receives a notification if wrong credentials', () => { | ||
cy.visit('/'); | ||
|
||
cy.get(po.loginButton).click(); | ||
|
||
cy.get(po.username).type(faker.internet.userName()); | ||
cy.get(po.password).type(faker.internet.password()); | ||
cy.get(po.submitButton).click(); | ||
|
||
cy.get('body').click('topLeft'); | ||
cy.get(po.loginButton).should('be.visible'); | ||
cy.get('.data-cy-snackbar').should('contain', 'The username and / or password do not match.'); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { faker } from '@faker-js/faker'; | ||
import { ListGetResponseADM } from '../../../../../libs/vre/open-api/src'; | ||
|
||
describe('Lists', () => { | ||
let listUrl: string; | ||
let listId: string; | ||
beforeEach(() => { | ||
cy.request<ListGetResponseADM>('POST', `${Cypress.env('apiUrl')}/admin/lists`, { | ||
comments: [{ language: 'de', value: faker.lorem.words(2) }], | ||
labels: [{ language: 'de', value: faker.lorem.words(2) }], | ||
projectIri: 'http://rdfh.ch/projects/00FF', | ||
}).then(response => { | ||
listId = response.body.list.listinfo.id.match(/\/([^\/]*)$/)[1]; | ||
listUrl = `/project/00FF/list/${listId}`; | ||
}); | ||
}); | ||
|
||
it('user can create a list', () => { | ||
cy.intercept('POST', '/admin/lists').as('submitRequest'); | ||
|
||
cy.visit('/project/00FF/add-list'); | ||
cy.get('[data-cy=labels-input]').type(faker.lorem.words(2)); | ||
cy.get('[data-cy=comments-input]').type(faker.lorem.sentence()); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@submitRequest'); | ||
cy.url().should('match', /\/project\/00FF\/list\/(.+)/); | ||
}); | ||
|
||
it('user can edit a list', () => { | ||
const data = { | ||
label: faker.lorem.words(2), | ||
comment: faker.lorem.word(2), | ||
}; | ||
cy.intercept('PUT', '/admin/lists/*').as('editRequest'); | ||
|
||
cy.visit(listUrl); | ||
|
||
cy.get('[data-cy=edit-button]').click(); | ||
cy.get('[data-cy=labels-input] input').clear().type(data.label, { force: true }); | ||
cy.get('[data-cy=comments-input]').clear().type(data.comment); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@editRequest'); | ||
cy.url().should('match', /\/project\/00FF\/list\/(.+)/); | ||
cy.get('[data-cy=label-title]').contains(data.label); | ||
cy.get('[data-cy=comment-title]').contains(data.comment); | ||
}); | ||
|
||
it('user can delete a list', () => { | ||
cy.visit(listUrl); | ||
cy.intercept('DELETE', '/admin/lists/*').as('deleteRequest'); | ||
cy.get('[data-cy=delete-button]').click(); | ||
cy.get('[data-cy=confirmation-button]').click(); | ||
cy.wait('@deleteRequest'); | ||
|
||
cy.url().should('match', /\/project\/00FF\/data-models$/); | ||
}); | ||
}); |
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,117 @@ | ||
import { faker } from '@faker-js/faker'; | ||
import { ProjectOperationResponseADM } from '../../../../../libs/vre/open-api/src'; | ||
import { customShortcode } from '../../support/helpers/custom-shortcode'; | ||
import { generateKeyword } from '../../support/helpers/custom-word'; | ||
import { randomNumber } from '../../support/helpers/random-number'; | ||
|
||
describe('Projects', () => { | ||
let projectIri: string; | ||
|
||
const payload = { | ||
shortname: 'shortname', | ||
shortcode: 'A0A0', | ||
longname: 'Longname', | ||
description: [{ language: 'de', value: 'description' }], | ||
keywords: ['keyword'], | ||
status: true, | ||
selfjoin: true, | ||
}; | ||
|
||
beforeEach(() => { | ||
cy.request<ProjectOperationResponseADM>('POST', `${Cypress.env('apiUrl')}/admin/projects`, payload).then( | ||
response => { | ||
projectIri = response.body.project.id; | ||
} | ||
); | ||
}); | ||
|
||
it('admin can create a project', () => { | ||
const data = { | ||
shortcode: customShortcode(), | ||
shortname: faker.internet.userName(), | ||
longname: faker.company.name(), | ||
description: faker.lorem.sentence(), | ||
keywords: Array.from({ length: randomNumber(3, 6) }, () => generateKeyword(4)), | ||
}; | ||
|
||
cy.intercept('POST', '/admin/projects').as('submitRequest'); | ||
|
||
cy.visit('/project/create-new'); | ||
cy.get('[data-cy=shortcode-input]').type(data.shortcode); | ||
cy.get('[data-cy=shortname-input]').type(data.shortname); | ||
cy.get('[data-cy=longname-input]').type(data.longname); | ||
cy.get('[data-cy=description-input]').type(data.description); | ||
cy.get('[data-cy=keywords-input]').type(`${data.keywords.join('{enter}')}{enter}`); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@submitRequest'); | ||
cy.url().should('match', /\/project\/(.+)/); | ||
cy.contains(data.shortcode).should('be.visible'); | ||
cy.contains(data.description).should('be.visible'); | ||
data.keywords.forEach(keyword => cy.contains(keyword).should('be.visible')); | ||
}); | ||
|
||
it('admin can edit a project', () => { | ||
const data = { | ||
longname: faker.company.name(), | ||
description: faker.lorem.sentence(), | ||
keywords: faker.lorem.words(3).split(' '), | ||
}; | ||
cy.intercept('PUT', '/admin/projects/iri/*').as('submitRequest'); | ||
|
||
cy.visit(`/project/${projectIri.match(/\/([^\/]+)$/)[1]}/settings/edit`); | ||
cy.get('[data-cy=shortcode-input] input').should('have.value', payload.shortcode); | ||
cy.get('[data-cy=shortname-input] input').should('have.value', payload.shortname); | ||
cy.get('[data-cy=longname-input] input').should('have.value', payload.longname).clear().type(data.longname); | ||
cy.get('[data-cy=description-input] textarea') | ||
.should('have.value', payload.description[0].value) | ||
.clear() | ||
.type(data.description); | ||
cy.get('[data-cy=keywords-input] input') | ||
.type('{backspace}'.repeat(5)) | ||
.type(`${data.keywords.join('{enter}')}{enter}`); | ||
cy.get('[data-cy=submit-button]').click(); | ||
|
||
cy.wait('@submitRequest'); | ||
cy.url().should('match', /\/project\/(.+)/); | ||
cy.contains(payload.shortcode).should('be.visible'); | ||
cy.contains(data.description).should('be.visible'); | ||
data.keywords.forEach(keyword => cy.contains(keyword).should('be.visible')); | ||
}); | ||
|
||
it('admin can deactivate a project', () => { | ||
cy.intercept('DELETE', `/admin/projects/iri/${encodeURIComponent(projectIri)}`).as('deactivateRequest'); | ||
|
||
cy.visit('/system/projects'); | ||
cy.get('[data-cy=active-projects-section]') | ||
.contains('[data-cy=project-row]', payload.shortcode) | ||
.find('[data-cy=more-button]') | ||
.scrollIntoView() | ||
.should('be.visible') | ||
.click(); | ||
cy.get('[data-cy=deactivate-button]').click(); | ||
cy.get('[data-cy=confirmation-button]').click(); | ||
cy.wait('@deactivateRequest'); | ||
|
||
cy.get('[data-cy=inactive-projects-section]').contains('[data-cy=project-row]', payload.shortcode).should('exist'); | ||
}); | ||
|
||
it.only('admin can reactivate a project', () => { | ||
cy.intercept('PUT', `/admin/projects/iri/${encodeURIComponent(projectIri)}`).as('updateRequest'); | ||
|
||
cy.request('DELETE', `${Cypress.env('apiUrl')}/admin/projects/iri/${encodeURIComponent(projectIri)}`).then(() => { | ||
cy.visit('/system/projects'); | ||
cy.get('[data-cy=inactive-projects-section]') | ||
.contains('[data-cy=project-row]', payload.shortcode) | ||
.find('[data-cy=more-button]') | ||
.scrollIntoView() | ||
.should('be.visible') | ||
.click(); | ||
cy.get('[data-cy=reactivate-button]').scrollIntoView().click({ force: true }); | ||
cy.get('[data-cy=confirmation-button]').click(); | ||
cy.wait('@updateRequest'); | ||
|
||
cy.get('[data-cy=active-projects-section]').contains('[data-cy=project-row]', payload.shortcode).should('exist'); | ||
}); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export const customShortcode = () => { | ||
const validLetters = 'ABCDEF'; | ||
const validDigits = '0123456789'; | ||
|
||
const getRandomChar = characters => characters[Math.floor(Math.random() * characters.length)]; | ||
|
||
let result = ''; | ||
|
||
// Generate up to 4 characters | ||
for (let i = 0; i < 4; i++) { | ||
// Decide whether to add a letter or a digit | ||
const isLetter = Math.random() < 0.5; | ||
|
||
// Add a random letter or digit to the result | ||
result += isLetter ? getRandomChar(validLetters) : getRandomChar(validDigits); | ||
} | ||
|
||
return result; | ||
}; |
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,9 @@ | ||
import { faker } from '@faker-js/faker'; | ||
|
||
export function generateKeyword(minLength: number) { | ||
let keyword = faker.lorem.word(); | ||
while (keyword.length < minLength) { | ||
keyword = faker.lorem.word(); | ||
} | ||
return keyword; | ||
} |
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,3 @@ | ||
export function randomNumber(min: number, max: number) { | ||
return Math.floor(Math.random() * (max - min + 1)) + min; | ||
} |
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"include": [ | ||
"**/*.ts" | ||
], | ||
"exclude": [], | ||
"compilerOptions": { | ||
"sourceMap": false, | ||
"types": [ | ||
"cypress" | ||
"cypress", | ||
"node" | ||
] | ||
} | ||
} |
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
Oops, something went wrong.