Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
with:
working-directory: ./frontend
wait-on: 'http://localhost:8080'
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-videos
Expand Down
28 changes: 0 additions & 28 deletions frontend/.eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ After authentication is completed, we are redirected to `/groups` that serves as

`stores` folder contains all the Svelte stores (state variables) that share data among all components that imports them.


## Application Functionality

### Authentication
Expand Down
18 changes: 9 additions & 9 deletions frontend/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this comment be deleted?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is used for silent lint errors, without it

$ npm run lint

> [email protected] lint
> prettier --check --plugin-search-dir=. . && eslint .

[warn] Ignored unknown option --plugin-search-dir=..
Checking formatting...
All matched files use Prettier code style!

/home/DDSPermissionsManager/frontend/cypress.config.js
  18:19  error  'on' is defined but never used      no-unused-vars
  18:23  error  'config' is defined but never used  no-unused-vars

✖ 2 problems (2 errors, 0 warnings)

// Copyright 2023 DDS Permissions Manager Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,14 +12,13 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { defineConfig } from "cypress";
import { defineConfig } from 'cypress';

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
baseUrl: 'http://localhost:8080'

},
});
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
baseUrl: 'http://localhost:8080'
}
Comment on lines +18 to +23
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like tabs are used for indentation instead of spaces in these and the other places. I think spaces are preferred for consistent rendering across editors; the current code seems using spaces as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tab is generated from npm run format -- --write and the format is defined in .prettierrc which I did not change.

});
61 changes: 32 additions & 29 deletions frontend/cypress/e2e/action_intervals.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,53 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/* global cy, describe, beforeEach, it */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line appears in multiple files but I'm not sure if it should be included in the comment.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used to silent lint errors. Without it, you get the following lint errors

$ npm run lint
> [email protected] lint
> prettier --check --plugin-search-dir=. . && eslint .

[warn] Ignored unknown option --plugin-search-dir=..
Checking formatting...
All matched files use Prettier code style!

/home/DDSPermissionsManager/frontend/cypress/e2e/action_intervals.cy.js
  17:1  error  'describe' is not defined    no-undef
  18:2  error  'beforeEach' is not defined  no-undef
  19:3  error  'cy' is not defined          no-undef
  20:3  error  'cy' is not defined          no-undef
  21:3  error  'cy' is not defined          no-undef
  22:3  error  'cy' is not defined          no-undef
  25:2  error  'it' is not defined          no-undef
  26:3  error  'cy' is not defined          no-undef
  28:3  error  'cy' is not defined          no-undef
  30:3  error  'cy' is not defined          no-undef
  32:3  error  'cy' is not defined          no-undef
  34:3  error  'cy' is not defined          no-undef
  36:3  error  'cy' is not defined          no-undef
  38:3  error  'cy' is not defined          no-undef
  42:3  error  'cy' is not defined          no-undef
  47:3  error  'cy' is not defined          no-undef
  49:3  error  'cy' is not defined          no-undef
  52:2  error  'it' is not defined          no-undef
  53:3  error  'cy' is not defined          no-undef
  55:3  error  'cy' is not defined          no-undef
  57:3  error  'cy' is not defined          no-undef
  59:3  error  'cy' is not defined          no-undef
  61:3  error  'cy' is not defined          no-undef

/// <reference types="Cypress" />

