Skip to content

Commit

Permalink
Merge branch 't#2460/oauth_ci' into t#2460/oauth_ci2
Browse files Browse the repository at this point in the history
  • Loading branch information
rmmayo committed Oct 26, 2023
2 parents 9e217ad + 13905da commit 766d9de
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 70 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build-and-test-oauth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,4 @@ jobs:
name: CI result artifacts
path: |
./e2e-tests/logs
./e2e-tests/cypress/snapshots/**/**/__diff_output__/*.png
./e2e-tests/cypress/snapshots/**/__diff_output__/*.png
./e2e-tests/cypress/visualRegression/diff
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-ssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
path: |
./service/target/*.log
./e2e-tests/logs
./e2e-tests/cypress/snapshots/*.js/__diff_output__/**
./e2e-tests/cypress/visualRegression/diff
2 changes: 1 addition & 1 deletion e2e-tests/cypress/e2e/accessibility/accessibility_specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,9 @@ describe('Accessibility Tests', () => {
cy.contains('No Levels Added Yet');
cy.customLighthouse();

cy.wait('@getAvailableProjects')
cy.get('#project-selector')
.click();
cy.wait('@getAvailableProjects')
cy.get('#project-selector .vs__dropdown-option')
.eq(0)
.click();
Expand Down
78 changes: 40 additions & 38 deletions e2e-tests/cypress/e2e/client-display/client-display-theme_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,44 +211,46 @@ describe('Client Display Tests', () => {
cy.matchSnapshotImage({ blackout: '[data-cy=pointHistoryChart]' });
});

it(`test theming - project rank - ${size}`, () => {
cy.setResolution(size);

cy.cdInitProjWithSkills();

const m = moment.utc('2020-09-12 11', 'YYYY-MM-DD HH');
for (let i = 0; i < 5; i += 1) {
cy.request('POST', `/api/projects/proj1/skills/skill1`, {
userId: `uniqueUser${i}`,
timestamp: m.clone()
.add(1, 'day')
.format('x')
});
cy.request('POST', `/api/projects/proj1/skills/skill1`, {
userId: `uniqueUser${i}`,
timestamp: m.clone()
.add(2, 'day')
.format('x')
});
}

cy.cdVisit('/?enableTheme=true&internalBackButton=true');

// back button - border color
cy.cdClickRank();
// THEME: "pageTitleTextColor": "#fdfbfb",
cy.get('[data-cy=back]')
.should('have.css', 'border-color')
.and('equal', 'rgb(253, 251, 251)');
cy.get('[data-cy=back]')
.should('have.css', 'color')
.and('equal', 'rgb(253, 251, 251)');

cy.contains('You are Level 2!');
// wait for the bar (on the bar chart) to render
cy.get('[data-cy="levelBreakdownChart-animationEnded"]');
cy.matchSnapshotImage({ blackout: '[data-cy=userFirstSeen]' });
});
if (!Cypress.env('oauthMode')) {
it(`test theming - project rank - ${size}`, () => {
cy.setResolution(size);

cy.cdInitProjWithSkills();

const m = moment.utc('2020-09-12 11', 'YYYY-MM-DD HH');
for (let i = 0; i < 5; i += 1) {
cy.request('POST', `/api/projects/proj1/skills/skill1`, {
userId: `uniqueUser${i}`,
timestamp: m.clone()
.add(1, 'day')
.format('x')
});
cy.request('POST', `/api/projects/proj1/skills/skill1`, {
userId: `uniqueUser${i}`,
timestamp: m.clone()
.add(2, 'day')
.format('x')
});
}

cy.cdVisit('/?enableTheme=true&internalBackButton=true');

// back button - border color
cy.cdClickRank();
// THEME: "pageTitleTextColor": "#fdfbfb",
cy.get('[data-cy=back]')
.should('have.css', 'border-color')
.and('equal', 'rgb(253, 251, 251)');
cy.get('[data-cy=back]')
.should('have.css', 'color')
.and('equal', 'rgb(253, 251, 251)');

cy.contains('You are Level 2!');
// wait for the bar (on the bar chart) to render
cy.get('[data-cy="levelBreakdownChart-animationEnded"]');
cy.matchSnapshotImage({blackout: '[data-cy=userFirstSeen]'});
});
}

it(`test theming - badge - ${size}`, () => {
cy.setResolution(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ describe('Learning Path Management Validation Tests', () => {
cy.get('[data-cy="learningPathToSkillSelector"]').contains('Badge 2');

cy.get('[data-cy="learningPathFromSkillSelector"]').click();
cy.get('[data-cy="skillsSelectionItem-proj1-skill5Subj2"]').click();
cy.get('[data-cy="skillsSelectionItem-proj1-skill5Subj2"]').first().click();

cy.get('[data-cy="learningPathFromSkillSelector"]').contains('Very Great Skill 5 Subj2');
cy.get('[data-cy="learningPathToSkillSelector"]').should('have.value', '');
Expand All @@ -434,7 +434,7 @@ describe('Learning Path Management Validation Tests', () => {
cy.get('[data-cy="learningPathError"]').contains('Badge 1 already exists in the learning path and adding it again will cause a circular/infinite learning path')

cy.get('[data-cy="learningPathFromSkillSelector"]').click();
cy.get('[data-cy="skillsSelectionItem-proj1-skill5Subj2"]').click();
cy.get('[data-cy="skillsSelectionItem-proj1-skill5Subj2"]').first().click();

cy.get('[data-cy="learningPathError"]').should('not.exist')
})
Expand All @@ -452,7 +452,7 @@ describe('Learning Path Management Validation Tests', () => {
cy.get('[data-cy="learningPathFromSkillSelector"]').click();
cy.get('[data-cy="skillsSelectionItem-proj1-badge2"]').click();
cy.get('[data-cy="learningPathToSkillSelector"]').click();
cy.get('[data-cy="skillsSelectionItem-proj1-badge1"]').click();
cy.get('[data-cy="skillsSelectionItem-proj1-badge1"]').first().click();

cy.get('[data-cy="addLearningPathItemBtn"]').should('be.disabled')
cy.get('[data-cy="learningPathError"]').contains('Badge 1 already exists in the learning path and adding it again will cause a circular/infinite learning path')
Expand Down
4 changes: 2 additions & 2 deletions e2e-tests/cypress/e2e/quiz/question_def_management_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,15 +614,15 @@ describe('Quiz Question CRUD Tests', () => {
cy.get('[data-cy="deleteQuestionButton_1"]')
.tab()
.type('{upArrow}');
cy.wait('@patchQuestion')
cy.get('.spinner-border').should('not.exist')
cy.validateElementsOrder('[data-cy="questionDisplayCard"]', ['question # 3', 'question # 2', 'question # 1']);

// attempt to move the top item - should not change anything
cy.log("Operation: 5")
cy.get('[data-cy="btn_Questions"]')
.tab()
.type('{upArrow}');
cy.wait('@patchQuestion')
cy.get('.spinner-border').should('not.exist')
cy.validateElementsOrder('[data-cy="questionDisplayCard"]', ['question # 3', 'question # 2', 'question # 1']);

cy.log("Reload")
Expand Down
41 changes: 23 additions & 18 deletions e2e-tests/cypress/e2e/skill-expiration-table_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@

const moment = require("moment-timezone");
describe('Expired Skill Table Tests', () => {

let proxyUser, userToValidate;
before(() => {
proxyUser = Cypress.env('proxyUser');
userToValidate = Cypress.env('oauthMode') ? 'foo' : proxyUser;
})

it('Expired skills show up in table', () => {
cy.createProject(1)
cy.createSubject(1, 1);
Expand All @@ -25,8 +30,8 @@ describe('Expired Skill Table Tests', () => {
cy.configureExpiration(1, 0, 1, 'DAILY');
const yesterday = moment.utc().subtract(1, 'day')
const twoDaysAgo = moment.utc().subtract(2, 'day')
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: Cypress.env('proxyUser'), date: yesterday.format('YYYY-MM-DD HH:mm') })
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: Cypress.env('proxyUser'), date: twoDaysAgo.format('YYYY-MM-DD HH:mm') })
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: proxyUser, date: yesterday.format('YYYY-MM-DD HH:mm') })
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: proxyUser, date: twoDaysAgo.format('YYYY-MM-DD HH:mm') })
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: "user1", date: yesterday.format('YYYY-MM-DD HH:mm') })
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: "user1", date: twoDaysAgo.format('YYYY-MM-DD HH:mm') })
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: "user2", date: yesterday.format('YYYY-MM-DD HH:mm') })
Expand Down Expand Up @@ -57,7 +62,7 @@ describe('Expired Skill Table Tests', () => {
value: 'Very Great Skill 1'
}, {
colIndex: 1,
value: 'user0'
value: userToValidate
}],
], 3);
});
Expand All @@ -70,8 +75,8 @@ describe('Expired Skill Table Tests', () => {
cy.configureExpiration(1, 0, 1, 'DAILY');
let yesterday = moment.utc().subtract(1, 'day')
let twoDaysAgo = moment.utc().subtract(2, 'day')
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: Cypress.env('proxyUser'), date: yesterday.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: Cypress.env('proxyUser'), date: twoDaysAgo.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: proxyUser, date: yesterday.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: proxyUser, date: twoDaysAgo.format('YYYY-MM-DD HH:mm') });

for(let x = 1; x < 20; x++) {
const user = "user" + x;
Expand Down Expand Up @@ -147,7 +152,7 @@ describe('Expired Skill Table Tests', () => {
cy.validateTable(tableSelector, [
[{
colIndex: 1,
value: 'user0'
value: userToValidate
}],
[{
colIndex: 1,
Expand Down Expand Up @@ -273,7 +278,7 @@ describe('Expired Skill Table Tests', () => {
}],
[{
colIndex: 1,
value: 'user0'
value: userToValidate
}],
], 10, true, 20);
});
Expand All @@ -286,8 +291,8 @@ describe('Expired Skill Table Tests', () => {
cy.configureExpiration(1, 0, 1, 'DAILY');
let yesterday = moment.utc().subtract(1, 'day')
let twoDaysAgo = moment.utc().subtract(2, 'day')
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: Cypress.env('proxyUser'), date: yesterday.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: Cypress.env('proxyUser'), date: twoDaysAgo.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: proxyUser, date: yesterday.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: proxyUser, date: twoDaysAgo.format('YYYY-MM-DD HH:mm') });

for(let x = 1; x < 5; x++) {
const user = "user" + x;
Expand Down Expand Up @@ -320,7 +325,7 @@ describe('Expired Skill Table Tests', () => {
cy.validateTable(tableSelector, [
[{
colIndex: 1,
value: 'user0'
value: userToValidate
}],
[{
colIndex: 1,
Expand Down Expand Up @@ -355,7 +360,7 @@ describe('Expired Skill Table Tests', () => {
cy.validateTable(tableSelector, [
[{
colIndex: 1,
value: 'user0'
value: userToValidate
}],
[{
colIndex: 1,
Expand Down Expand Up @@ -388,12 +393,12 @@ describe('Expired Skill Table Tests', () => {
cy.configureExpiration(3, 0, 1, 'DAILY');
let yesterday = moment.utc().subtract(1, 'day')
let twoDaysAgo = moment.utc().subtract(2, 'day')
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: Cypress.env('proxyUser'), date: yesterday.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: Cypress.env('proxyUser'), date: twoDaysAgo.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 2, subjNum: 1, userId: Cypress.env('proxyUser'), date: yesterday.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 2, subjNum: 1, userId: Cypress.env('proxyUser'), date: twoDaysAgo.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 3, subjNum: 1, userId: Cypress.env('proxyUser'), date: yesterday.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 3, subjNum: 1, userId: Cypress.env('proxyUser'), date: twoDaysAgo.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: proxyUser, date: yesterday.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 1, subjNum: 1, userId: proxyUser, date: twoDaysAgo.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 2, subjNum: 1, userId: proxyUser, date: yesterday.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 2, subjNum: 1, userId: proxyUser, date: twoDaysAgo.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 3, subjNum: 1, userId: proxyUser, date: yesterday.format('YYYY-MM-DD HH:mm') });
cy.doReportSkill({ project: 1, skill: 3, subjNum: 1, userId: proxyUser, date: twoDaysAgo.format('YYYY-MM-DD HH:mm') });

cy.expireSkills();

Expand Down
9 changes: 9 additions & 0 deletions e2e-tests/cypress/e2e/subjects_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,12 @@ describe('Subjects Tests', () => {
});

it('subject modal shows Root Help Url after it was update via UI', () => {

cy.intercept('GET', '/admin/projects/proj1/settings')
.as('loadSettings');
cy.intercept('POST', '/admin/projects/proj1/settings')
.as('saveSettings');

cy.createSubject(1, 2, {helpUrl: '/some/path'})
cy.createSubject(1, 3, {helpUrl: 'https://www.OverrideHelpUrl.com/other/path'})

Expand All @@ -984,8 +990,11 @@ describe('Subjects Tests', () => {
cy.get('[data-cy="closeSubjectButton"]').click();

cy.clickNav('Settings');
cy.wait('@loadSettings');
cy.get('[data-cy="rootHelpUrlInput"]').type('https://someCoolWebsite.com/');
cy.get('[data-cy="saveSettingsBtn"]').click();
cy.wait('@saveSettings');
cy.wait('@loadSettings');

cy.clickNav('Subjects');
cy.get('[data-cy="manageBtn_subj2"]').should('exist')
Expand Down
5 changes: 1 addition & 4 deletions e2e-tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -1416,8 +1416,5 @@ Cypress.Commands.add('expireSkills', () => {
cy.request('POST', `/root/runSkillExpiration`);

cy.logout();
cy.fixture('vars.json')
.then((vars) => {
cy.login(vars.defaultUser, vars.defaultPass);
});
cy.loginAsAdminUser();
});
2 changes: 1 addition & 1 deletion e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"verifyMathImageSnapshotIsNotUsed": "if find cypress/e2e/ -type f -exec grep -in \"matchImageSnapshot\" {} + ; then exit -1; else exit 0; fi",
"verifyThatNewSnapshotsAreNotCreated": "if git status | grep \"cypress/snapshots\" ; then exit -1; else exit 0; fi",
"cy:open": "TZ=UTC cypress open --env type=base",
"cy:open:oauth": "TZ=UTC cypress open --env oauthMode=true --env type=base",
"cy:open:oauth": "TZ=UTC cypress open --env oauthMode=true,type=base",
"cy:open:dev": "TZ=UTC cypress open --config baseUrl=http://localhost:8082 --env type=base",
"cy:open:devEST": "TZ=EST cypress open --config baseUrl=http://localhost:8082 --env type=base",
"cy:open:dev:oauth": "TZ=UTC cypress open --config baseUrl=http://localhost:8082 --env oauthMode=true,type=base",
Expand Down

0 comments on commit 766d9de

Please sign in to comment.