Skip to content

Commit

Permalink
e2e: updated to cypress 11
Browse files Browse the repository at this point in the history
  • Loading branch information
karolina-siemieniuk-morawska committed Aug 15, 2023
1 parent cf78b1c commit 01152fa
Show file tree
Hide file tree
Showing 84 changed files with 397 additions and 313 deletions.
26 changes: 26 additions & 0 deletions e2e/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
projectId: '439or1',
videosFolder: 'cypress/__videos__',
screenshotsFolder: 'cypress/__screenshots__',
env: {
inspirehep_url: 'localhost:3000',
desktop_viewport_width: 1920,
desktop_viewport_height: 1080,
mobile_viewport_width: 375,
mobile_viewport_height: 667,
},
retries: {
runMode: 2,
openMode: 0,
},
video: false,
e2e: {
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
experimentalRunAllSpecs: true
},
})
17 changes: 0 additions & 17 deletions e2e/cypress.json

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
import { onlyOn } from '@cypress/skip-test';
// TODO: remove `moment` to in favor of `Cypress.moment`
import moment from 'moment';

describe('Conference Detail', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/conferences/1217045?ui-citation-summary=true');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('ConferenceDetail');
});
});
});

describe('Conference Search', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
Expand All @@ -36,6 +23,18 @@ describe('Conference Search', () => {
});
});

describe('Conference Detail', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/conferences/1217045?ui-citation-summary=true');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('ConferenceDetail');
});
});
});

describe('Conference Editor', () => {
beforeEach(() => {
cy.login('cataloger');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
import { onlyOn } from '@cypress/skip-test';

describe('Experiment Search', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/experiments');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('ExperimentSearch');
});
});
});

describe('Experiment Detail', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/experiments/1513946?ui-citation-summary=true');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('ExperimentDetail');
});
});
});

describe('Experiment Submission', () => {
beforeEach(() => {
cy.login('cataloger');
Expand Down Expand Up @@ -35,27 +59,3 @@ describe('Experiment Submission', () => {
cy.logout();
});
});

describe('Experiment Search', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/experiments');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('ExperimentSearch');
});
});
});

describe('Experiment Detail', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/experiments/1513946?ui-citation-summary=true');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('ExperimentDetail');
});
});
});
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
import { onlyOn } from '@cypress/skip-test';

describe('Institution Search', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/institutions');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('InstitutionSearch');
});
});
});

describe('Institution Detail', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/institutions/902858?ui-citation-summary=true');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('InstitutionDetail');
});
});
});

describe('Institution Submission', () => {
beforeEach(() => {
cy.login('cataloger');
Expand Down Expand Up @@ -34,30 +58,6 @@ describe('Institution Submission', () => {
});
});

describe('Institution Search', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/institutions');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('InstitutionSearch');
});
});
});

describe('Institution Detail', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/institutions/902858?ui-citation-summary=true');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('InstitutionDetail');
});
});
});

describe('Institutions Editor', () => {
beforeEach(() => {
cy.login('cataloger');
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
import { onlyOn } from '@cypress/skip-test';

describe('Journal Detail', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/journals/1213103');
cy.waitForRoute();
cy.waitForSearchResults();
cy.waitForLoading();
cy.matchSnapshots('JournalDetail');
});
});
});

describe('Journal Search', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/journals');
cy.waitForRoute();
cy.waitForSearchResults();
cy.waitForLoading();
cy.matchSnapshots('JournalsSearch');
});
});
});

describe('Journal Submission', () => {
beforeEach(() => {
cy.login('cataloger');
Expand Down Expand Up @@ -34,26 +60,3 @@ describe('Journal Submission', () => {
cy.logout();
});
});

describe('Journal Detail', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/journals/1213103');
cy.waitForRoute();
cy.matchSnapshots('JournalDetail');
});
});
});

describe('Journal Search', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/journals');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('JournalsSearch');
});
});
});
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('References', () => {
'/literature?sort=mostrecent&size=25&page=1&q=citedby%3Arecid%3A1322719'
);
cy.waitForRoute();
cy.waitForLoading();
cy.matchSnapshots('LiteratureReferenceSearch');
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import { onlyOn } from '@cypress/skip-test';
import moment from 'moment';

describe('Seminar Detail', () => {
describe('Seminar Search', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/seminars/1799778');
cy.visit('/seminars?start_date=all');
cy.waitForRoute();
cy.matchSnapshots('SeminarDetail');
cy.waitForSearchResults();
cy.matchSnapshots('SeminarSearch');
});
});
});

describe('Seminar Search', () => {
describe('Seminar Detail', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.registerRoute();
cy.visit('/seminars?start_date=all');
cy.visit('/seminars/1799778');
cy.waitForRoute();
cy.waitForSearchResults();
cy.matchSnapshots('SeminarSearch');
cy.matchSnapshots('SeminarDetail');
});
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { onlyOn } from '@cypress/skip-test';

describe('settings', () => {
const email = `johnrellis@inspirehep.net`;

beforeEach(() => {
cy.login('johnellis');
cy.visit('/user/settings');
Expand All @@ -9,14 +11,14 @@ describe('settings', () => {
onlyOn('headless', () => {
it('matches image snapshot', () => {
cy.visit('/user/settings');
cy.wait(2000);
cy.matchSnapshots('Settings');
});
});

it('enables submit button when email is correct', () => {
const email = `johnrellis@inspirehep.net`;

cy.visit('/user/settings');
cy.wait(2000);

cy.get('[data-test-id=email]')
.clear()
Expand All @@ -26,13 +28,12 @@ describe('settings', () => {
});

it('should display validation error when email is incorrect', () => {
const email = `johnrellis@inspirehep`;

cy.visit('/user/settings');
cy.wait(2000);

cy.get('[data-test-id=email]')
.clear()
.type(email)
.type('johnrellis@inspirehep')
.blur();

cy.get('[data-test-id=email-error]').should('be.visible');
Expand All @@ -42,6 +43,7 @@ describe('settings', () => {
const recordId = 1010819;

cy.visit('/user/settings');
cy.wait(2000);

cy.get('[data-test-id="author-form"]').click();

Expand All @@ -50,30 +52,33 @@ describe('settings', () => {

it('exports to orcid', () => {
cy.visit('/user/settings');
cy.wait(2000);

cy.get('[data-test-id="orcid-switch"]').click();
cy.get('div[class~="ant-popconfirm"]').find('button[class~="ant-btn-primary"]').click();

cy.reload();
cy.wait(2000);

cy.get('[data-test-id="orcid-switch"]').should('have.attr', 'aria-checked', 'true');
});

it('unexports from orcid', () => {
cy.visit('/user/settings');
cy.wait(2000);

cy.get('[data-test-id="orcid-switch"]').click();
cy.get('div[class~="ant-popconfirm"]').find('button[class~="ant-btn-primary"]').click();

cy.reload();
cy.wait(2000);

cy.get('[data-test-id="orcid-switch"]').should('have.attr', 'aria-checked', 'false');
});

it('changes user email', () => {
const email = `johnrellis@inspirehep.net`;

cy.visit('/user/settings');
cy.wait(10000);

cy.registerRoute({
url: '/api/accounts/settings/update-email',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ describe('user', () => {
cy.window().trigger('mouseover', 'topRight');
cy.tick(1800000);
cy.clock().invoke('restore');
cy.wait(500);
cy.waitForLoading();
cy.matchSnapshots('SessionTimeout');
});
});
Expand Down
Loading

0 comments on commit 01152fa

Please sign in to comment.