Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into 188127118-bar-graph…
Browse files Browse the repository at this point in the history
…-link
  • Loading branch information
bgoldowsky committed Sep 17, 2024
2 parents cb197c0 + 812c3c4 commit de397eb
Show file tree
Hide file tree
Showing 85 changed files with 766 additions and 501 deletions.
9 changes: 9 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
"console": "integratedTerminal",
"program": "${workspaceFolder}/node_modules/.bin/jest",
"args": ["${fileBasenameNoExtension}"]
},
{
"name": "Debug functions-v2 test",
"request": "launch",
"type": "node",
"console": "integratedTerminal",
"program": "${workspaceFolder}/functions-v2/node_modules/.bin/jest",
"args": ["${fileBasenameNoExtension}"],
"cwd": "${workspaceFolder}/functions-v2"
}
]
}
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ There are a number of URL parameters that can aid in testing:
|`fakeClass` |string |Class id for demo, qa, or test modes.|
|`fakeUser` |`(student\|teacher):<id>`|Configure user type and (optionally) id.|
|`qaGroup` |string |Group id for qa, e.g. automated tests.|
|`qaClear` |`all\|class\|offering` |Extent of database clearing for automated tests.|
|`firebase` |`emulator\|<URL>` |Target emulator for firebase realtime database calls.|
|`firestore` |`emulator\|<URL>` |Target emulator for firestore database calls.|
|`functions` |`emulator\|<URL>` |Target emulator-hosted firebase functions.|
Expand Down Expand Up @@ -183,11 +182,11 @@ The Standalone Document Editor also supports a `readOnly` url param. If you spec

### QA

Along with `dev`, `test`, `authed` and `demo` modes the app has a `qa` mode. QA mode uses the same parameters as demo mode with two additional parameters:
Along with `dev`, `test`, `authed` and `demo` modes the app has a `qa` mode. QA mode uses the same parameters as demo mode with one additional parameter:

1. qaGroup - the group to automatically assign the fake user to after connecting to the database.
2. qaClear - either "all", "class" or "offering". When this parameter is present the QA database is cleared at the level requested based on the user parameters.
This is useful to clear data between automated QA runs. When complete the app will display `<span className="qa-clear">QA Cleared: OK</span>`.
qaGroup - the group to automatically assign the fake user to after connecting to the database.

Additionally in `qa` mode the "root" in Firestore and the Realtime database is based on the Firebase user uid. This user is stored in session storage so each new tab will start a new root. In Cypress session storage is cleared between tests so each new test will have its own root.

### To run Cypress integration tests:
- `npm run test:local`
Expand All @@ -209,7 +208,6 @@ implementation simpler. Existing commands at the moment:

- setupGroup
- upLoadFile
- clearQAData

## License

Expand Down
4 changes: 0 additions & 4 deletions cypress/config/cypress.dev.json

This file was deleted.

3 changes: 2 additions & 1 deletion cypress/config/cypress.local.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"baseUrl": "http://localhost:8080/",
"hideXHRInCommandLog": true
"hideXHRInCommandLog": true,
"defaultCommandTimeout": 5000
}
7 changes: 3 additions & 4 deletions cypress/e2e/cleanup/remove_teacher_comment_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ function beforePortalTest(url, clueTeacher, reportUrl) {

function beforeTest() {
const queryParams = `${Cypress.config("qaUnitTeacher6Network")}`;
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
cy.openTopTab("problems");
Expand All @@ -78,7 +77,7 @@ describe('Delete Teacher Comments In chat panel', () => {
// Teacher 1 tile comment
chatPanel.deleteTeacherComments();
});

cy.log("login teacher2 and setup clue chat");
cy.logout(portalUrl);
beforePortalTest(portalUrl, clueTeacher2, reportUrl2);
Expand All @@ -93,7 +92,7 @@ describe('Delete Teacher Comments In chat panel', () => {
cy.clickProblemResourceTile(tab.sectionCode);
// Teacher 2 tile comment
chatPanel.deleteTeacherComments();
});
});
});
it('Delete chat panel comment tags', () => {
beforeTest();
Expand All @@ -102,7 +101,7 @@ describe('Delete Teacher Comments In chat panel', () => {
cy.openTopTab("problems");
cy.openProblemSection("Introduction");
chatPanel.deleteTeacherComments();

cy.log('Delete comment tags on tile comment');
cy.openTopTab("problems");
cy.clickProblemResourceTile('introduction');
Expand Down
7 changes: 3 additions & 4 deletions cypress/e2e/functional/document_tests/bookmark_test_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const queryParams1 = `${Cypress.config("qaConfigSubtabsUnitStudent5")}`;
const queryParams2 = `${Cypress.config("qaConfigSubtabsUnitTeacher1")}`;

function beforeTest(params) {
cy.clearQAData('all');
cy.visit(params);
cy.waitForLoad();
}
Expand Down Expand Up @@ -76,7 +75,7 @@ context('Bookmarks', function () {
// resourcesPanel.getCanvasStarIcon('class-work', 'workspaces', copyDocumentTitle).should('have.class', 'starred');
// cy.openSection('class-work', 'bookmarks');
// resourcesPanel.getCanvasItemTitle('class-work', 'bookmarks').contains(copyDocumentTitle).should('exist');
})
});
it('Test bookmarks for teacher', function () {
beforeTest(queryParams1);
let copyDocumentTitle = 'copy Investigation';
Expand Down Expand Up @@ -120,5 +119,5 @@ context('Bookmarks', function () {
resourcesPanel.getCanvasStarIcon('class-work', 'workspaces', title).should('have.class', 'starred');
cy.openSection('class-work', 'bookmarks');
resourcesPanel.getCanvasItemTitle('class-work', 'bookmarks').contains(title).should('exist');
})
})
});
});
1 change: 0 additions & 1 deletion cypress/e2e/functional/document_tests/canvas_test_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const queryParams4 = "?appMode=demo&demoName=BrokenDocs&fakeClass=1&fakeUser=stu
const title = "QA 1.1 Solving a Mystery with Proportional Reasoning";

