-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix part of #3954 - LearnerDashboardPage.js #4138
Changes from 1 commit
3eb5ecd
191a1ed
268a80e
111b314
19bc125
4f4f6e9
9603377
00ced47
4c3195c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,9 +60,16 @@ describe('Learner dashboard functionality', function() { | |
browser.waitForAngular(); | ||
element(by.css('.protractor-test-create-activity')).click(); | ||
// Create new collection. | ||
learnerDashboardPage.createExploration(); | ||
element(by.css('.protractor-test-create-collection')).click(); | ||
browser.waitForAngular(); | ||
learnerDashboardPage.publishExploration(); | ||
collectionEditor.addExistingExploration('14'); | ||
collectionEditor.saveDraft(); | ||
collectionEditor.closeSaveModal(); | ||
collectionEditor.publishCollection(); | ||
collectionEditor.setTitle('Test Collection'); | ||
collectionEditor.setObjective('This is a test collection.'); | ||
collectionEditor.setCategory('Algebra'); | ||
collectionEditor.saveChanges(); | ||
browser.waitForAngular(); | ||
users.logout(); | ||
}); | ||
|
@@ -90,7 +97,7 @@ describe('Learner dashboard functionality', function() { | |
player.submitAnswer('Continue', null); | ||
learnerDashboardPage.get(); | ||
browser.waitForAngular(); | ||
learnerDashboardPage.completedProfileTest(); | ||
learnerDashboardPage.navigateToCompletedSection(); | ||
browser.waitForAngular(); | ||
libraryPage.expectExplorationToBeVisible('About Oppia'); | ||
users.logout(); | ||
|
@@ -131,11 +138,11 @@ describe('Learner dashboard functionality', function() { | |
browser.waitForAngular(); | ||
general.waitForSystem(); | ||
browser.ignoreSynchronization = false; | ||
learnerDashboardPage.incompleteCollectionSection(); | ||
learnerDashboardPage.navigateToIncompleteCollection(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. navigateToIncompleteCollectionSection (you're navigating to a section, not to a collection) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ya, I thought about this, but thought name might become too long. Will change that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
browser.waitForAngular(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be better to put these browser.waitForAngular() calls at the end of their respective functions in the page object, if they're always going to be called. This will also help simplify the main protractor test. Ditto for general.waitForSystem(), where relevant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there are are other calls to learnerDashboardPage that are repeating for all such instances, shall I put it inside page object also? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I don't understand. Could you elaborate / give an example? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. after both instances of navigateToIncompleteCollectionsSection(), expectTitleOfSummaryTileToMatch() is called, so can I put this call as this.expectTitleOfSummaryTileToMatch() inside the navigateToIncompleteCollectionsSection() function? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see. No, don't do that. The way to think about this is that these are the actions a user would do. A user wouldn't really be doing stuff at the level of "wait for angular". But they may take the actions "navigate" and "expect title to match" independently, so these should be independent actions in the page object. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, thanks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
general.waitForSystem(); | ||
expect( | ||
learnerDashboardPage.summaryTile() | ||
learnerDashboardPage.openSummaryTile() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. open...() doesn't have a connotation of "return a value". Maybe it should be "getTitleOfSummaryTile()" or similar, though that's just an example -- you'd need to check what exactly is being retrieved here and include that in the method name. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that is what is being retrieved here, will change that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
).toMatch('Test Collection'); | ||
|
||
// Go to the test collection. | ||
|
@@ -157,14 +164,14 @@ describe('Learner dashboard functionality', function() { | |
learnerDashboardPage.get(); | ||
browser.waitForAngular(); | ||
general.waitForSystem(); | ||
learnerDashboardPage.completedProfileTest(); | ||
learnerDashboardPage.navigateToCompletedSection(); | ||
browser.waitForAngular(); | ||
general.waitForSystem(); | ||
learnerDashboardPage.completedCollectionSection(); | ||
learnerDashboardPage.navigateToCompletedCollection(); | ||
browser.waitForAngular(); | ||
general.waitForSystem(); | ||
expect( | ||
learnerDashboardPage.summaryTile() | ||
learnerDashboardPage.openSummaryTile() | ||
).toMatch('Test Collection'); | ||
users.logout(); | ||
|
||
|
@@ -192,11 +199,11 @@ describe('Learner dashboard functionality', function() { | |
learnerDashboardPage.get(); | ||
browser.waitForAngular(); | ||
general.waitForSystem(); | ||
learnerDashboardPage.incompleteCollectionSection(); | ||
learnerDashboardPage.navigateToIncompleteCollection(); | ||
browser.waitForAngular(); | ||
general.waitForSystem(); | ||
expect( | ||
learnerDashboardPage.summaryTile() | ||
learnerDashboardPage.openSummaryTile() | ||
).toMatch('Test Collection'); | ||
users.logout(); | ||
}); | ||
|
@@ -207,17 +214,17 @@ describe('Learner dashboard functionality', function() { | |
// Subscribe to both the creators. | ||
browser.get('/profile/creator1learnerDashboard'); | ||
browser.waitForAngular(); | ||
learnerDashboardPage.clickSubscriptionButton(); | ||
element(by.css('.protractor-test-subscription-button')).click(); | ||
browser.get('/profile/creator2learnerDashboard'); | ||
browser.waitForAngular(); | ||
learnerDashboardPage.clickSubscriptionButton(); | ||
element(by.css('.protractor-test-subscription-button')).click(); | ||
|
||
// Both creators should be present in the subscriptions section of the | ||
// dashboard. | ||
learnerDashboardPage.get(); | ||
browser.waitForAngular(); | ||
general.waitForSystem(); | ||
element(by.css('.protractor-test-subscriptions-section')).click(); | ||
learnerDashboardPage.navigateToSubscriptionsSection(); | ||
browser.waitForAngular(); | ||
expect(element.all(by.css( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this stuff should also be factored into the learner dashboard page? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As it was just after a learnerDashboard.get(), I assumed it to be a part of learner dashboard itself. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the point I was making, though. If it's part of the learner dashboard page, shouldn't it be refactored into the LearnerDashboardPage object? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, thats what I did. Is there something more? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I'm saying is that this line ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, ok, will add that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
'.protractor-test-subscription-name')).first().getText()).toMatch( | ||
|
@@ -241,7 +248,7 @@ describe('Learner dashboard functionality', function() { | |
player.submitFeedback(feedback); | ||
learnerDashboardPage.get(); | ||
browser.waitForAngular(); | ||
element(by.css('.protractor-test-feedback-section')).click(); | ||
learnerDashboardPage.navigateToFeedbackSection(); | ||
browser.waitForAngular(); | ||
expect(element.all(by.css( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also seems like something that should be part of the LearnerDashboardPage object? Basically, anything that involves fiddling around with elements should be part of the page object, so that the protractor test itself doesn't have to mess around with the details. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I added that in the learnerDashboardPage object already. Is there something else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's done, or rather, if it is, then this line should be learnerDashboardPage.something(...). See previous comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, saw it, will add that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
'.protractor-test-feedback-exploration')).first().getText()).toMatch( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,57 +21,46 @@ var collectionEditor = require('./collectionEditor.js'); | |
|
||
var LearnerDashboardPage = function() { | ||
var LEARNER_DASHBOARD_URL = '/learner_dashboard'; | ||
var subscriptionButton = | ||
element(by.css('.protractor-test-subscription-button')); | ||
var dashboardLink = element(by.css('.protractor-test-dashboard-link')); | ||
var createCollection = element(by.css('.protractor-test-create-collection')); | ||
var profileTestCompleted = | ||
var completedSection = | ||
element(by.css('.protractor-test-completed-section')); | ||
var feedbackSection = | ||
element(by.css('.protractor-test-feedback-section')); | ||
var completedCollection = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are sections; their names should end with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, will change those. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
element(by.css('.protractor-test-completed-collection-section')); | ||
var incompleteCollection = | ||
element(by.css('.protractor-test-incomplete-collection-section')); | ||
var summary = | ||
var subscriptionsSection = | ||
element(by.css('.protractor-test-subscriptions-section')); | ||
var summaryTile = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the tile, or its title? The CSS name doesn't seem to match the variable name. It's important to be precise when naming, otherwise developers will get confused. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, misread the name, will change that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
element.all(by.css('.protractor-test-collection-summary-tile-title')); | ||
|
||
this.get = function() { | ||
return browser.get(LEARNER_DASHBOARD_URL); | ||
}; | ||
|
||
this.clickSubscriptionButton = function() { | ||
subscriptionButton.click(); | ||
this.navigateToCompletedSection = function() { | ||
completedSection.click(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing semicolons, here and below. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, didn't see those. Will add them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
|
||
this.createExploration = function() { | ||
createCollection.click(); | ||
this.navigateToIncompleteCollection = function() { | ||
incompleteCollection.click(); | ||
} | ||
|
||
this.completedProfileTest = function() { | ||
profileTestCompleted.click(); | ||
this.navigateToCompletedCollection = function() { | ||
completedCollection.click(); | ||
} | ||
|
||
this.incompleteCollectionSection = function() { | ||
incompleteCollection.click(); | ||
this.navigateToFeedbackSection = function() { | ||
feedbackSection.click(); | ||
} | ||
|
||
this.completedCollectionSection = function() { | ||
completedCollection.click(); | ||
this.navigateToSubscriptionsSection = function() { | ||
subscriptionsSection.click(); | ||
} | ||
|
||
this.summaryTile = function() { | ||
return summary.first().getText(); | ||
this.openSummaryTile = function() { | ||
return summaryTile.first().getText(); | ||
} | ||
|
||
this.publishExploration = function() { | ||
collectionEditor.addExistingExploration('14'); | ||
collectionEditor.saveDraft(); | ||
collectionEditor.closeSaveModal(); | ||
collectionEditor.publishCollection(); | ||
collectionEditor.setTitle('Test Collection'); | ||
collectionEditor.setObjective('This is a test collection.'); | ||
collectionEditor.setCategory('Algebra'); | ||
collectionEditor.saveChanges(); | ||
}; | ||
}; | ||
|
||
exports.LearnerDashboardPage = LearnerDashboardPage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to check -- is this completed collections, completed explorations, or something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think its a section of completed explorations and collections. In LearnerDashboard.js, of /learner_dashboard it is called above the subsection that calls both of them.