-
Notifications
You must be signed in to change notification settings - Fork 0
Automatiza teste de upload do relatório para pagamento #564
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
Open
jgaguiarm
wants to merge
5
commits into
develop
Choose a base branch
from
feature/automate-upload-budget-allocation
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ba2f64f
Automatiza teste de upload do relatório para pagamento
bb03e2a
Refatorando alguns testes para a página de editais
751432a
Refatora testes para a página de Editais
jgaguiarm 05e9844
Adiciona seeder que cria de edital sem nup para teste de preenchiment…
dfe5d3c
Corrige conflitos com a develop
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?php | ||
|
|
||
| namespace App\Console\Commands; | ||
|
|
||
| use Illuminate\Console\Command; | ||
|
|
||
| class CypressResetCommand extends Command | ||
| { | ||
| protected $signature = 'cypress:reset'; | ||
|
|
||
| protected $description = 'Reset Cypress test data'; | ||
|
|
||
| public function handle(): int | ||
| { | ||
| $this->info('Resetting Cypress test data...'); | ||
|
|
||
| $this->call('db:seed', [ | ||
| '--class' => 'Database\\Seeders\\CypressSeeder', | ||
| ]); | ||
|
|
||
| $this->info('Cypress test data reset successfully.'); | ||
|
|
||
| return self::SUCCESS; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,177 +1,268 @@ | ||
| import Login from '../../../pages/auth'; | ||
| import NoticeWorkflow from '../../../support/workflows/NoticeWorkflow'; | ||
| import Notice from '../../../pages/notice/NoticePage'; | ||
|
|
||
| describe('Notice Page - E2E Tests', () => { | ||
| beforeEach(() => { | ||
| beforeEach(function () { | ||
| cy.resetCypressData(); | ||
|
|
||
| cy.fixture('users').as('user'); | ||
| cy.fixture('notices').as('notice'); | ||
|
|
||
| cy.get('@user').then((user) => { | ||
| Login.accessLoginPage(); | ||
| Login.successLogin(user.valid_email, user.password, user.name); | ||
| cy.fixture('notices').then((notices) => { | ||
| this.notice = notices.notice; | ||
| this.noticeIdentificationForm = notices.noticeIdentificationForm; | ||
| }); | ||
|
|
||
| Notice.visitPage(); | ||
| Notice.verifyPageLoaded(); | ||
| cy.fixture('noticeUpdate').as('noticeUdate'); | ||
| }); | ||
|
|
||
| describe('Page Access and Navigation', () => { | ||
| it('should access the notice list page', function () { | ||
| cy.url().should('include', '/editais'); | ||
| }); | ||
| describe('Dashboard', () => { | ||
| it('should display the notice dashboard metrics', function () { | ||
| // Arrange | ||
| cy.loginByRole('fomentation'); | ||
|
|
||
| it('should display the notice list table', function () { | ||
| cy.get('[data-cy=table-notice-list]').should('be.visible'); | ||
| }); | ||
| }); | ||
| // Act | ||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| describe('Dashboard Visibility', () => { | ||
| it('should display all dashboard cards', function () { | ||
| // Assert | ||
| Notice.verifyDashboardCardsAreVisible(); | ||
| }); | ||
|
|
||
| it('should display all dashboard metric cards', function () { | ||
| Notice.verifyAllDashboardMetrics(); | ||
| }); | ||
| }); | ||
| // Arrange | ||
| cy.loginByRole('fomentation'); | ||
|
|
||
| describe('User Information Display', () => { | ||
| it('should display logged user name in header avatar', function () { | ||
| Notice.verifyLoggedUserDisplayedInHeader(this.user.name); | ||
| }); | ||
| // Act | ||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| it('should display welcome message with user name', function () { | ||
| Notice.verifyWelcomeMessageDisplaysUsername(this.user.name); | ||
| // Assert | ||
| Notice.verifyAllDashboardMetrics(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Identification Data Form', () => { | ||
| describe('Identification Data', () => { | ||
| it('should open the identification data form', function () { | ||
| Notice.openIdentificationDataForm(); | ||
| cy.get('[data-cy=notice-nup-identification-data-form]').should('be.visible'); | ||
| // Arrange | ||
| cy.loginByRole('fomentation'); | ||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| // Act | ||
| NoticeWorkflow.openIdentificationDataForm(); | ||
|
|
||
| // Assert | ||
| NoticeWorkflow.validateIdentificationDataFormIsVisible(); | ||
| }); | ||
|
|
||
| it('should fill and submit the identification data form', function () { | ||
| Notice.openIdentificationDataForm(); | ||
| // Arrange | ||
| const notice = this.noticeIdentificationForm; | ||
|
|
||
| cy.loginByRole('fomentation'); | ||
|
|
||
| const notice = this.notice[0]; | ||
| const formData = { | ||
| noticeNup: notice.noticeNup, | ||
| instrumentType: notice.noticeInstrumentType, | ||
| totalAmount: notice.noticeTotalValue, | ||
| noticeManager: notice.noticeAccompanimentManager, | ||
| managerEmail: notice.noticeManagerEmail, | ||
| quotaNumber: notice.quotaNumber, | ||
| }; | ||
|
|
||
| Notice.fillIdentificationDataForm(formData); | ||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| Notice.searchNoticeByTitle(notice.title); | ||
|
|
||
| // Act | ||
| NoticeWorkflow.fillNoticeIdentificationData(notice); | ||
| Notice.submitIdentificationDataForm(); | ||
|
|
||
| // Assert | ||
| Notice.verifySuccessMessageIdentificationDataForm(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Search Functionality', () => { | ||
| it('should find a notice by title', function () { | ||
| const notice = this.notice[0]; | ||
| // Arrange | ||
| const notice = this.notice; | ||
| cy.loginByRole('fomentation'); | ||
|
|
||
| // Act | ||
| NoticeWorkflow.gotToNoticePage(); | ||
| Notice.searchNoticeByTitle(notice.title); | ||
|
|
||
| // Assert | ||
| Notice.validateResultSearchByTitle(notice.title); | ||
| }); | ||
|
|
||
| it('should find a notice by NUP number', function () { | ||
| const notice = this.notice[0]; | ||
| it('should find a notice by NUP', function () { | ||
| // Arrange | ||
| const notice = this.notice; | ||
| cy.loginByRole('fomentation'); | ||
|
|
||
| // Act | ||
| NoticeWorkflow.gotToNoticePage(); | ||
| Notice.searchNoticeByNup(notice.noticeNup); | ||
|
|
||
| // Assert | ||
| Notice.validateResultSearchByNup(notice.noticeNup); | ||
| }); | ||
|
|
||
| it('should clear search and display all notices', function () { | ||
| const notice = this.notice[0]; | ||
| // Arrange | ||
| const notice = this.notice; | ||
| cy.loginByRole('fomentation'); | ||
|
|
||
| Notice.searchNoticeByNup(notice.noticeNup); | ||
| cy.get('[data-cy=find-specific-notice] input').clear(); | ||
| cy.get('[data-cy=table-notice-list] tbody tr').should('have.length.greaterThan', 1); | ||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| Notice.getTotalNotices().then((initialTotal) => { | ||
| Notice.searchNoticeByNup(notice.noticeNup); | ||
|
|
||
| // Act | ||
| Notice.clearNoticeSearch(); | ||
|
|
||
| // Assert | ||
| Notice.validateNoticeListAfterClearingSearch(initialTotal); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Filtering', () => { | ||
| it('should filter notices by process status', function () { | ||
| const notice = this.notice[0]; | ||
| // Arrange | ||
| const notice = this.notice; | ||
| cy.loginByRole('fomentation'); | ||
|
|
||
| Notice.filterByProcessStatus(notice.processsStatus); | ||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| // Act | ||
| Notice.filterByProcessStatus(notice.processStatus); | ||
|
|
||
| // Assert | ||
| Notice.validateNoticesByStatus(notice.processStatus); | ||
| }); | ||
|
|
||
| it('should filter notices by instrument type', function () { | ||
| const notice = this.notice[0]; | ||
| // Arrange | ||
| const notice = this.notice; | ||
| cy.loginByRole('fomentation'); | ||
|
|
||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| Notice.filterByInstrumentType(notice.noticeInstrumentType); | ||
| // Act | ||
| Notice.filterByInstrumentType(notice.instrumentType); | ||
|
|
||
| // Assert | ||
| Notice.validateNoticesByInstrumentType(notice.instrumentType); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Notice Details View', () => { | ||
| it('should open notice details page', function () { | ||
| const notice = this.notice[0]; | ||
| // Arrange | ||
| const notice = this.notice; | ||
| cy.loginByRole('fomentation'); | ||
|
|
||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| // Act | ||
| Notice.searchNoticeByNup(notice.noticeNup); | ||
| Notice.goToNoticeDetailsPage(notice.noticeNup); | ||
| cy.url().should('match', /\/editais\/\d+\/projetos$/); | ||
|
|
||
| // Assert | ||
| NoticeWorkflow.validateNoticeDetailsPageUrl(); | ||
| }); | ||
|
|
||
| it('should display all information in detail view', function () { | ||
| const notice = this.notice[0]; | ||
| // Arrange | ||
| const notice = this.notice; | ||
| cy.loginByRole('fomentation'); | ||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| // Act | ||
| Notice.searchNoticeByNup(notice.noticeNup); | ||
| Notice.goToNoticeDetailsPage(notice.noticeNup); | ||
| Notice.clickShowAllInformationButton(); | ||
| Notice.verifyDetailViewElements(); | ||
| }); | ||
|
|
||
| it('should display correct NUP in detail view', function () { | ||
| const notice = this.notice[0]; | ||
| Notice.searchNoticeByNup(notice.noticeNup); | ||
| Notice.goToNoticeDetailsPage(notice.noticeNup); | ||
| Notice.displayCorrectNupInDetailView(notice.noticeNup); | ||
| // Assert | ||
| Notice.verifyDetailViewElements(); | ||
| Notice.verifyIdentificationData(notice); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Pagination', () => { | ||
| it('should change the number of items displayed per page', function () { | ||
| const itemsPerPage = this.notice[0].quantityPerPage; | ||
| Notice.changeItemsPerPage(itemsPerPage); | ||
| // Arrange | ||
| const noticesPerPage = this.notice.noticesPerPage; | ||
| cy.loginByRole('fomentation'); | ||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| // Act | ||
| Notice.changeItemsPerPage(noticesPerPage); | ||
|
|
||
| // Assert | ||
| Notice.validateNoticesPerPage(noticesPerPage); | ||
| }); | ||
|
|
||
| it('should navigate to next page and highlight current page number', function () { | ||
| Notice.goToPage(2); | ||
| cy.get('[data-cy=pagination-number-notice-list]') | ||
| .contains('2') | ||
| .parent() | ||
| .should('have.css', 'background-color', 'rgb(255, 193, 7)'); | ||
| // Arrange | ||
| const pageNumber = '1'; | ||
| cy.loginByRole('fomentation'); | ||
|
|
||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| // Act | ||
| Notice.goToPage(pageNumber); | ||
|
|
||
| // Assert | ||
| Notice.verifyPageIsActive(pageNumber); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Form Error Handling', () => { | ||
| it('should display error when submitting form with invalid data', function () { | ||
| // Arrange | ||
| cy.loginByRole('fomentation'); | ||
|
|
||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| Notice.openIdentificationDataForm(); | ||
|
|
||
| // Try to submit with empty required fields | ||
| cy.get('[data-cy=add-data-identification-data-form-button]').click(); | ||
| // Act | ||
| Notice.submitIdentificationDataForm(); | ||
|
|
||
| // Expect validation error | ||
| cy.get('[data-cy=notice-nup-identification-data-form]') | ||
| .closest('.v-input') | ||
| .contains('Campo obrigatório') | ||
| .should('be.visible'); | ||
| // Assert | ||
| Notice.verifyNoticeNupRequiredFieldError(); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Update Notice Data', () => { | ||
| it('should update data about notice and save', function () { | ||
| const currentNoticeData = this.notice[0]; | ||
| const newNoticeData = this.notice[1]; | ||
| // Arrange | ||
| const currentNotice = this.notice; | ||
| const noticeUpdate = this.noticeUdate; | ||
|
|
||
| cy.loginByRole('fomentation'); | ||
|
|
||
| Notice.goToNoticeDetailsPage(currentNoticeData.noticeNup); | ||
| NoticeWorkflow.gotToNoticePage(); | ||
|
|
||
| Notice.searchNoticeByNup(currentNotice.noticeNup); | ||
| Notice.goToNoticeDetailsPage(currentNotice.noticeNup); | ||
| Notice.clickShowAllInformationButton(); | ||
| Notice.verifyDetailViewElements(); | ||
| Notice.updateDataAboutProcess(newNoticeData.noticeInstrumentType, newNoticeData.noticeManagerEmail); | ||
| Notice.verifySuccessMessageUpdateNoiceData(); | ||
| Notice.verifyUpdatedDataAboutProcess(newNoticeData.noticeInstrumentType, newNoticeData.noticeManagerEmail); | ||
|
|
||
| // Act | ||
| Notice.updateDataAboutProcess(noticeUpdate.accompanimentManager, noticeUpdate.managerEmail); | ||
|
|
||
| // Assert | ||
| Notice.verifySuccessMessageUpdateNoticeData(); | ||
| Notice.verifyUpdatedDataAboutProcess(noticeUpdate.accompanimentManager, noticeUpdate.managerEmail); | ||
| }); | ||
| }); | ||
|
|
||
| describe('Upload Payment Report', () => { | ||
| beforeEach(() => { | ||
| cy.resetCypressData(); | ||
| }); | ||
|
|
||
| it('should upload payments report', function () { | ||
| // Arrange | ||
| cy.loginByRole('financial'); | ||
|
|
||
| // Act | ||
| NoticeWorkflow.uploadPaymentsReportFile(); | ||
|
|
||
| // Assert | ||
| NoticeWorkflow.validatePaymentReportUpload(); | ||
| }); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| 270401 - FUNDO ESTADUAL DE CULTURA,,,,,,,,,,,,,"98571495,02","98223904,68","91271532,56",, | ||
| Unidade Gestora / Data NE,Nota de Empenho,Data NL,Nota de Liquidação,Data OB,Ordem Bancária,Fonte Completa,Natureza Despesa,Processo,Credor,Nome do Credor,Credor da Retenção,Domicílio Bancário Origem (OB),Empenhado,Liquidado,Pago,, | ||
| 26/02/2025,2025NE000002 – CYPRESS TESTE,26/02/2025,2025NL000005,27/02/2025,2026OB000025,1234567890,123456,27001.501234/5678-90,12345678901,CREDOR CYPRESS,07950123456789 - SECRETARIA DA CULTURA DO EST DO CEARA,123 - 1234 – 1234567021122,"30,08","30,08","30,08",,NUP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "accompanimentManager": "Cypress Notice Manager", | ||
| "managerEmail": "cypress.update@example.com", | ||
| "totalAmount": 14258 | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Block
CypressSeederoutside local and testing environments.CypressSeedercan reset real@secult.ce.gov.braccounts to the known passwordpasswordand change their roles. Bothcypress:resetandreset-fomento.shinvoke this seeder, so a guard only in the Artisan command does not protect the direct script. The guard must throw; a silent return can make both callers report success without performing the reset.Proposed fix
public function run(): void { + if (! app()->environment(['local', 'testing'])) { + throw new \RuntimeException( + 'CypressSeeder is only allowed in local/testing environments.' + ); + } + $this->call([🤖 Prompt for AI Agents