From 6facee95f54b57917fa4e1d36c73db6b5a547640 Mon Sep 17 00:00:00 2001 From: ANSINGH Date: Wed, 19 Jul 2023 15:35:15 -0700 Subject: [PATCH] addes AT for stage 3 uploading 1701 file --- .../sdcSchoolCollectionView.cy.ts | 32 +++++++++++++------ tests-e2e/cypress/support/selectors.ts | 12 +++---- .../uploads/sample-2-student-fnchars.std | 4 +++ 3 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 tests-e2e/cypress/uploads/sample-2-student-fnchars.std diff --git a/tests-e2e/cypress/e2e/sdc-collection/sdcSchoolCollectionView.cy.ts b/tests-e2e/cypress/e2e/sdc-collection/sdcSchoolCollectionView.cy.ts index 77fe72c78..a55b98ce5 100644 --- a/tests-e2e/cypress/e2e/sdc-collection/sdcSchoolCollectionView.cy.ts +++ b/tests-e2e/cypress/e2e/sdc-collection/sdcSchoolCollectionView.cy.ts @@ -1,5 +1,6 @@ import selectors from "../../support/selectors"; import { AppSetupData } from '../../../cypress.config'; +import {timeout} from "rxjs"; describe('SDC School Collection View', () => { context('As an EDX School User', () => { @@ -14,28 +15,28 @@ describe('SDC School Collection View', () => { 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.title).contains('Dashboard | EDX Automation Test School'); cy.get(selectors.dashboard.dataCollectionsTileTitle).contains('Data Collections'); cy.get(selectors.dashboard.dataCollectionsTile).click(); - cy.get(selectors.dataCollectionsLanding.title).contains('Student Level Data (1701) | EDX Automation Testing School'); + cy.get(selectors.dataCollectionsLanding.title).contains('Student Level Data (1701) | EDX Automation Test School'); cy.get(selectors.dataCollectionsLanding.continue).contains('Continue').click(); //step one of collection cy.get(selectors.schoolDetails.schoolMincodeTitle).contains('99899998'); - cy.get(selectors.schoolDetails.schoolDisplayNameTitle).contains('EDX Automation Testing School') - cy.get(selectors.stepOneSchoolDetails.formHint).contains('Address, phone, and/or email must be added'); - cy.get(selectors.stepOneSchoolDetails.nextButton).should('be.disabled'); + cy.get(selectors.schoolDetails.schoolDisplayNameTitle).contains('EDX Automation Test 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.stepOneSchoolDetails.nextButton).click(); + cy.get(selectors.studentLevelData.nextButton).click(); //step two of collection - cy.get(selectors.schoolContacts.subjectHeading).contains('99899998 - EDX Automation Testing School'); - cy.get(selectors.stepTwoSchoolContacts.formHint).contains('A principal with an active start date and contact information must be added'); - cy.get(selectors.stepTwoSchoolContacts.nextButton).should('be.disabled'); + cy.get(selectors.schoolContacts.subjectHeading).contains('99899998 - EDX Automation Test School'); cy.get(selectors.schoolContacts.newContactButton).click(); cy.get(selectors.schoolContacts.newContactTypeDropdown).parent().click(); cy.get(selectors.schoolContacts.listItem).contains('Principal').click(); @@ -45,7 +46,18 @@ describe('SDC School Collection View', () => { cy.get(selectors.schoolContacts.newContactEffectiveDateTextField).click(); cy.get(selectors.schoolContacts.newContactCalendar).contains('Select').click(); cy.get(selectors.schoolContacts.newContactPostBtn).click(); - cy.get(selectors.stepTwoSchoolContacts.nextButton).click(); + cy.get(selectors.studentLevelData.nextButton).click(); + + //step three 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 Test School'); + + // Timeout exception made since time to upload is varaible 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').should('be.enabled').click(); + + }); }); }); diff --git a/tests-e2e/cypress/support/selectors.ts b/tests-e2e/cypress/support/selectors.ts index 4efaeaeb7..90a94ca31 100644 --- a/tests-e2e/cypress/support/selectors.ts +++ b/tests-e2e/cypress/support/selectors.ts @@ -65,7 +65,8 @@ export default { documentUpload: { //common component selectFileInput: '#selectFileInput', uploadDocumentButton: '#upload_form', - uploadDocumentTypeCodeSelect: '#uploadDocumentTypeCodeSelect' + uploadDocumentTypeCodeSelect: '#uploadDocumentTypeCodeSelect', + stepThreeNextButton: '#nextButton', }, dropdown: { //common component listItem: '.v-list-item' @@ -193,13 +194,10 @@ export default { snackbar: { mainSnackBar: '#mainSnackBar' }, - stepOneSchoolDetails: { - formHint: 'p.form-hint', - nextButton: '#nextButton' - }, - stepTwoSchoolContacts: { + studentLevelData: { formHint: 'p.form-hint', - nextButton: '#nextButton' + nextButton: '#nextButton', + documentUploadButton: '#uploadButton', }, userActivationPage: { mincodeInput: '#instituteIdentifierTextField', diff --git a/tests-e2e/cypress/uploads/sample-2-student-fnchars.std b/tests-e2e/cypress/uploads/sample-2-student-fnchars.std new file mode 100644 index 000000000..8f83f26e2 --- /dev/null +++ b/tests-e2e/cypress/uploads/sample-2-student-fnchars.std @@ -0,0 +1,4 @@ +FFI99899998Lindsay Park Elementary 20230426 +SRM0000000000011234567890Nader Nickolas Ryan Jacques 19720820F N943 000020000000000000000 0800 V8N0B6 +SRM0000000000021234567890Stamm Richmond Kuhlman Gregory 19860428M N943 000070000000000000000 0800 V8N1E3 +BTR000002Follett Software MYED TSW_VM