Skip to content

Commit

Permalink
Merge pull request #1845 from NationalSecurityAgency/t#1810/cypress_u…
Browse files Browse the repository at this point in the history
…pgrade

T#1810/cypress upgrade
  • Loading branch information
rmmayo authored Nov 28, 2022
2 parents f50e67d + b8d67e3 commit 152be69
Show file tree
Hide file tree
Showing 119 changed files with 67 additions and 131 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ jobs:
parallel: true
group: 'skills-service tests'
tag: "${{ github.workflow }}"
browser: chrome
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
Expand Down
49 changes: 37 additions & 12 deletions e2e-tests/cypress/e2e/accessibility_specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,40 +620,65 @@ describe('Accessibility Tests', () => {
cy.customA11y();
});

it('settings', () => {

it('settings - profile', () => {
cy.logout();
cy.login('[email protected]', 'password');
cy.visit('/settings');
cy.contains('First Name');
cy.injectAxe();
cy.get('[data-cy="generalSettingsSave"]');
cy.customLighthouse();
cy.customA11y();
})

cy.get('[data-cy="nav-Preferences"]')
.click();
cy.contains('Preferences');

it('settings - preferences', () => {
cy.logout();
cy.login('[email protected]', 'password');
cy.visit('/settings/preferences');
cy.injectAxe();
cy.get('[data-cy="userPrefsSettingsSave"]');
cy.customLighthouse();
cy.customA11y();
})

cy.get('[data-cy=nav-Security]')
.click();
cy.contains('Root Users Management');

it('settings - security', () => {
cy.logout();
cy.login('[email protected]', 'password');
cy.visit('/settings/security');
cy.injectAxe();
cy.get('[data-cy="addUserBtn"]')
cy.get('[data-cy="supervisorrm"]')
.contains('There are no records to show');
cy.customLighthouse();
cy.customA11y();
})

cy.get('[data-cy=nav-Email]')
.click();
it('settings - email', () => {
cy.logout();
cy.login('[email protected]', 'password');
cy.visit('/settings/email');
cy.injectAxe();
cy.contains('Email Connection Settings');
cy.contains('TLS Disabled');
cy.contains('Public URL');
cy.get('[data-cy="emailSettingsTest"]')
cy.customLighthouse();
cy.customA11y();
});

cy.get('[data-cy=nav-System]')
.click();
it('settings - system', () => {
cy.intercept('GET', '/root/getSystemSettings')
.as('getSettings');
cy.logout();
cy.login('[email protected]', 'password');
cy.visit('/settings/system');
cy.wait('@getSettings')
cy.contains('Token Expiration');
cy.get('[data-cy="resetTokenExpiration"]').should('have.value', '2H')
cy.get('[data-cy="saveSystemSettings"]')
cy.injectAxe();
cy.customLighthouse();
cy.customA11y();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ describe('Single Skill and Catalog Tests', () => {
.css('height', `${$el1.height()}px`);
});
});

cy.matchSnapshotImageForElement('[data-cy=subjectCards]', 'Subject Cards one with disabled skill one without');
});

