Skip to content

Commit e4da6d0

Browse files
committed
fix teacher share cypress test
- the teacher was added to a group (teachers aren't supposed to be in groups - the sort group sections weren't loaded before being expanded
1 parent 01448c3 commit e4da6d0

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

cypress.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default defineConfig({
2828
qaUnitTeacher6Network: "/?appMode=qa&fakeClass=5&fakeUser=teacher:6&problem=1.1&unit=./demo/units/qa/content.json&network=foo",
2929
qaNoGroupShareUnitStudent5: "/?appMode=qa&fakeClass=5&fakeUser=student:5&qaGroup=5&problem=1.1&unit=./demo/units/qa-no-group-share/content.json",
3030
qaConfigSubtabsUnitStudent5: "/?appMode=qa&fakeClass=5&fakeUser=student:5&qaGroup=5&problem=1.1&unit=./demo/units/qa-config-subtabs/content.json",
31-
qaConfigSubtabsUnitTeacher1: "/?appMode=qa&fakeClass=5&fakeUser=teacher:1&qaGroup=5&problem=1.1&unit=./demo/units/qa-config-subtabs/content.json",
31+
qaConfigSubtabsUnitTeacher1: "/?appMode=qa&fakeClass=5&fakeUser=teacher:1&problem=1.1&unit=./demo/units/qa-config-subtabs/content.json",
3232
qaNoNavPanelUnitStudent5: "/?appMode=qa&fakeClass=5&fakeUser=student:5&qaGroup=5&problem=1.1&unit=./demo/units/qa-no-nav-panel/content.json",
3333
qaVariablesUnitStudent5: "/?appMode=qa&fakeClass=5&fakeUser=student:5&qaGroup=5&problem=1.1&unit=./demo/units/qa-variables/content.json",
3434
qaShowNavPanelUnitStudent5: "/?appMode=qa&fakeClass=5&fakeUser=student:5&qaGroup=5&problem=1.1&unit=./demo/units/qa-show-nav-panel/content.json",

cypress/e2e/functional/teacher_tests/teacher_share_spec.js

+7
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,22 @@ function verifySwitch(publicOrPrivate) {
1919
clueCanvas.getShareButton().should('have.class', publicOrPrivate);
2020
}
2121

22+
function verifySectionsAreLoaded() {
23+
cy.get('.section-header-label').should("contain", "Group 5");
24+
cy.get('.section-header-label').should("contain", "No Group");
25+
}
26+
2227
function verifyStudentSeesAsPrivate() {
2328
cy.get('.tab-sort-work').click();
29+
verifySectionsAreLoaded();
2430
cy.get('.section-header-arrow').click({multiple: true});
2531
cy.contains('[data-test="sort-work-list-items"]','Teacher 1:')
2632
.should('have.descendants', '.thumbnail-private');
2733
}
2834

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

src/components/app.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function resolveAppMode(
2222
stores: IStores,
2323
rawFirebaseJWT: string | undefined
2424
) {
25-
const { appMode, db, ui} = stores;
25+
const { appMode, db, ui, user} = stores;
2626
if (appMode === "authed") {
2727
if (rawFirebaseJWT) {
2828
return db.connect({appMode, stores, rawFirebaseJWT}).catch(error => ui.setError(error));
@@ -34,7 +34,8 @@ function resolveAppMode(
3434
else {
3535
return db.connect({appMode, stores})
3636
.then(() => {
37-
if (appMode === "qa") {
37+
// Only students can be part of groups
38+
if (appMode === "qa" && user.isStudent) {
3839
const {qaGroup} = urlParams;
3940
if (qaGroup) {
4041
db.leaveGroup().then(() => db.joinGroup(qaGroup));

0 commit comments

Comments
 (0)