Skip to content

Commit

Permalink
Merge branch 'main' into julien/fix-multilanguage
Browse files Browse the repository at this point in the history
  • Loading branch information
derschnee68 authored Jan 16, 2024
2 parents 99af7b1 + 38b42d5 commit 28d18d1
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 98 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ tmp/

# Ignore certain project files
docs/assets/js/
apps/dsp-app/cypress/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ Thumbs.db

#E2E
/.nx
apps/dsp-app-e2e/cypress/screenshots
apps/dsp-app/cypress/screenshots
5 changes: 0 additions & 5 deletions apps/dsp-app-e2e/cypress/fixtures/example.json

This file was deleted.

44 changes: 0 additions & 44 deletions apps/dsp-app-e2e/cypress/support/commands/login.ts

This file was deleted.

29 changes: 0 additions & 29 deletions apps/dsp-app-e2e/project.json

This file was deleted.

9 changes: 0 additions & 9 deletions apps/dsp-app-e2e/tsconfig.json

This file was deleted.

File renamed without changes.
15 changes: 15 additions & 0 deletions apps/dsp-app/cypress/e2e/logged-out-user/dashboard.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe('Visual Check for Projects on Home Page', () => {
it.skip('should load clickable projects on the home page', () => {
cy.visit('/');

cy.get('[data-cy=accept-cookies]').click();

const projectTileSelector = '[data-cy=tile]';

cy.get(projectTileSelector).should('be.visible').should('have.length.greaterThan', 0);

cy.get(projectTileSelector).first().find('[data-cy=navigate-to-project-button]').click();

cy.url().should('include', '/project'); // Update with the expected URL
});
});
15 changes: 15 additions & 0 deletions apps/dsp-app/cypress/e2e/system-admin/dashboard.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const MY_TOKEN = '';
localStorage.setItem('ACCESS_TOKEN', MY_TOKEN);

describe('ADMIN TEST', () => {
it('should load clickable projects on the home page', () => {
cy.visit('/');
const projectTileSelector = '[data-cy=tile]';

cy.get(projectTileSelector).should('be.visible').should('have.length.greaterThan', 0);

cy.get(projectTileSelector).first().find('[data-cy=navigate-to-project-button]').click();

cy.url().should('include', '/project'); // Update with the expected URL
});
});
File renamed without changes.
25 changes: 25 additions & 0 deletions apps/dsp-app/cypress/support/commands/login.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { User } from '../../models/user-profiles';

Cypress.Commands.add('login', (user: User) => {
cy.session(
user,
() => {
cy.request({
method: 'POST',
url: `${Cypress.env('apiUrl')}/v2/authentication`,
body: {
username: user.username,
password: user.password,
},
}).then(response => {
localStorage.setItem('cookieBanner', 'false');
localStorage.setItem('ACCESS_TOKEN', response.body.token);
});
},
{
validate: () => {
expect(localStorage.getItem('ACCESS_TOKEN')).to.exist;
},
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ beforeEach(() => {
// read JSON data file
users = json;

if (Cypress.spec.relative.startsWith('cypress/e2e/System_Admin')) {
if (Cypress.spec.relative.startsWith('cypress/e2e/system-admin')) {
cy.login({
username: users.systemAdmin_username_root,
password: users.systemAdmin_password_root,
});
}

if (Cypress.spec.relative.startsWith('cypress/e2e/Project_Member')) {
if (Cypress.spec.relative.startsWith('cypress/e2e/project-member')) {
cy.login({
username: users.projectMember_username,
password: users.projectMember_password,
Expand Down
13 changes: 13 additions & 0 deletions apps/dsp-app/cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"include": [
"**/*.ts"
],
"exclude": [],
"compilerOptions": {
"sourceMap": false,
"types": [
"cypress"
]
}
}
24 changes: 22 additions & 2 deletions apps/dsp-app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/dsp-app/**/*.ts", "apps/dsp-app/**/*.html"]
}
"lintFilePatterns": ["apps/dsp-app/**/*.{ts,html}"]
}
},
"test": {
"executor": "@angular-devkit/build-angular:karma",
Expand Down Expand Up @@ -221,6 +221,26 @@
"browsers": "ChromeHeadless"
}
}
},
"e2e": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/dsp-app/cypress.config.ts"
},
"configurations": {
"production": {
"devServerTarget": "dsp-app:serve:production",
"env": {
"API_URL": "http://0.0.0.0:3333/api"
}
},
"development": {
"devServerTarget": "dsp-app:serve:development",
"env": {
"API_URL": "http://0.0.0.0:3333/api"
}
}
}
}
}
}
2 changes: 1 addition & 1 deletion apps/dsp-app/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<span class="link" (click)="goToCookiePolicy()">use of cookies</span>.
</p>
<div class="action">
<button mat-flat-button color="primary" (click)="closeCookieBanner()">ACCEPT</button>
<button mat-flat-button color="primary" (click)="closeCookieBanner()" data-cy="accept-cookies">ACCEPT</button>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="project-tile">
<div class="project-tile" data-cy="tile">
<div class="project-tile-content">
<div class="top-bar">
<div class="status">
Expand All @@ -25,7 +25,12 @@
</div>

<div class="workspace-button-container">
<button class="workspace-button" mat-flat-button [color]="'primary'" (click)="navigateToProject(project.id)">
<button
class="workspace-button"
mat-flat-button
[color]="'primary'"
(click)="navigateToProject(project.id)"
data-cy="navigate-to-project-button">
Browse Data
</button>
</div>
Expand Down
3 changes: 3 additions & 0 deletions apps/dsp-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
},
{
"path": "./tsconfig.editor.json"
},
{
"path": "./cypress/tsconfig.json"
}
],
"extends": "../../tsconfig.base.json",
Expand Down
9 changes: 9 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"start-with-ls-test-server": "nx run dsp-app:serve:ls-test-server",
"start-with-0845-test-server": "nx run dsp-app:serve:0845-test-server",
"start-with-staging-server": "nx run dsp-app:serve:staging-server",
"e2e-local": "cd apps/dsp-app-e2e && npx cypress open",
"e2e-ci-dev": "nx run dsp-app-e2e:e2e:development",
"e2e-ci": "nx run dsp-app-e2e:e2e:production",
"e2e-local": "cd apps/dsp-app && npx cypress open",
"e2e-ci-dev": "nx run dsp-app:e2e:development",
"e2e-ci": "nx run dsp-app:e2e:production",
"build": "nx run dsp-app:build",
"build-prod": "nx run dsp-app:build:production",
"test-ci": "nx run dsp-app:test:ci",
Expand Down

0 comments on commit 28d18d1

Please sign in to comment.