Skip to content

Commit

Permalink
Merge pull request #3315 from tdonohue/upgrade_cypress
Browse files Browse the repository at this point in the history
Upgrade to Cypress 13.15.0
  • Loading branch information
tdonohue authored Oct 9, 2024
2 parents c1cc9ba + b4d932a commit d7ff9c3
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 52 deletions.
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 @@ -20,6 +20,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 @@ -38,6 +41,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 @@ -51,6 +57,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 @@ -75,6 +84,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 @@ -88,6 +100,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 @@ -101,6 +116,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 @@ -114,6 +132,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 @@ -127,6 +148,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
20 changes: 10 additions & 10 deletions cypress/e2e/login-modal.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ import { testA11y } from 'cypress/support/utils';
const page = {
openLoginMenu() {
// Click the "Log In" dropdown menu in header
cy.get('ds-header [data-test="login-menu"]').click();
cy.get('[data-test="login-menu"]').click();
},
openUserMenu() {
// Once logged in, click the User menu in header
cy.get('ds-header [data-test="user-menu"]').click();
cy.get('[data-test="user-menu"]').click();
},
submitLoginAndPasswordByPressingButton(email, password) {
// Enter email
cy.get('ds-header [data-test="email"]').type(email);
cy.get('[data-test="email"]').type(email);
// Enter password
cy.get('ds-header [data-test="password"]').type(password);
cy.get('[data-test="password"]').type(password);
// Click login button
cy.get('ds-header [data-test="login-button"]').click();
cy.get('[data-test="login-button"]').click();
},
submitLoginAndPasswordByPressingEnter(email, password) {
// In opened Login modal, fill out email & password, then click Enter
cy.get('ds-header [data-test="email"]').type(email);
cy.get('ds-header [data-test="password"]').type(password);
cy.get('ds-header [data-test="password"]').type('{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('ds-header [data-test="logout-button"]').click();
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');
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
6 changes: 3 additions & 3 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ Cypress.Commands.add('login', login);
*/
function loginViaForm(email: string, password: string): void {
// Enter email
cy.get('ds-log-in [data-test="email"]').type(email);
cy.get('[data-test="email"]').type(email);
// Enter password
cy.get('ds-log-in [data-test="password"]').type(password);
cy.get('[data-test="password"]').type(password);
// Click login button
cy.get('ds-log-in [data-test="login-button"]').click();
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
76 changes: 39 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,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

0 comments on commit d7ff9c3

Please sign in to comment.