11import { expect , Page } from "@playwright/test" ;
2- import { CommentResponse } from "@types" ;
2+ import {
3+ BudgetProposalProps ,
4+ CommentResponse ,
5+ } from "@types" ;
36import environments from "lib/constants/environments" ;
47
58export default class BudgetDiscussionDetailsPage {
@@ -17,11 +20,57 @@ export default class BudgetDiscussionDetailsPage {
1720 "change-poll-vote-yes-button"
1821 ) ;
1922 readonly verifyIdentityBtn = this . page . getByTestId ( "verify-identity-button" ) ;
23+ readonly readMoreBtn = this . page . getByTestId ( "read-more-button" ) ;
2024
2125 // content
2226 readonly copyLinkText = this . page . getByTestId ( "copy-link-text" ) ;
2327 readonly pollVoteCard = this . page . getByTestId ( "poll-vote-card" ) ;
2428 readonly totalComments = this . page . getByTestId ( "total-comments" ) ;
29+ readonly linkTextContent = this . page . getByTestId ( "link-0-text-content" ) ;
30+ readonly linkUrlContent = this . page . getByTestId ( "link-0-url-content" ) ;
31+ readonly budgetDiscussionTypeContent = this . page
32+ . getByTestId ( "budget-discussion-type" )
33+ . first ( ) ;
34+ readonly publicProposalChampionContent = this . page . getByTestId (
35+ "public-proposal-champion"
36+ ) ;
37+ readonly socialHandlesContent = this . page . getByTestId ( "social-handles" ) ;
38+ readonly problemStatementContent = this . page . getByTestId ( "problem-statement" ) ;
39+ readonly proposalBenefitsContent = this . page . getByTestId ( "problem-benefit" ) ;
40+ readonly productRoadMapContent = this . page . getByTestId ( "product-roadmap" ) ;
41+ readonly alignProposalComittesContent = this . page . getByTestId (
42+ "align-proposal-committees"
43+ ) ;
44+ readonly evidenceContent = this . page . getByTestId ( "evidence" ) ;
45+ readonly proposalNameContent = this . page . getByTestId ( "proposal-name" ) ;
46+ readonly proposalDescriptionContent = this . page . getByTestId (
47+ "proposal-description"
48+ ) ;
49+ readonly proposalKeyDependenciesContent = this . page . getByTestId (
50+ "proposal-key-dependencies"
51+ ) ;
52+ readonly milestonesContent = this . page . getByTestId ( "proposal-milestone" ) ;
53+ readonly proposalResourcesAndEstimates = this . page . getByTestId (
54+ "proposal-resources-&-duration-estimates"
55+ ) ;
56+ readonly projectExperienceContent =
57+ this . page . getByTestId ( "project-experience" ) ;
58+ readonly proposalContractingContent = this . page . getByTestId (
59+ "proposal-contracting"
60+ ) ;
61+ readonly costingAmountContent = this . page . getByTestId ( "consting-amount" ) ; // BUG typo
62+ readonly costingConversionRateContent = this . page . getByTestId (
63+ "costing-conversion-rate"
64+ ) ;
65+ readonly constingPreferedCurrencyContent = this . page . getByTestId (
66+ "costing-preferred-currency"
67+ ) ;
68+ readonly costingPreferedCurrencyAmountContent = this . page . getByTestId (
69+ "costing-prefereed-currency-amount"
70+ ) ;
71+ readonly costBreakdownContent = this . page . getByTestId ( "cost-breakdown" ) ;
72+ readonly includeAsAuditorContent =
73+ this . page . getByTestId ( "include-as-auditor" ) ;
2574
2675 // Input
2776 readonly commentInput = this . page . getByTestId ( "comment-input" ) ;
@@ -93,4 +142,88 @@ export default class BudgetDiscussionDetailsPage {
93142 await this . page . getByTestId ( "delete-proposal" ) . click ( ) ;
94143 await this . page . getByTestId ( "delete-proposal-yes-button" ) . click ( ) ;
95144 }
145+
146+ async validateProposalDetails ( budgetProposal : BudgetProposalProps ) {
147+ await this . readMoreBtn . click ( ) ;
148+
149+ // proposal ownership validation
150+ await expect ( this . publicProposalChampionContent ) . toHaveText (
151+ budgetProposal . proposalOwnership . publicChampion
152+ ) ;
153+ await expect ( this . socialHandlesContent ) . toHaveText (
154+ budgetProposal . proposalOwnership . contactDetails
155+ ) ;
156+
157+ // problem statement and benefits validation
158+ await expect ( this . problemStatementContent ) . toHaveText (
159+ budgetProposal . problemStatementAndBenefits . problemStatement
160+ ) ;
161+ await expect ( this . proposalBenefitsContent ) . toHaveText (
162+ budgetProposal . problemStatementAndBenefits . proposalBenefits
163+ ) ;
164+ await expect ( this . productRoadMapContent ) . toHaveText (
165+ budgetProposal . problemStatementAndBenefits . roadmapName
166+ ) ;
167+ await expect ( this . budgetDiscussionTypeContent ) . toHaveText (
168+ budgetProposal . problemStatementAndBenefits . budgetDiscussionType
169+ ) ;
170+ await expect ( this . alignProposalComittesContent ) . toHaveText (
171+ budgetProposal . problemStatementAndBenefits . committeeAlignmentType
172+ ) ;
173+ await expect ( this . evidenceContent ) . toHaveText (
174+ budgetProposal . problemStatementAndBenefits . suplimentaryEndorsement
175+ ) ;
176+
177+ // proposal details validation
178+ await expect ( this . proposalNameContent ) . toHaveText (
179+ budgetProposal . proposalDetails . proposalName
180+ ) ;
181+ await expect ( this . proposalDescriptionContent ) . toHaveText (
182+ budgetProposal . proposalDetails . proposalDescription
183+ ) ;
184+ await expect ( this . proposalKeyDependenciesContent ) . toHaveText (
185+ budgetProposal . proposalDetails . proposalKeyDependencies
186+ ) ;
187+ await expect ( this . milestonesContent ) . toHaveText (
188+ budgetProposal . proposalDetails . milestones
189+ ) ;
190+ await expect ( this . proposalResourcesAndEstimates ) . toHaveText (
191+ budgetProposal . proposalDetails . teamSizeAndDuration
192+ ) ;
193+ await expect ( this . projectExperienceContent ) . toHaveText (
194+ budgetProposal . proposalDetails . previousExperience
195+ ) ;
196+ await expect ( this . proposalContractingContent ) . toHaveText (
197+ budgetProposal . proposalDetails . contracting
198+ ) ;
199+
200+ // costing validation
201+ await expect ( this . costingAmountContent ) . toHaveText (
202+ budgetProposal . costing . adaAmount . toString ( )
203+ ) ;
204+ await expect ( this . costingConversionRateContent ) . toHaveText (
205+ budgetProposal . costing . usaToAdaCnversionRate . toString ( )
206+ ) ;
207+ await expect ( this . constingPreferedCurrencyContent ) . toHaveText (
208+ budgetProposal . costing . preferredCurrency
209+ ) ;
210+ await expect ( this . costingPreferedCurrencyAmountContent ) . toHaveText (
211+ budgetProposal . costing . AmountInPreferredCurrency . toString ( )
212+ ) ;
213+ await expect ( this . costBreakdownContent ) . toHaveText (
214+ budgetProposal . costing . costBreakdown
215+ ) ;
216+
217+ // further information validation
218+ await expect ( this . linkTextContent ) . toHaveText (
219+ budgetProposal . furtherInformation [ 0 ] . prop_link_text
220+ ) ;
221+
222+ // administration and auditing validation
223+ await expect ( this . includeAsAuditorContent ) . toHaveText (
224+ budgetProposal . administrationAndAuditing . intersectAdministration
225+ ? "Yes"
226+ : "No"
227+ ) ;
228+ }
96229}
0 commit comments