function beforeTest(params) {
cy.clearQAData('all');
cy.visit(params);
cy.waitForLoad();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ let canvas = new Canvas;

function beforeTest() {
const queryParams = `${Cypress.config("qaUnitStudent5")}`;
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const exemplarName = "First Exemplar";
const exemplarInfo = "Ivan Idea: First Exemplar";

function beforeTest(params) {
cy.clearQAData('all');
cy.visit(params);
cy.waitForLoad();
}
Expand Down
6 changes: 0 additions & 6 deletions cypress/e2e/functional/document_tests/group_chooser_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ const defaultSetupOptions = {
problem
};

function beforeTest() {
cy.clearQAData('all');
}

function setup(student, opts = {}) {
const options = { ...defaultSetupOptions, ...opts };
cy.visit('/?appMode=qa&fakeClass=' + fakeClass + '&fakeUser=student:' + student + '&problem=' + options.problem + '&unit=./demo/units/qa/content.json');
Expand All @@ -40,8 +36,6 @@ function setup(student, opts = {}) {

context('Test student join a group', function () {
it('Test student join a group', function () {
beforeTest();

cy.log('Student 1 will join and will verify Join Group Dialog comes up with welcome message to correct student');
setup(student1);
cy.get('.app > .join > .join-title').should('contain', 'Join Group');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ context('Test group functionalities', function () {
it('4-up view read-only', function () {

cy.log('students to check each others tiles in 4-up view read-only');
cy.clearQAData('all');

setupTest(0);
setupTest(1);
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/functional/document_tests/group_test_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ context('Test group functionalities', function () {
it('4-up view tests', function () {

cy.log('will set up groups');
cy.clearQAData('all');
setupTest(0);
setupTest(1);
setupTest(2);
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/functional/document_tests/header_test_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const header = new Header;

function beforeTest() {
const queryParams = `${Cypress.config("qaUnitStudent5")}`;
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const queryParams4 = `${Cypress.config("qaNoSectionProblemTabUnitStudent5")}`;
const queryParams5 = `${Cypress.config("qaConfigSubtabsUnitStudent5")}`;

function beforeTest(params) {
cy.clearQAData('all');
cy.visit(params);
cy.waitForLoad();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ function setupTestBrain(studentIndex) {
context('Test 4-up and 1-up views tiles read only functionalities', function () {
it('4-up and 1-up views read-only text, table, geometry, drawing, expression, numberline, image, datacard tiles', function () {

cy.clearQAData('all');

setupTest(0);
setupTest(1);

Expand Down Expand Up @@ -174,8 +172,6 @@ context('Test 4-up and 1-up views tiles read only functionalities', function ()
});
it('4-up and 1-up views read-only dataflow, expression, xy plot tiles', function () {

cy.clearQAData('all');

setupTestBrain(0);
setupTestBrain(1);

Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/functional/document_tests/student_test_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ let student = '5',
group = '5';

function beforeTest(queryParams) {
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const tiles2 = [
];

function beforeTest(queryParams) {
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ let clueCanvas = new ClueCanvas,

function beforeTest() {
const queryParams = `${Cypress.config("qaUnitStudent5")}`;
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ function moveSliderTo(percent) {
}

function beforeTest(params) {
cy.clearQAData('all');
cy.visit(params);
cy.waitForLoad();
clueCanvas.getInvestigationCanvasTitle().text().then((investigationTitle) => {
Expand Down
2 changes: 0 additions & 2 deletions cypress/e2e/functional/teacher_tests/teacher_chat_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const ss = [{ "section": "problems",
const comment = [ "This is document comment for ", "This is tile comment for " ];

function beforeTest(params) {
cy.clearQAData('all');
cy.visit(params);
cy.waitForLoad();
cy.openTopTab("problems");
Expand All @@ -44,7 +43,6 @@ function beforeTest(params) {
}

function beforeTestCommentedDocumentList(params) {
cy.clearQAData('all');
cy.visit(params);
cy.waitForLoad();
cy.openTopTab("my-work");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const defaultProblemDocTitle = "QA 1.1 Solving a Mystery with Proportional Reaso

function beforeTest() {
const queryParams = `${Cypress.config("clueTestqaUnitTeacher6")}`;
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
dashboard.switchView("Workspace & Resources");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ let dashboard = new TeacherDashboard();

function beforeTest() {
const queryParams = `${Cypress.config("clueTestqaUnitTeacher6")}`;
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
dashboard.switchView("Dashboard");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ let clueCanvas = new ClueCanvas;

function beforeTest() {
const queryParams = `${Cypress.config("clueTestqaUnitTeacher6")}`;
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
dashboard.switchView("Dashboard");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ let teacherNetwork = new TeacherNetwork;

function beforeTest() {
const queryParams = `${Cypress.config("clueTestqaUnitTeacher6")}`;
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
dashboard.switchView("Workspace & Resources");
Expand Down
58 changes: 26 additions & 32 deletions cypress/e2e/functional/teacher_tests/teacher_share_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const teacherQueryParams = `${Cypress.config("qaConfigSubtabsUnitTeacher1")}`;
const studentQueryParams = `${Cypress.config("qaConfigSubtabsUnitStudent5")}`;

function beforeTest(params) {
cy.clearQAData('all');
cy.visit(params);
cy.waitForLoad();
dashboard.switchView("Workspace & Resources");
Expand All @@ -23,48 +22,43 @@ function verifySwitch(publicOrPrivate) {
function verifyStudentSeesAsPrivate() {
cy.get('.tab-sort-work').click();
cy.get('.section-header-arrow').click({multiple: true});
cy.get('.thumbnail-private').should('exist');
cy.contains('[data-test="sort-work-list-items"]','Teacher 1:')
.should('have.descendants', '.thumbnail-private');
}

function verifyStudentSeesAsPublic() {
cy.get('.tab-sort-work').click();
cy.get('.section-header-arrow').click({multiple: true});
cy.get('.thumbnail-public').should('not.exist');
cy.contains('[data-test="sort-work-list-items"]','Teacher 1:')
.should('not.have.descendants', '.thumbnail-private');
}

context('Teacher Sharing', function() {
describe('verify share functionality', function() {
it('loads teacher document as private', function() {
beforeTest(teacherQueryParams);
verifySwitch('private');
});
it('verify share functionality', function() {
cy.log('loads teacher document as private');
beforeTest(teacherQueryParams);
verifySwitch('private');

// TODO: Reinstate the tests below when all metadata documents have the new fields and are updated in real time.
it.skip('does not allow student to access private teacher document', function() {
cy.visit(studentQueryParams);
cy.waitForLoad();
verifyStudentSeesAsPrivate();
});
cy.log('does not allow student to access private teacher document');
cy.visit(studentQueryParams);
cy.waitForLoad();
verifyStudentSeesAsPrivate();

it('allows teacher to share a document', function() {
cy.visit(teacherQueryParams);
cy.waitForLoad();
clueCanvas.shareCanvas();
verifySwitch('public');
});
cy.log('allows teacher to share a document');
cy.visit(teacherQueryParams);
cy.waitForLoad();
clueCanvas.shareCanvas();
verifySwitch('public');

// TODO: Reinstate the tests below when all metadata documents have the new fields and are updated in real time.
it.skip('allows student to access public teacher document', function() {
cy.visit(studentQueryParams);
cy.waitForLoad();
verifyStudentSeesAsPublic();
});
cy.log('allows student to access public teacher document');
cy.visit(studentQueryParams);
cy.waitForLoad();
verifyStudentSeesAsPublic();

it('allows teacher to unshare a document', function() {
cy.visit(teacherQueryParams);
cy.waitForLoad();
clueCanvas.unshareCanvas();
verifySwitch('private');
});
cy.log('allows teacher to unshare a document');
cy.visit(teacherQueryParams);
cy.waitForLoad();
clueCanvas.unshareCanvas();
verifySwitch('private');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ let dashboard = new TeacherDashboard();

function beforeTest() {
const queryParams = `${Cypress.config("clueTestqaUnitTeacher6")}`;
cy.clearQAData('all');
cy.visit(queryParams);
cy.waitForLoad();
dashboard.switchView("Dashboard");
Expand Down
Loading

0 comments on commit de397eb

Please sign in to comment.