Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Port dspace-7_x] Upgrade to Cypress 13.15.0 #3398

Merged
merged 6 commits into from
Oct 9, 2024
Merged
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
1 change: 1 addition & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'cypress';

export default defineConfig({
video: true,
videosFolder: 'cypress/videos',
screenshotsFolder: 'cypress/screenshots',
fixturesFolder: 'cypress/fixtures',
Expand Down
24 changes: 24 additions & 0 deletions cypress/e2e/item-edit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ describe('Edit Item > Edit Metadata tab', () => {
it('should pass accessibility tests', () => {
cy.get('a[data-test="metadata"]').click();

// Our selected tab should be active
cy.get('a[data-test="metadata"]').should('have.class', 'active');

// <ds-edit-item-page> tag must be loaded
cy.get('ds-edit-item-page').should('be.visible');

Expand All @@ -33,6 +36,9 @@ describe('Edit Item > Status tab', () => {
it('should pass accessibility tests', () => {
cy.get('a[data-test="status"]').click();

// Our selected tab should be active
cy.get('a[data-test="status"]').should('have.class', 'active');

// <ds-item-status> tag must be loaded
cy.get('ds-item-status').should('be.visible');

Expand All @@ -46,6 +52,9 @@ describe('Edit Item > Bitstreams tab', () => {
it('should pass accessibility tests', () => {
cy.get('a[data-test="bitstreams"]').click();

// Our selected tab should be active
cy.get('a[data-test="bitstreams"]').should('have.class', 'active');

// <ds-item-bitstreams> tag must be loaded
cy.get('ds-item-bitstreams').should('be.visible');

Expand All @@ -70,6 +79,9 @@ describe('Edit Item > Curate tab', () => {
it('should pass accessibility tests', () => {
cy.get('a[data-test="curate"]').click();

// Our selected tab should be active
cy.get('a[data-test="curate"]').should('have.class', 'active');

// <ds-item-curate> tag must be loaded
cy.get('ds-item-curate').should('be.visible');

Expand All @@ -83,6 +95,9 @@ describe('Edit Item > Relationships tab', () => {
it('should pass accessibility tests', () => {
cy.get('a[data-test="relationships"]').click();

// Our selected tab should be active
cy.get('a[data-test="relationships"]').should('have.class', 'active');

// <ds-item-relationships> tag must be loaded
cy.get('ds-item-relationships').should('be.visible');

Expand All @@ -96,6 +111,9 @@ describe('Edit Item > Version History tab', () => {
it('should pass accessibility tests', () => {
cy.get('a[data-test="versionhistory"]').click();

// Our selected tab should be active
cy.get('a[data-test="versionhistory"]').should('have.class', 'active');

// <ds-item-version-history> tag must be loaded
cy.get('ds-item-version-history').should('be.visible');

Expand All @@ -109,6 +127,9 @@ describe('Edit Item > Access Control tab', () => {
it('should pass accessibility tests', () => {
cy.get('a[data-test="access-control"]').click();

// Our selected tab should be active
cy.get('a[data-test="access-control"]').should('have.class', 'active');

// <ds-item-access-control> tag must be loaded
cy.get('ds-item-access-control').should('be.visible');

Expand All @@ -122,6 +143,9 @@ describe('Edit Item > Collection Mapper tab', () => {
it('should pass accessibility tests', () => {
cy.get('a[data-test="mapper"]').click();

// Our selected tab should be active
cy.get('a[data-test="mapper"]').should('have.class', 'active');

// <ds-item-collection-mapper> tag must be loaded
cy.get('ds-item-collection-mapper').should('be.visible');

Expand Down
64 changes: 32 additions & 32 deletions cypress/e2e/login-modal.cy.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
import { testA11y } from 'cypress/support/utils';

const page = {
openLoginMenu() {
// Click the "Log In" dropdown menu in header
cy.get('ds-themed-header [data-test="login-menu"]').click();
},
openUserMenu() {
// Once logged in, click the User menu in header
cy.get('ds-themed-header [data-test="user-menu"]').click();
},
submitLoginAndPasswordByPressingButton(email, password) {
// Enter email
cy.get('ds-themed-header [data-test="email"]').type(email);
// Enter password
cy.get('ds-themed-header [data-test="password"]').type(password);
// Click login button
cy.get('ds-themed-header [data-test="login-button"]').click();
},
submitLoginAndPasswordByPressingEnter(email, password) {
// In opened Login modal, fill out email & password, then click Enter
cy.get('ds-themed-header [data-test="email"]').type(email);
cy.get('ds-themed-header [data-test="password"]').type(password);
cy.get('ds-themed-header [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-header [data-test="logout-button"]').click();
// Wait until above POST command responds before continuing
// (This ensures next action waits until logout completes)
cy.wait('@logout');
}
openLoginMenu() {
// Click the "Log In" dropdown menu in header
cy.get('[data-test="login-menu"]').click();
},
openUserMenu() {
// Once logged in, click the User menu in header
cy.get('[data-test="user-menu"]').click();
},
submitLoginAndPasswordByPressingButton(email, password) {
// Enter email
cy.get('[data-test="email"]').type(email);
// Enter password
cy.get('[data-test="password"]').type(password);
// Click login button
cy.get('[data-test="login-button"]').click();
},
submitLoginAndPasswordByPressingEnter(email, password) {
// In opened Login modal, fill out email & password, then click Enter
cy.get('[data-test="email"]').type(email);
cy.get('[data-test="password"]').type(password);
cy.get('[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('[data-test="logout-button"]').click();
// Wait until above POST command responds before continuing
// (This ensures next action waits until logout completes)
cy.wait('@logout');
},
};

describe('Login Modal', () => {
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('Login Modal', () => {

// Login, and the <ds-log-in> tag should no longer exist
page.submitLoginAndPasswordByPressingEnter(Cypress.env('DSPACE_TEST_ADMIN_USER'), Cypress.env('DSPACE_TEST_ADMIN_PASSWORD'));
cy.get('.form-login').should('not.exist');
cy.get('ds-log-in').should('not.exist');

// Verify we are still on homepage
cy.url().should('include', '/home');
Expand Down
12 changes: 6 additions & 6 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ Cypress.Commands.add('login', login);
* @param password password to login as
*/
function loginViaForm(email: string, password: string): void {
// Enter email
cy.get('ds-log-in [data-test="email"]').type(email);
// Enter password
cy.get('ds-log-in [data-test="password"]').type(password);
// Click login button
cy.get('ds-log-in [data-test="login-button"]').click();
// Enter email
cy.get('[data-test="email"]').type(email);
// Enter password
cy.get('[data-test="password"]').type(password);
// Click login button
cy.get('[data-test="login-button"]').click();
}
// Add as a Cypress command (i.e. assign to 'cy.loginViaForm')
Cypress.Commands.add('loginViaForm', loginViaForm);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
"compression-webpack-plugin": "^9.2.0",
"copy-webpack-plugin": "^6.4.1",
"cross-env": "^7.0.3",
"cypress": "12.17.4",
"cypress-axe": "^1.4.0",
"cypress": "^13.15.0",
"cypress-axe": "^1.5.0",
"deep-freeze": "0.0.1",
"eslint": "^8.39.0",
"eslint-plugin-deprecation": "^1.4.1",
Expand Down
Loading
Loading