describe('Action Interval Capabilities', () => {
beforeEach(() => {
cy.login('unity-admin', 'password');
cy.intercept('http://localhost:8080/api/token_info').as('tokenInfo');
cy.visit('http://localhost:8080/');
cy.wait('@tokenInfo');
});
beforeEach(() => {
cy.login('unity-admin', 'password');
cy.intercept('http://localhost:8080/api/token_info').as('tokenInfo');
cy.visit('http://localhost:8080/');
cy.wait('@tokenInfo');
});

it('should add a new action interval to group Alpha.', () => {
cy.visit('/action-intervals');
it('should add a new action interval to group Alpha.', () => {
cy.visit('/action-intervals');

cy.get('[data-cy="group-input"]')
.type("alpha");
cy.get('[data-cy="group-input"]').type('alpha');

cy.wait(500);
cy.wait(500);

cy.get('[data-cy="group-input"]').type('{downArrow}').type('{enter}');
cy.get('[data-cy="group-input"]').type('{downArrow}').type('{enter}');

cy.get('[data-cy="add-action-interval"]')
.click();
cy.get('[data-cy="add-action-interval"]').click();

cy.get('[data-cy="action-interval-name-input"]').type('First Action Interval');

cy.get('[data-cy="action-interval-name-input"]').type('First Action Interval');
cy.get(':nth-child(3) > .date-time-field')
.type('{selectall}{backspace}')
.type('2023-10-01')
.type('{enter}');
cy.get(':nth-child(4) > .date-time-field')
.type('{selectall}{backspace}')
.type('2023-10-11')
.type('{enter}');

cy.get(':nth-child(3) > .date-time-field').type('{selectall}{backspace}').type('2023-10-01').type('{enter}');
cy.get(':nth-child(4) > .date-time-field').type('{selectall}{backspace}').type('2023-10-11').type('{enter}');
cy.get('[data-cy="button-add-action-interval"]').click();

cy.get('[data-cy="button-add-action-interval"]').click();
cy.get('[data-cy="action-interval-name"]').contains('First Action Interval');
});

cy.get('[data-cy="action-interval-name"]').contains('First Action Interval');
});
it('should delete First Action Interval', () => {
cy.visit('/action-intervals');

it('should delete First Action Interval', () => {
cy.visit('/action-intervals');
cy.get('[data-cy="group-input"]').type('alpha');

cy.get('[data-cy="group-input"]')
.type("alpha");
cy.wait(500);

cy.wait(500);
cy.get('[data-cy="delete-action-interval-icon"]').first().click();

cy.get('[data-cy="delete-action-interval-icon"]').first().click();

cy.get('[data-cy="delete-topic"]').click();
});
cy.get('[data-cy="delete-topic"]').click();
});
});
57 changes: 27 additions & 30 deletions frontend/cypress/e2e/add-users.cy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global cy, describe, beforeEach, it */
// Copyright 2023 DDS Permissions Manager Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -11,33 +12,29 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
describe('Users capabilities', () => {
beforeEach(() => {
cy.login('unity-admin', 'password');
cy.intercept('http://localhost:8080/api/token_info').as('tokenInfo');
cy.visit('http://localhost:8080/');
cy.wait('@tokenInfo');
});

it('should add a new user', () => {
cy.visit('/users');

cy.get('[data-cy="group-input"]')
.type("alpha");

cy.wait(500);

cy.get('[data-cy="group-input"]').type('{downArrow}').type('{enter}');

cy.get('[data-cy="add-user"]')
.click();

cy.get('[data-cy="email-input"]')
.type("[email protected]");

cy.get('[data-cy="button-add-user"]')
.click();

cy.get('td').should('contain.text', '[email protected]');
});
});
describe('Users capabilities', () => {
beforeEach(() => {
cy.login('unity-admin', 'password');
cy.intercept('http://localhost:8080/api/token_info').as('tokenInfo');
cy.visit('http://localhost:8080/');
cy.wait('@tokenInfo');
});

it('should add a new user', () => {
cy.visit('/users');

cy.get('[data-cy="group-input"]').type('alpha');

cy.wait(500);

cy.get('[data-cy="group-input"]').type('{downArrow}').type('{enter}');

cy.get('[data-cy="add-user"]').click();

cy.get('[data-cy="email-input"]').type('[email protected]');

cy.get('[data-cy="button-add-user"]').click();

cy.get('td').should('contain.text', '[email protected]');
});
});
32 changes: 15 additions & 17 deletions frontend/cypress/e2e/add_super_users.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,26 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/* global cy, describe, beforeEach, it */
/// <reference types="Cypress" />

