Skip to content

Commit

Permalink
Merge pull request #2000 from NationalSecurityAgency/t#1999/ci_failures
Browse files Browse the repository at this point in the history
T#1999/ci failures
  • Loading branch information
sudo-may authored Mar 1, 2023
2 parents 534fcf4 + f52cea4 commit a787573
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 193 deletions.
14 changes: 2 additions & 12 deletions e2e-tests/cypress/e2e/metrics/projectMetrics_achievements_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ describe('Metrics Tests - Achievements', () => {
});
});

it('overall levels - empty', {
retries: {
runMode: 0,
openMode: 0
}
}, () => {
it('overall levels - empty', () => {
cy.visit('/administrator/projects/proj1/');
cy.clickNav('Metrics');
cy.get('[data-cy=metricsNav-Achievements]')
Expand All @@ -51,12 +46,7 @@ describe('Metrics Tests - Achievements', () => {
.contains('No one reached Level 1 yet...');
});

it('overall levels - users in all levels', {
retries: {
runMode: 0,
openMode: 0
}
}, () => {
it('overall levels - users in all levels', () => {
cy.intercept('/admin/projects/proj1/metrics/numUsersPerLevelChartBuilder',
{
statusCode: 200,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ describe('Metrics Tests', () => {
});
});

it('subjects - num users per level over time - not subjects', {
retries: {
runMode: 0,
openMode: 0
}
}, () => {
it('subjects - num users per level over time - not subjects', () => {
cy.visit('/administrator/projects/proj1/');
cy.clickNav('Metrics');
cy.get('[data-cy=metricsNav-Subjects]')
Expand Down
137 changes: 62 additions & 75 deletions e2e-tests/cypress/e2e/metrics/skillMetrics_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,7 @@ describe('Metrics Tests - Skills', () => {
.contains(`This skill was last achieved on ${m.format('YYYY-MM-DD HH:mm')}`);
});

it('number of users over time', {
retries: {
runMode: 0,
openMode: 0
}
}, () => {
it('number of users over time', () => {
cy
.intercept('/admin/projects/proj1/metrics/numUserAchievedOverTimeChartBuilder**')
.as('singleSkillCountsChartBuilder');
Expand Down Expand Up @@ -280,12 +275,7 @@ describe('Metrics Tests - Skills', () => {
.contains('This chart needs at least 2 days of user activity');
});

it('number of users over time - 1 day', {
retries: {
runMode: 0,
openMode: 0
}
}, () => {
it('number of users over time - 1 day', () => {
cy
.intercept('/admin/projects/proj1/metrics/numUserAchievedOverTimeChartBuilder?skillId=skill1',
{
Expand Down Expand Up @@ -664,87 +654,84 @@ describe('Metrics Tests - Skills', () => {

});

it('number of users by tag', {
retries: {
runMode: 0,
openMode: 0
}
}, () => {
cy
.intercept('/admin/projects/proj1/metrics/skillAchievementsByTagBuilder**')
.as('skillAchievementsByTagBuilder');
if (!Cypress.env('oauthMode')) {
it('number of users by tag', () => {
cy
.intercept('/admin/projects/proj1/metrics/skillAchievementsByTagBuilder**')
.as('skillAchievementsByTagBuilder');

cy.request('POST', '/admin/projects/proj1/subjects/subj1', {
projectId: 'proj1',
subjectId: 'subj1',
name: 'Interesting Subject 1',
});

const numSkills = 1;
for (let skillsCounter = 1; skillsCounter <= numSkills; skillsCounter += 1) {
cy.request('POST', `/admin/projects/proj1/subjects/subj1/skills/skill${skillsCounter}`, {
cy.request('POST', '/admin/projects/proj1/subjects/subj1', {
projectId: 'proj1',
subjectId: 'subj1',
skillId: `skill${skillsCounter}`,
name: `Very Great Skill # ${skillsCounter}`,
pointIncrement: '1000',
numPerformToCompletion: '2',
name: 'Interesting Subject 1',
});
}
;

const m = moment.utc('2020-09-02 11', 'YYYY-MM-DD HH');
const numDays = 6;
const numSkills = 1;
for (let skillsCounter = 1; skillsCounter <= numSkills; skillsCounter += 1) {
cy.request('POST', `/admin/projects/proj1/subjects/subj1/skills/skill${skillsCounter}`, {
projectId: 'proj1',
subjectId: 'subj1',
skillId: `skill${skillsCounter}`,
name: `Very Great Skill # ${skillsCounter}`,
pointIncrement: '1000',
numPerformToCompletion: '2',
});
}
;

cy.fixture('vars.json')
.then((vars) => {
cy.login(vars.rootUser, vars.defaultPass);
});
const m = moment.utc('2020-09-02 11', 'YYYY-MM-DD HH');
const numDays = 6;

// Add users who achieved the skill
for (let dayCounter = 1; dayCounter <= numDays; dayCounter += 1) {
for (let userCounter = 1; userCounter <= dayCounter; userCounter += 1) {
const userId = `user-${userCounter}[email protected]`;
cy.fixture('vars.json')
.then((vars) => {
cy.login(vars.rootUser, vars.defaultPass);
});

cy.request('POST', `/api/projects/proj1/skills/skill1`,
{
userId: userId,
timestamp: m.clone()
// Add users who achieved the skill
for (let dayCounter = 1; dayCounter <= numDays; dayCounter += 1) {
for (let userCounter = 1; userCounter <= dayCounter; userCounter += 1) {
const userId = `user-${userCounter}[email protected]`;

cy.request('POST', `/api/projects/proj1/skills/skill1`,
{
userId: userId,
timestamp: m.clone()
.add(dayCounter, 'day')
.format('x')
});
});

cy.addUserTag(userId, 'tagA', ['ABCDE', 'DEFGH']);
cy.addUserTag(userId, 'tagA', ['ABCDE', 'DEFGH']);
}
}
}

// Add users in progress
for (let userCounter = numDays; userCounter <= 10; userCounter += 1) {
const userId = `user-${userCounter}[email protected]`;
// Add users in progress
for (let userCounter = numDays; userCounter <= 10; userCounter += 1) {
const userId = `user-${userCounter}[email protected]`;

cy.request('POST', `/api/projects/proj1/skills/skill1`,
{
userId: userId,
timestamp: m.clone()
cy.request('POST', `/api/projects/proj1/skills/skill1`,
{
userId: userId,
timestamp: m.clone()
.add(1, 'day')
.format('x')
});
});

cy.addUserTag(userId, 'tagA', ['ABCDE', 'DEFGH']);
}
cy.addUserTag(userId, 'tagA', ['ABCDE', 'DEFGH']);
}

cy.logout();
cy.fixture('vars.json')
.then((vars) => {
cy.login(vars.defaultUser, vars.defaultPass);
});
cy.logout();
cy.fixture('vars.json')
.then((vars) => {
cy.login(vars.defaultUser, vars.defaultPass);
});

cy.visit('/administrator/projects/proj1/subjects/subj1/skills/skill1');
cy.wait('@getConfig');
cy.clickNav('Metrics');
cy.wait('@skillAchievementsByTagBuilder');
cy.visit('/administrator/projects/proj1/subjects/subj1/skills/skill1');
cy.wait('@getConfig');
cy.clickNav('Metrics');
cy.wait('@skillAchievementsByTagBuilder');

cy.wait(waitForSnap);
cy.matchSnapshotImageForElement('[data-cy=numUsersByTag]');
});
cy.wait(waitForSnap);
cy.matchSnapshotImageForElement('[data-cy=numUsersByTag]');
});
}
});
Loading

0 comments on commit a787573

Please sign in to comment.