Skip to content

Commit

Permalink
Fetch the right files from the dtq-dev branch
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak committed Jun 19, 2024
1 parent ee71830 commit 1c91c75
Show file tree
Hide file tree
Showing 11 changed files with 677 additions and 158 deletions.
3 changes: 2 additions & 1 deletion .github/disabled-workflows/label_merge_conflicts.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# This workflow checks open PRs for merge conflicts and labels them when conflicts are found
name: Check for merge conflicts

# Run this for all pushes (i.e. merges) to 'main' or maintenance branches
# Run whenever the "main" branch is updated
# NOTE: This means merge conflicts are only checked for when a PR is merged to main.
on:
push:
branches: [ main ]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build](https://github.com/dataquest-dev/dspace-angular/actions/workflows/build.yml/badge.svg)](https://github.com/dataquest-dev/dspace-angular/actions/workflows/build.yml) [![Coverage Status](https://codecov.io/gh/DSpace/dspace-angular/branch/main/graph/badge.svg)](https://codecov.io/gh/DSpace/dspace-angular) [![Universal Angular](https://img.shields.io/badge/universal-angular2-brightgreen.svg?style=flat)](https://github.com/angular/universal)
[![Build](https://github.com/dataquest-dev/dspace-angular/actions/workflows/build.yml/badge.svg)](https://github.com/dataquest-dev/dspace-angular/actions/workflows/build.yml) [![codecov](https://codecov.io/gh/dataquest-dev/dspace-angular/branch/dtq-dev/graph/badge.svg?token=DQ7QIZN8S6)](https://codecov.io/gh/dataquest-dev/dspace-angular) [![Universal Angular](https://img.shields.io/badge/universal-angular2-brightgreen.svg?style=flat)](https://github.com/angular/universal)

dspace-angular
==============
Expand Down
26 changes: 26 additions & 0 deletions cypress/e2e/admin-menu.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {
TEST_ADMIN_PASSWORD,
TEST_ADMIN_USER,
TEST_SUBMIT_COLLECTION_UUID,
} from '../support/e2e';

/**
* Test menu options for admin
*/
describe('Admin Menu Page', () => {
beforeEach(() => {
// Create a new submission
cy.visit('/submit?collection=' + TEST_SUBMIT_COLLECTION_UUID + '&entityType=none');

// This page is restricted, so we will be shown the login form. Fill it out & submit.
cy.loginViaForm(TEST_ADMIN_USER, TEST_ADMIN_PASSWORD);
});

it('should pass accessibility tests', () => {
// Check handles redirect url in the <a> tag
cy.get('.sidebar-top-level-items a[href = "/handle-table"]').scrollIntoView().should('be.visible');

// Check licenses redirect url in the <a> tag
cy.get('.sidebar-top-level-items a[href = "/licenses/manage-table"]').scrollIntoView().should('be.visible');
});
});
139 changes: 139 additions & 0 deletions cypress/e2e/login-modal.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
import { TEST_ADMIN_PASSWORD, TEST_ADMIN_USER, TEST_ENTITY_PUBLICATION } from 'cypress/support/e2e';
import { testA11y } from 'cypress/support/utils';

const page = {
openLoginMenu() {
// Click the "Log In" dropdown menu in header
cy.get('ds-themed-navbar [data-test="login-menu"]').click();
},
openUserMenu() {
// Once logged in, click the User menu in header
cy.get('ds-themed-navbar [data-test="user-menu"]').click();
},
submitLoginAndPasswordByPressingButton(email, password) {
// Enter email
cy.get('ds-themed-navbar [data-test="email"]').type(email);
// Enter password
cy.get('ds-themed-navbar [data-test="password"]').type(password);
// Click login button
cy.get('ds-themed-navbar [data-test="login-button"]').click();
},
submitLoginAndPasswordByPressingEnter(email, password) {
// In opened Login modal, fill out email & password, then click Enter
cy.get('ds-themed-navbar [data-test="email"]').type(email);
cy.get('ds-themed-navbar [data-test="password"]').type(password);
cy.get('ds-themed-navbar [data-test="password"]').type('{enter}');
},
submitLogoutByPressingButton() {
// This is the POST command that will actually log us out
cy.intercept('POST', '/server/api/authn/logout').as('logout');
// Click logout button
cy.get('ds-themed-navbar [data-test="logout-button"]').click();
// Wait until above POST command responds before continuing
// (This ensures next action waits until logout completes)
cy.wait('@logout');
}
};

// CLARIN - CLARIN-DSpace7.x has different login
// describe('Login Modal', () => {
// it('should login when clicking button & stay on same page', () => {
// const ENTITYPAGE = '/entities/publication/'.concat(TEST_ENTITY_PUBLICATION);
// cy.visit(ENTITYPAGE);
//
// // Login menu should exist
// cy.get('ds-log-in').should('exist');
//
// // Login, and the <ds-log-in> tag should no longer exist
// page.openLoginMenu();
// cy.get('.form-login').should('be.visible');
//
// page.submitLoginAndPasswordByPressingButton(TEST_ADMIN_USER, TEST_ADMIN_PASSWORD);
// cy.get('ds-log-in').should('not.exist');
//
// // Verify we are still on the same page
// cy.url().should('include', ENTITYPAGE);
//
// // Open user menu, verify user menu & logout button now available
// page.openUserMenu();
// cy.get('ds-user-menu').should('be.visible');
// cy.get('ds-log-out').should('be.visible');
// });
//
// it('should login when clicking enter key & stay on same page', () => {
// cy.visit('/home');
//
// // Open login menu in header & verify <ds-log-in> tag is visible
// page.openLoginMenu();
// cy.get('.form-login').should('be.visible');
//
// // Login, and the <ds-log-in> tag should no longer exist
// page.submitLoginAndPasswordByPressingEnter(TEST_ADMIN_USER, TEST_ADMIN_PASSWORD);
// cy.get('.form-login').should('not.exist');
//
// // Verify we are still on homepage
// cy.url().should('include', '/home');
//
// // Open user menu, verify user menu & logout button now available
// page.openUserMenu();
// cy.get('ds-user-menu').should('be.visible');
// cy.get('ds-log-out').should('be.visible');
// });
//
// it('should support logout', () => {
// // First authenticate & access homepage
// cy.login(TEST_ADMIN_USER, TEST_ADMIN_PASSWORD);
// cy.visit('/');
//
// // Verify ds-log-in tag doesn't exist, but ds-log-out tag does exist
// cy.get('ds-log-in').should('not.exist');
// cy.get('ds-log-out').should('exist');
//
// // Click logout button
// page.openUserMenu();
// page.submitLogoutByPressingButton();
//
// // Verify ds-log-in tag now exists
// cy.get('ds-log-in').should('exist');
// cy.get('ds-log-out').should('not.exist');
// });
//
// it('should allow new user registration', () => {
// cy.visit('/');
//
// page.openLoginMenu();
//
// // Registration link should be visible
// cy.get('ds-themed-navbar [data-test="register"]').should('be.visible');
//
// // Click registration link & you should go to registration page
// cy.get('ds-themed-navbar [data-test="register"]').click();
// cy.location('pathname').should('eq', '/register');
// cy.get('ds-register-email').should('exist');
// });
//
// it('should allow forgot password', () => {
// cy.visit('/');
//
// page.openLoginMenu();
//
// // Forgot password link should be visible
// cy.get('ds-themed-navbar [data-test="forgot"]').should('be.visible');
//
// // Click link & you should go to Forgot Password page
// cy.get('ds-themed-navbar [data-test="forgot"]').click();
// cy.location('pathname').should('eq', '/forgot');
// cy.get('ds-forgot-email').should('exist');
// });
//
// it('should pass accessibility tests', () => {
// cy.visit('/');
//
// page.openLoginMenu();
//
// cy.get('ds-log-in').should('exist');
//
// // Analyze <ds-log-in> for accessibility issues
// testA11y('ds-log-in');
// });
// });
Loading

0 comments on commit 1c91c75

Please sign in to comment.