Skip to content

Commit

Permalink
Merge pull request #995 from bcgov/bugs/atFix2
Browse files Browse the repository at this point in the history
AT fixes and Addition of EDX-1251
  • Loading branch information
SodhiA1 authored Aug 25, 2023
2 parents 33120b1 + 3708831 commit 0410aef
Show file tree
Hide file tree
Showing 8 changed files with 378 additions and 129 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@

<v-row justify="space-between">
<v-col cols="4">
<span class="bold">Students Found: {{ totalElements }} </span>
<span
id="studentsFound"
class="bold"
>Students Found: {{ totalElements }} </span>
<v-icon
small
class="ml-1"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import selectors from "../../support/selectors";
import { AppSetupData } from '../../../cypress.config';
import { SchoolCollection } from "tests-e2e/cypress/services/sdc-collection-api-service";

describe('SDC School Collection View', () => {
context('As an EDX School User', () => {
before(() => {
cy.task<AppSetupData>('dataLoad').then(res => {
cy.task<SchoolCollection>('setup-collections', {
school: res.school,
loadWithStudentAndValidations: true,
seedData: 'stepThreeSeedData'
});
cy.task<SchoolUserOptions, EdxUserEntity>('setup-schoolUser', { schoolCodes: ['99998'] });
});
});
after(() => cy.logout());
beforeEach(() => cy.login());

it('can load dashboard & click data collection card & process collection', () => {
cy.visit('/');
cy.get(selectors.dashboard.title).contains('Dashboard | EDX Automation Testing School');
cy.get(selectors.dashboard.dataCollectionsTileTitle).contains('Data Collections');
cy.get(selectors.dashboard.dataCollectionsTile).click();
cy.get(selectors.dataCollectionsLanding.title).should('exist').contains('Student Level Data (1701) | EDX Automation Testing School');
cy.get(selectors.dataCollectionsLanding.continue).contains('Continue').click();
cy.get(selectors.studentLevelData.nextButton).click();
cy.get(selectors.studentLevelData.nextButton).click();
cy.get(selectors.studentLevelData.nextButton).click();
cy.get(selectors.studentLevelData.nextButton).click();

// Step five of collection - school contacts
cy.get(selectors.schoolContacts.subjectHeading).contains('99899998 - EDX Automation Testing School');
cy.get(selectors.schoolContacts.newContactButton).click();
cy.get(selectors.schoolContacts.newContactTypeDropdown).parent().click();
cy.get(selectors.schoolContacts.listItem).contains('Principal').click();
cy.get(selectors.schoolContacts.newContactLastNameInput).type('Fake Principal');
cy.get(selectors.schoolContacts.newContactEmailInput).type('fake@gmail.com');
cy.get(selectors.schoolContacts.newContactPhoneNumberInput).type('1231231234');
cy.get(selectors.schoolContacts.newContactEffectiveDateTextField).click();
cy.get(selectors.schoolContacts.newContactCalendar).contains('Select').click();
cy.get(selectors.schoolContacts.newContactPostBtn).click();
cy.get(selectors.snackbar.mainSnackBar).should('contain', 'Success! The school contact has been created.');
});

});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import selectors from "../../support/selectors";
import { AppSetupData } from '../../../cypress.config';
import { SchoolCollection } from "tests-e2e/cypress/services/sdc-collection-api-service";

describe('SDC School Collection View', () => {
context('As an EDX School User', () => {
before(() => {
cy.task<AppSetupData>('dataLoad').then(res => {
cy.task<SchoolCollection>('setup-collections', {
school: res.school,
loadWithStudentAndValidations: true,
seedData: 'stepThreeSeedData'
});
cy.task<SchoolUserOptions, EdxUserEntity>('setup-schoolUser', { schoolCodes: ['99998'] });
});
});
after(() => cy.logout());
beforeEach(() => cy.login());

it('can load dashboard & click data collection card & process collection', () => {
cy.visit('/');
cy.get(selectors.dashboard.title).contains('Dashboard | EDX Automation Testing School');
cy.get(selectors.dashboard.dataCollectionsTileTitle).contains('Data Collections');
cy.get(selectors.dashboard.dataCollectionsTile).click();
cy.get(selectors.dataCollectionsLanding.title).should('exist').contains('Student Level Data (1701) | EDX Automation Testing School');
cy.get(selectors.dataCollectionsLanding.continue).contains('Continue').click();
cy.get(selectors.studentLevelData.nextButton).click();
cy.get(selectors.studentLevelData.nextButton).click();

// Step four of collection - school details
cy.get(selectors.studentLevelData.nextButton).click();
cy.get(selectors.schoolDetails.schoolMincodeTitle).contains('99899998');
cy.get(selectors.schoolDetails.schoolDisplayNameTitle).contains('EDX Automation Testing School');
cy.get(selectors.schoolDetails.editButton).click();
cy.get(selectors.schoolDetails.schoolDetailsEmail).clear();
cy.get(selectors.schoolDetails.schoolDetailsPhoneNumber).clear();
cy.get(selectors.studentLevelData.formHint).contains('Address, phone, and/or email must be added');
cy.get(selectors.studentLevelData.nextButton).should('be.disabled');
cy.get(selectors.schoolDetails.schoolDetailsEmail).type('fake@gmail.com');
cy.get(selectors.schoolDetails.schoolDetailsPhoneNumber).type('1234567890');
cy.get(selectors.schoolDetails.saveButton).click();
cy.get(selectors.schoolDetails.resolveBtn).click();
});

});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import selectors from "../../support/selectors";
import { AppSetupData } from '../../../cypress.config';
import { SchoolCollection } from "tests-e2e/cypress/services/sdc-collection-api-service";

describe('SDC School Collection View', () => {
context('As an EDX School User', () => {
before(() => {
cy.task<AppSetupData>('dataLoad').then(res => {
cy.task<SchoolCollection>('setup-collections', {
school: res.school,
loadWithStudentAndValidations: true,
seedData: 'stepThreeSeedData'
});
cy.task<SchoolUserOptions, EdxUserEntity>('setup-schoolUser', { schoolCodes: ['99998'] });
});
});
after(() => cy.logout());
beforeEach(() => cy.login());

it('can load dashboard & click data collection card & process collection', () => {
cy.intercept(Cypress.env('interceptors').collection_students_pagination).as('pagination');

cy.visit('/');
cy.get(selectors.dashboard.title).contains('Dashboard | EDX Automation Testing School');
cy.get(selectors.dashboard.dataCollectionsTileTitle).contains('Data Collections');
cy.get(selectors.dashboard.dataCollectionsTile).click();
cy.get(selectors.dataCollectionsLanding.title).should('exist').contains('Student Level Data (1701) | EDX Automation Testing School');
cy.get(selectors.dataCollectionsLanding.continue).contains('Continue').click();

// Step three of collection - edit/verify data
cy.get(selectors.studentLevelData.nextButton).click();
});

it('verifies FTE for Reported Students', () => {
cy.intercept(Cypress.env('interceptors').collection_students_pagination).as('pagination');
cy.visit('/');
cy.get(selectors.dashboard.dataCollectionsTile).click();
cy.get(selectors.dataCollectionsLanding.continue).contains('Continue').click();

// Step three of collection - edit/verify data
cy.get(selectors.studentLevelData.nextButton).click();
cy.get(selectors.studentLevelData.studentsFound).should('exist').contains(2);

cy.get('.td-data').each(cell => {
const cellText = cell.text()
if (cellText === '1' || cellText === '0.875') {
cy.log('Correct fte value expected')
}
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ describe('SDC School Collection View', () => {
cy.task<AppSetupData>('dataLoad').then(res => {
cy.task<SchoolCollection>('setup-collections', {
school: res.school,
loadWithStudentAndValidations: true
loadWithStudentAndValidations: true,
seedData: 'stepTwoSeedData'
});
cy.task<SchoolUserOptions, EdxUserEntity>('setup-schoolUser', { schoolCodes: ['99998'] });
});
Expand Down
70 changes: 9 additions & 61 deletions tests-e2e/cypress/e2e/sdc-collection/sdcSchoolCollectionView.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,92 +6,40 @@ describe('SDC School Collection View', () => {
context('As an EDX School User', () => {
before(() => {
cy.task<AppSetupData>('dataLoad').then(res => {
cy.task<SchoolCollection>('setup-collections',{
cy.task<SchoolCollection>('setup-collections', {
school: res.school,
loadWithStudentAndValidations: false} );
loadWithStudentAndValidations: true,
seedData: 'stepThreeSeedData'
});
cy.task<SchoolUserOptions, EdxUserEntity>('setup-schoolUser', { schoolCodes: ['99998'] });
});
});
after(() => cy.logout());
beforeEach(() => cy.login());

it('can load dashboard & click data collection card & process collection', () => {
it('can return to previous step in collection', () => {
cy.visit('/');
cy.get(selectors.dashboard.title).contains('Dashboard | EDX Automation Testing School');
cy.get(selectors.dashboard.dataCollectionsTileTitle).contains('Data Collections');
cy.get(selectors.dashboard.dataCollectionsTile).click();
cy.get(selectors.dataCollectionsLanding.title).should('exist').contains('Student Level Data (1701) | EDX Automation Testing School');
cy.get(selectors.dataCollectionsLanding.continue).contains('Continue').click();

//step one of collection
cy.get(selectors.studentLevelData.documentUploadButton).click();
cy.get(selectors.documentUpload.selectFileInput).selectFile('./cypress/uploads/sample-2-student-fnchars.std', {force: true});
cy.get(selectors.dataCollectionsLanding.title).should('exist').contains('Student Level Data (1701) | EDX Automation Testing School');

// Timeout exception made since time to upload is variable depending on the file size and format.
cy.get(selectors.snackbar.mainSnackBar, {timeout: 10000}).contains('Your document was uploaded successfully.');
cy.get(selectors.studentLevelData.nextButton, {timeout: 15000}).should('exist').click();

// step two of collection - review and fix data
cy.get(selectors.studentLevelData.nextButton).click();

//step three of collection - edit/verify data
cy.get(selectors.studentLevelData.nextButton).click();

// step four of collection
cy.get(selectors.schoolDetails.schoolMincodeTitle).contains('99899998');
cy.get(selectors.schoolDetails.schoolDisplayNameTitle).contains('EDX Automation Testing School');
cy.get(selectors.schoolDetails.editButton).click();
cy.get(selectors.schoolDetails.schoolDetailsEmail).clear();
cy.get(selectors.schoolDetails.schoolDetailsPhoneNumber).clear();
cy.get(selectors.studentLevelData.formHint).contains('Address, phone, and/or email must be added');
cy.get(selectors.studentLevelData.nextButton).should('be.disabled');
cy.get(selectors.schoolDetails.schoolDetailsEmail).type('fake@gmail.com');
cy.get(selectors.schoolDetails.schoolDetailsPhoneNumber).type('1234567890');
cy.get(selectors.schoolDetails.saveButton).click();
cy.get(selectors.schoolDetails.resolveBtn).click();
cy.get(selectors.studentLevelData.nextButton).click();

//step five of collection
cy.get(selectors.schoolContacts.subjectHeading).contains('99899998 - EDX Automation Testing School');
cy.get(selectors.schoolContacts.newContactButton).click();
cy.get(selectors.schoolContacts.newContactTypeDropdown).parent().click();
cy.get(selectors.schoolContacts.listItem).contains('Principal').click();
cy.get(selectors.schoolContacts.newContactLastNameInput).type('Fake Principal');
cy.get(selectors.schoolContacts.newContactEmailInput).type('fake@gmail.com');
cy.get(selectors.schoolContacts.newContactPhoneNumberInput).type('1231231234');
cy.get(selectors.schoolContacts.newContactEffectiveDateTextField).click();
cy.get(selectors.schoolContacts.newContactCalendar).contains('Select').click();
cy.get(selectors.schoolContacts.newContactPostBtn).click();
cy.get(selectors.studentLevelData.nextButton).click();

});

it('can return to previous step in collection', () => {
cy.visit('/');
cy.get(selectors.dashboard.dataCollectionsTile).click();
cy.get(selectors.dataCollectionsLanding.continue).contains('Continue').click();

//step one of collection - upload file
cy.get(selectors.studentLevelData.documentUploadButton).click();
cy.get(selectors.documentUpload.selectFileInput).selectFile('./cypress/uploads/sample-2-student-fnchars.std', {force: true});
cy.get(selectors.dataCollectionsLanding.title).should('exist').contains('Student Level Data (1701) | EDX Automation Testing School');
cy.get(selectors.studentLevelData.nextButton, {timeout: 15000}).should('exist').should('be.enabled').click();

// step two of collection - review and fix data
cy.get(selectors.studentLevelData.nextButton).should('exist').should('be.enabled').click();

//step three of collection - edit/verify data
cy.get(selectors.studentLevelData.nextButton).should('exist').should('be.enabled').click();

// checking if the previous button is clickable and the user is taken to the previous step; brings to step 2
cy.get(selectors.studentLevelData.stepTwo).should('exist').should('be.enabled').click();
cy.get(selectors.studentLevelData.stepTwo).should('exist').click();

// Step three should be disabled
cy.get(selectors.studentLevelData.stepThree).should('exist').should('be.disabled');
cy.get(selectors.studentLevelData.stepThree).should('exist').should('not.be.enabled');

// User moved to next step by clicking next button
cy.get(selectors.studentLevelData.nextButton).should('exist').should('be.enabled').click();
cy.get(selectors.studentLevelData.nextButton).should('exist').should('be.enabled');
cy.get(selectors.studentLevelData.nextButton).click();

});
});
Expand Down
Loading

0 comments on commit 0410aef

Please sign in to comment.