it('drill down to a skill after creation', () => {
Expand Down
9 changes: 9 additions & 0 deletions e2e-tests/cypress/e2e/discoverable_proj_invite_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ describe('Copy Invite URL Tests', () => {
const proj1Share = `${proj1Url}?invited=true`

it('retrieve share url', () => {
// this is needed to grant headless chrome permissions to copy-and-paste
cy.wrap(Cypress.automation('remote:debugger:protocol', {
command: 'Browser.grantPermissions',
params: {
permissions: ['clipboardReadWrite', 'clipboardSanitizedWrite'],
origin: window.location.origin,
},
}))

cy.visit('/administrator/projects/proj1')
cy.contains('No Subjects Yet')
cy.location().then((loc) => {
Expand Down
34 changes: 0 additions & 34 deletions e2e-tests/cypress/e2e/my-progress_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,40 +377,6 @@ describe('Navigation Tests', () => {
.should('have.text', 'Project: This is project 1');
});

it('material icons should be proper size', () => {
cy.loginAsRootUser();
const globalBadge1 = {
badgeId: `globalBadge1`,
isEdit: false,
name: `Global Badge 1`,
originalBadgeId: '',
iconClass: 'mi mi-live-tv',
enabled: true,
description: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
};
cy.request('PUT', `/supervisor/badges/globalBadge1`, globalBadge1);
cy.assignSkillToGlobalBadge(1, 2);
cy.enableGlobalBadge(1, globalBadge1);

cy.loginAsRootUser();
cy.request('POST', `/api/projects/proj1/skills/skill2`, {
userId: Cypress.env('proxyUser'),
timestamp: yesterday
});
cy.request('POST', `/api/projects/proj1/skills/skill2`, {
userId: Cypress.env('proxyUser'),
timestamp: testTime
});

cy.loginAsProxyUser();

cy.visit('/progress-and-rankings/');
cy.get('[data-cy=viewBadges]')
.click();
cy.matchSnapshotImageForElement('[data-cy=myBadges]', 'my-badges-material-icon', {
blackout: ['[data-cy=dateBadgeAchieved]'],
});
});

it('My Badges filtering', () => {
cy.loginAsRootUser();
Expand Down
11 changes: 0 additions & 11 deletions e2e-tests/cypress/e2e/navigation_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,5 @@ describe('Navigation Tests', () => {
.should('not.visible');
});

it('navigation menu should be right aligned on small screen', () => {
// exhibited bug was that collapsing the menu before resizing the screen resulted in incorrect layout of the menu button
cy.visit('/administrator/projects/proj1');
cy.get('[data-cy=navCollapseOrExpand]')
.click();
cy.viewport('iphone-6');
cy.get('[data-cy=nav-col]')
.should('be.visible');
cy.matchSnapshotImageForElement('[data-cy="nav-col"]', 'small-screen-nav-menu');
});

});

1 change: 0 additions & 1 deletion e2e-tests/cypress/e2e/projects_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ describe('Projects Tests', () => {
cy.wait(2000);
cy.get('[data-cy="pageHeader"] .container-fluid')
.should('have.length', 1);
cy.matchSnapshotImageForElement('[data-cy="pageHeader"]');

cy.get('[data-cy=pageHeaderStat]')
.first()
Expand Down
3 changes: 2 additions & 1 deletion e2e-tests/cypress/e2e/projects_table_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ describe('Projects Table Tests', () => {
/* focus is automatically getting switched back to the edit button which pre-emptively moves the cursor out of the text input field before
before the full text has been entered depending on test timing
*/
cy.wait(350);
cy.wait(600);
cy.get('[data-cy="projectsTable-projectFilter"]').should('be.enabled')
cy.get('[data-cy="projectsTable-projectFilter"]')
.type('Changed');
cy.get('[data-cy="projectsTable-filterBtn"]')
Expand Down
27 changes: 0 additions & 27 deletions e2e-tests/cypress/e2e/skills_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,33 +998,6 @@ describe('Skills Tests', () => {
cy.contains('http://fake/fake/fake.fake').should('be.visible');
});

it('skill name should not wrap prematurely', () => {
cy.request('POST', `/admin/projects/proj1/subjects/subj1/skills/areallylongsubjectnamethatmaywraptoosoonSkill`, {
projectId: 'proj1',
subjectId: 'subj1',
skillId: 'areallylongsubjectnamethatmaywraptoosoonSkill',
name: `a really long subject name that may wrap too soon`,
type: 'Skill',
pointIncrement: 100,
numPerformToCompletion: 5,
pointIncrementInterval: 0,
numMaxOccurrencesIncrementInterval: 1,
description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
version: 1,
helpUrl: 'http://doHelpOnThisSkill.com'
});
cy.intercept('GET', '/admin/projects/proj1/subjects/subj1/skills/areallylongsubjectnamethatmaywraptoosoonSkill').as('loadSkill1');

// resolutions over 1280 are ignored in headless mode so we can only test at this resolution
cy.setResolution([1280, 900]);
cy.wait(200);
cy.visit('/administrator/projects/proj1/subjects/subj1/skills/areallylongsubjectnamethatmaywraptoosoonSkill/');
cy.wait('@loadSkill1');

cy.matchSnapshotImageForElement('[data-cy=pageHeader]', 'No Premature Name Wrap')
});


it('skill help url with %20 in path retains %20 on edit', () => {
cy.request('POST', `/admin/projects/proj1/subjects/subj1/skills/dummy`, {
projectId: 'proj1',
Expand Down
24 changes: 0 additions & 24 deletions e2e-tests/cypress/e2e/skills_table_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,29 +653,5 @@ describe('Skills Table Tests', () => {

});

it('long skill id row controls wrap to the right', () => {
cy.viewport(1500, 900);
cy.log('creating new skill');
cy.request('POST', '/admin/projects/proj1/subjects/subj1/skills/MaximumWidthPainBreakingControlLayoutForReal1Skill', {
projectId: 'proj1',
subjectId: "subj1",
skillId: "MaximumWidthPainBreakingControlLayoutForReal1Skill",
name: "MaximumWidthPainBreakingControlLayoutForReal1 1",
pointIncrement: '50',
numPerformToCompletion: '5'
});
cy.intercept('GET', '/admin/projects/proj1/subjects/subj1/skills').as('loadSkills');

cy.log('visiting subj1 page');
cy.visit('/administrator/projects/proj1/subjects/subj1');
cy.wait('@loadSkills');

//wait for loading
cy.log('matchSnapshot');
cy.matchSnapshotImageForElement('.skills-b-table tbody tr:first-of-type td:first-of-type', 'skillsTableFullsize')
cy.viewport(1000, 900);
cy.wait(400);
cy.matchSnapshotImageForElement('.skills-b-table tbody tr:first-of-type td:first-of-type', 'skillsTableSmaller')
});
});

1 change: 0 additions & 1 deletion e2e-tests/cypress/e2e/subjects_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,6 @@ describe('Subjects Tests', () => {
cy.get('[data-cy=pageHeaderStat]').first().invoke('width').then((val)=>{
cy.get('[data-cy=pageHeaderStat]').eq(1).invoke('width').should('eq', val);
});
cy.matchSnapshotImageForElement('[data-cy=pageHeader]', 'No Premature Name Wrap')
});

it('subject modal shows Root Help Url when configured', () => {
Expand Down
Binary file not shown.
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.
Diff not rendered.
Diff not rendered.
2 changes: 1 addition & 1 deletion e2e-tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ Cypress.Commands.add('customLighthouse', () => {
cy.lighthouse({
"performance": 0,
"accessibility": 90,
"best-practices": 85,
"best-practices": 80,
"seo": 0,
"pwa": 0
}, {}, lighthouseOptions);
Expand Down
34 changes: 17 additions & 17 deletions e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
"cy:open": "cypress open",
"cy:open:postgres": "TZ=UTC cypress open --env db=postgres",
"cy:open:oauth": "TZ=UTC cypress open --env oauthMode=true",
"cy:open:dev": "TZ=UTC cypress open --config baseUrl=http://localhost:8082 --env failOnSnapshotDiff=false",
"cy:open:devEST": "TZ=EST cypress open --config baseUrl=http://localhost:8082 --env failOnSnapshotDiff=false",
"cy:open:dev:postgres": "TZ=UTC cypress open --config baseUrl=http://localhost:8082 --env db=postgres,failOnSnapshotDiff=false",
"cy:open:dev:oauth": "TZ=UTC cypress open --config baseUrl=http://localhost:8082 --env oauthMode=true failOnSnapshotDiff=false",
"cy:open:dev:verifyEmail": "TZ=UTC cypress open --config baseUrl=http://localhost:8082 --env verifyEmail=true failOnSnapshotDiff=false",
"cy:run": "TZ=UTC npm run licenseCheck && cypress run",
"cy:run:postgres": "TZ=UTC npm run licenseCheck && cypress run --env db=postgres",
"cy:run:oauth": "TZ=UTC npm run licenseCheck && cypress run --env oauthMode=true",
"cy:run:accessibility": "TZ=UTC npm run licenseCheck && cypress run --config experimentalRunEvents=true --browser chrome --headless --spec \"cypress/e2e/accessibility*.js,cypress/e2e/client-display/client-display_accessibility.js\"",
"cy:run:dev": "TZ=UTC cypress run --config baseUrl=http://localhost:8082",
"cy:run:dev:specificTest": "TZ=UTC cypress run --config baseUrl=http://localhost:8082 --spec \"cypress/e2e/skills-display-integration_spec.js\"",
"cy:run:dev:metrics": "TZ=UTC cypress run --config baseUrl=http://localhost:8082 --env customSnapshotsDir=./cypress/snapshots/metrics --spec \"cypress/e2e/metrics/multipleProjectMetrics_spec.js\"",
"cy:run:dev:clientDisplay": "TZ=UTC cypress run --config baseUrl=http://localhost:8082 --env customSnapshotsDir=./cypress/snapshots/client-display --spec \"cypress/e2e/client-display/client-display-skills_filtering_spec.js\"",
"cy:open:dev": "TZ=UTC cypress open --config baseUrl=http://localhost:8082",
"cy:open:devEST": "TZ=EST cypress open --config baseUrl=http://localhost:8082",
"cy:open:dev:postgres": "TZ=UTC cypress open --config baseUrl=http://localhost:8082 --env db=postgres",
"cy:open:dev:oauth": "TZ=UTC cypress open --config baseUrl=http://localhost:8082 --env oauthMode=true",
"cy:open:dev:verifyEmail": "TZ=UTC cypress open --config baseUrl=http://localhost:8082 --env verifyEmail=true",
"cy:run": "TZ=UTC npm run licenseCheck && cypress run --browser chrome",
"cy:run:postgres": "TZ=UTC npm run licenseCheck && cypress run --browser chrome --env db=postgres",
"cy:run:oauth": "TZ=UTC npm run licenseCheck && cypress run --browser chrome --env oauthMode=true",
"cy:run:accessibility": "TZ=UTC npm run licenseCheck && cypress run --browser chrome --config experimentalRunEvents=true --browser chrome --headless --spec \"cypress/e2e/accessibility*.js,cypress/e2e/client-display/client-display_accessibility.js\"",
"cy:run:dev": "TZ=UTC cypress run --browser chrome --config baseUrl=http://localhost:8082",
"cy:run:dev:specificTest": "TZ=UTC cypress run --browser chrome --config baseUrl=http://localhost:8082 --spec \"cypress/e2e/discoverable_proj_invite_spec.js\"",
"cy:run:dev:metrics": "TZ=UTC cypress run --browser chrome --config baseUrl=http://localhost:8082 --env customSnapshotsDir=./cypress/snapshots/metrics --spec \"cypress/e2e/metrics/*\"",
"cy:run:dev:clientDisplay": "TZ=UTC cypress run --browser chrome --config baseUrl=http://localhost:8082 --env customSnapshotsDir=./cypress/snapshots/client-display --spec \"cypress/e2e/client-display/client-display-deps-chart_spec.js\"",
"cy:run:dev:accessibility": "TZ=UTC cypress run --browser chrome --headless --config baseUrl=http://localhost:8082 --spec cypress/e2e/accessibility*.js",
"cy:run:dev:postgres": "TZ=UTC cypress run --config baseUrl=http://localhost:8082 --env db=postgres",
"cy:run:dev:oauth": "TZ=UTC cypress run --config baseUrl=http://localhost:8082 --env oauthMode=true",
"cy:run:dev:postgres": "TZ=UTC cypress run --browser chrome --config baseUrl=http://localhost:8082 --env db=postgres",
"cy:run:dev:oauth": "TZ=UTC cypress run --browser chrome --config baseUrl=http://localhost:8082 --env oauthMode=true",
"cy:verify": "cypress verify",
"backend:start": "java -Dspring.config.location=classpath:/application.yml,file:serverConfigs/backend_application.properties -jar ../service/target/skills-service-*.jar",
"backend:start:verifyEmail": "java -Dspring.config.location=classpath:/application.yml,file:serverConfigs/backend_application.properties -Dskills.authorization.verifyEmailAddresses=true -jar ../service/target/skills-service-*.jar",
Expand Down Expand Up @@ -82,13 +82,13 @@
"@bahmutov/print-env": "2.1.2",
"axe-core": "4.4.3",
"badge-maker": "3.3.1",
"cypress": "10.6.0",
"cypress": "11.2.0",
"cypress-audit": "1.1.0",
"cypress-axe": "1.0.0",
"cypress-file-upload": "5.0.8",
"cypress-image-snapshot": "4.0.1",
"cypress-plugin-tab": "1.0.5",
"cypress-real-events": "1.7.1",
"cypress-real-events": "1.7.4",
"cypress-wait-until": "1.7.2",
"dayjs": "1.10.4",
"eslint": "7.9.0",
Expand Down

0 comments on commit 152be69

Please sign in to comment.