describe('Super users capabilities', () => {
beforeEach(() => {
cy.login('unity-admin', 'password');
cy.intercept('http://localhost:8080/api/token_info').as('tokenInfo');
cy.visit('http://localhost:8080/');
cy.wait('@tokenInfo');
});

it('should add a new super user', () => {
cy.visit('/users');
beforeEach(() => {
cy.login('unity-admin', 'password');
cy.intercept('http://localhost:8080/api/token_info').as('tokenInfo');
cy.visit('http://localhost:8080/');
cy.wait('@tokenInfo');
});

cy.get('[data-cy="add-super-user"]')
.click();
it('should add a new super user', () => {
cy.visit('/users');

cy.get('[data-cy="email-input"]')
.type("[email protected]");
cy.get('[data-cy="add-super-user"]').click();

cy.get('[data-cy="button-add-super-user"]')
.click();
cy.get('[data-cy="email-input"]').type('[email protected]');

cy.get('td').should('contain.text', '[email protected]');
});
cy.get('[data-cy="button-add-super-user"]').click();

cy.get('td').should('contain.text', '[email protected]');
});
});
53 changes: 25 additions & 28 deletions frontend/cypress/e2e/applications_add.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,32 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/* global cy, describe, beforeEach, it */
/// <reference types="Cypress" />

describe('Applications Capabilities', () => {
beforeEach(() => {
cy.login('unity-admin', 'password');
cy.intercept('http://localhost:8080/api/token_info').as('tokenInfo');
cy.visit('http://localhost:8080/');
cy.wait('@tokenInfo');
});

it('should add a new application', () => {
cy.visit('/applications');

cy.get('[data-cy="group-input"]')
.type("alpha");

cy.wait(500);

cy.get('[data-cy="group-input"]').type('{downArrow}').type('{enter}');

cy.get('[data-cy="add-application"]')
.click();

cy.get('[data-cy="application-name"]')
.type("Test Application");

cy.get('[data-cy="button-add-application"]')
.click();

cy.get('td').should('contain.text', 'Test Application');
});
beforeEach(() => {
cy.login('unity-admin', 'password');
cy.intercept('http://localhost:8080/api/token_info').as('tokenInfo');
cy.visit('http://localhost:8080/');
cy.wait('@tokenInfo');
});

it('should add a new application', () => {
cy.visit('/applications');

cy.get('[data-cy="group-input"]').type('alpha');

cy.wait(500);

cy.get('[data-cy="group-input"]').type('{downArrow}').type('{enter}');

cy.get('[data-cy="add-application"]').click();

cy.get('[data-cy="application-name"]').type('Test Application');

cy.get('[data-cy="button-add-application"]').click();

cy.get('td').should('contain.text', 'Test Application');
});
});
43 changes: 19 additions & 24 deletions frontend/cypress/e2e/applications_b_edit.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,34 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/* global cy, describe, beforeEach, it */
/// <reference types="Cypress" />

describe('Applications Capabilities', () => {
beforeEach(() => {
cy.login('unity-admin', 'password');
cy.intercept('http://localhost:8080/api/token_info').as('tokenInfo');
cy.visit('http://localhost:8080/');
cy.wait('@tokenInfo');
});

it('should edit the name of the second application', () => {
cy.visit('/applications');
beforeEach(() => {
cy.login('unity-admin', 'password');
cy.intercept('http://localhost:8080/api/token_info').as('tokenInfo');
cy.visit('http://localhost:8080/');
cy.wait('@tokenInfo');
});

cy.get('td').contains('Test Application')
.click();
it('should edit the name of the second application', () => {
cy.visit('/applications');

cy.wait(500);

cy.get('[data-cy="edit-application-icon"]')
.click({force: true});
cy.get('td').contains('Test Application').click();

cy.get('[data-cy="application-name"]')
.clear()
.type("New Application");
cy.wait(500);

cy.get('[data-cy="save-application"]')
.click();
cy.get('[data-cy="edit-application-icon"]').click({ force: true });

cy.visit('/applications');
cy.get('[data-cy="application-name"]').clear().type('New Application');

cy.get('td').should('not.eq', 'Test Application');
cy.get('[data-cy="save-application"]').click();

cy.get('td').contains('New Application');
cy.visit('/applications');

});
cy.get('td').should('not.eq', 'Test Application');

cy.get('td').contains('New Application');
});
});
Loading