|
1 | 1 | import {AppSetupData} from '../../../cypress.config';
|
2 | 2 | import { DistrictCollectionOptions } from 'tests-e2e/cypress/services/sdc-collection-api-service';
|
3 | 3 | import selectors from '../../support/selectors';
|
4 |
| -import {TemporalQueries} from "@js-joda/core"; |
5 |
| -import localDate = TemporalQueries.localDate; |
6 |
| - |
7 | 4 |
|
8 | 5 | describe('SDC District Collection - testing Upload School Level Data screen\'s summary or data', () => {
|
9 |
| - context('As an EDX District User', () => { |
10 |
| - before(() => { |
11 |
| - cy.logout(); |
12 |
| - cy.task<AppSetupData>('districtDataLoad', { |
13 |
| - schoolOptions: [ |
14 |
| - { |
15 |
| - includeTombstoneValues: true, |
16 |
| - includeSchoolAddress: true, |
17 |
| - includeSchoolContact: true, |
18 |
| - schoolStatus: 'Open', |
19 |
| - withPrimaryActivationCode: true, |
20 |
| - isIndependentSchool: false, |
21 |
| - schoolCode: '99990' |
22 |
| - }, |
23 |
| - { |
24 |
| - includeTombstoneValues: true, |
25 |
| - includeSchoolAddress: true, |
26 |
| - includeSchoolContact: true, |
27 |
| - schoolStatus: 'Open', |
28 |
| - withPrimaryActivationCode: true, |
29 |
| - isIndependentSchool: false, |
30 |
| - schoolCode: '99991' |
31 |
| - } |
32 |
| - ] |
33 |
| - }).then(res => { |
34 |
| - cy.task<DistrictCollectionOptions, SdcCollections>('setup-district-collections', { |
35 |
| - schools: res.schools, |
36 |
| - district: res.district, |
37 |
| - loadWithStudentAndValidations: false |
38 |
| - }).then(response => { |
39 |
| - Cypress.env('sdcDistrictCollectionID', response?.sdcDistrictCollection?.sdcDistrictCollectionID); |
40 |
| - }); |
41 |
| - cy.task('setup-districtUser', { districtRoles: ['DISTRICT_SDC'], districtCodes: ['998'] }); |
42 |
| - }); |
| 6 | + context('As an EDX District User', () => { |
| 7 | + before(() => { |
| 8 | + cy.logout(); |
| 9 | + cy.task<AppSetupData>('districtDataLoad', { |
| 10 | + schoolOptions: [ |
| 11 | + { |
| 12 | + includeTombstoneValues: true, |
| 13 | + includeSchoolAddress: true, |
| 14 | + includeSchoolContact: true, |
| 15 | + schoolStatus: 'Open', |
| 16 | + withPrimaryActivationCode: true, |
| 17 | + isIndependentSchool: false, |
| 18 | + schoolCode: '99990' |
| 19 | + }, |
| 20 | + { |
| 21 | + includeTombstoneValues: true, |
| 22 | + includeSchoolAddress: true, |
| 23 | + includeSchoolContact: true, |
| 24 | + schoolStatus: 'Open', |
| 25 | + withPrimaryActivationCode: true, |
| 26 | + isIndependentSchool: false, |
| 27 | + schoolCode: '99991' |
| 28 | + } |
| 29 | + ] |
| 30 | + }).then(res => { |
| 31 | + cy.task<DistrictCollectionOptions, SdcCollections>('setup-district-collections', { |
| 32 | + schools: res.schools, |
| 33 | + district: res.district, |
| 34 | + loadWithStudentAndValidations: false |
| 35 | + }).then(response => { |
| 36 | + Cypress.env('sdcDistrictCollectionID', response?.sdcDistrictCollection?.sdcDistrictCollectionID); |
43 | 37 | });
|
44 |
| - beforeEach(() => cy.login()); |
45 |
| - it('can re-upload a collection file', () => { |
46 |
| - const id = Cypress.env('sdcDistrictCollectionID'); |
47 |
| - cy.visit('/open-district-collection-details/' + id); |
48 |
| - |
49 |
| - cy.get(selectors.sdcDocumentUploadStep.infoNote).should('exist').should('contain.text', 'Note: Eligible FTE counts are available in Step 3'); |
50 |
| - cy.get("#navTitle").should('exist').contains('Student Level Data (1701) | EDX Automation Testing District'); |
51 |
| - |
52 |
| - const headings = ['School', 'File Name', 'Date Uploaded', 'Processed'] |
53 |
| - cy.get('.v-data-table__td').then(($td) => { |
54 |
| - const texts = Cypress._.map($td, 'innerText') |
55 |
| - expect(texts, 'headings').to.deep.equal(headings) |
56 |
| - }) |
57 |
| - |
58 |
| - var today = new Date(); |
59 |
| - var dd=String(today.getDate()).padStart(2,'0'); |
60 |
| - var mm=String(today.getMonth()+1).padStart(2,'0'); |
61 |
| - var yyyy = today.getFullYear(); |
| 38 | + cy.task('setup-districtUser', { districtRoles: ['DISTRICT_SDC'], districtCodes: ['998'] }); |
| 39 | + }); |
| 40 | + }); |
| 41 | + beforeEach(() => cy.login()); |
| 42 | + it('can re-upload a collection file', () => { |
| 43 | + const id = Cypress.env('sdcDistrictCollectionID'); |
| 44 | + cy.visit('/open-district-collection-details/' + id); |
62 | 45 |
|
63 |
| - var stringToday=mm+'/'+dd+'/'+yyyy; |
| 46 | + cy.get(selectors.sdcDocumentUploadStep.infoNote).should('exist').should('contain.text', 'Note: Eligible FTE counts are available in Step 3'); |
| 47 | + cy.get('#navTitle').should('exist').contains('Student Level Data (1701) | EDX Automation Testing District'); |
64 | 48 |
|
65 |
| - cy.get('.v-data-table').should('exist').contains(`99899991`); |
66 |
| - cy.get('.v-data-table').should('exist').contains(`99899990`); |
| 49 | + const headings = ['School', 'File Name', 'Date Uploaded', 'Processed']; |
| 50 | + cy.get('.v-data-table__td').then(($td) => { |
| 51 | + const texts = Cypress._.map($td, 'innerText'); |
| 52 | + expect(texts, 'headings').to.deep.equal(headings); |
| 53 | + }); |
67 | 54 |
|
68 |
| - cy.get('#uploadButton').click(); |
69 |
| - cy.get('#selectFileInput').selectFile('./cypress/uploads/dis-upload-sample-1-student-fnchars.std', { force: true }); |
| 55 | + cy.get('.v-data-table').should('exist').contains('99899991'); |
| 56 | + cy.get('.v-data-table').should('exist').contains('99899990'); |
70 | 57 |
|
71 |
| - cy.get('.fileUploadWarningMessage').first().should('exist').contains('The date in the dis-upload-sample-1-student-fn.std file is 2023-04-26. Please ensure that you have uploaded the correct data for this collection before continuing.') |
72 |
| - cy.get('.fileUploadSuccessMessage').first().should('exist').contains('1 file(s) were successfully uploaded. Files will continue to be processed even if you leave the page.'); |
73 |
| - |
74 |
| - cy.get('#step-1-next-button-district').should('not.be.disabled'); |
75 |
| - |
76 |
| - }); |
77 |
| - }) |
| 58 | + cy.get('#uploadButton').click(); |
| 59 | + cy.get('#selectFileInput').selectFile('./cypress/uploads/dis-upload-sample-1-student-fnchars.std', { force: true }); |
78 | 60 |
|
79 |
| -}) |
| 61 | + cy.get('.fileUploadWarning').first().should('have.text', 'dis-upload-sample-1-student-fnchars.std - Pending'); |
| 62 | + cy.get('.fileUploadWarning').first().should('have.text', 'dis-upload-sample-1-student-fnchars.std - The date in this file is 2023-04-26. Please ensure that you have uploaded the correct data for this collection before continuing.'); |
| 63 | + cy.get('.v-card-actions').contains('1 of 1 Complete'); |
| 64 | + cy.get('.v-card-actions .v-btn').click(); |
| 65 | + cy.get('#step-1-next-button-district').should('not.be.disabled'); |
| 66 | + }); |
| 67 | + }); |
| 68 | +}); |
0 commit comments