Skip to content

Commit

Permalink
Merge pull request #4120 from dolbi-digital/WV-628-Develop-automation…
Browse files Browse the repository at this point in the history
…-scripts-for-Donate-page

Automated 7 test cases of Donate page
  • Loading branch information
fdiazq authored Oct 23, 2024
2 parents d292933 + c16697c commit c8362e4
Show file tree
Hide file tree
Showing 4 changed files with 365 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/js/pages/More/Donate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,19 @@ class Donate extends Component {
);

preDonateDescription = () => (
<span>
<span id='first_paragraph'>
Thank you for being a voter! For every $10 donated, you help 50 Americans be voters too.
</span>
);

preDonateDescriptionBottom = (isC4Donation) => (
<span>
<span id='second_paragraph'>
<OpenExternalWebSite
linkIdAttribute="annualBudget"
url={isC4Donation ? 'https://projects.propublica.org/nonprofits/organizations/811052585' : 'https://projects.propublica.org/nonprofits/organizations/472691544'}
target="_blank"
body={(
<span>
<span id='budgets_small'>
Our budgets are small,
<Launch
style={{
Expand Down Expand Up @@ -224,7 +224,7 @@ class Donate extends Component {
{/* eslint-disable-next-line react/no-unknown-property */}
<script src="https://donorbox.org/widget.js" paypalExpress="true" defer />
</Helmet>
<ContentTitle>
<ContentTitle id="want_to_vote">
Want more Americans to vote?
</ContentTitle>
<CenteredText className="u-show-mobile">
Expand Down
172 changes: 166 additions & 6 deletions tests/browserstack_automation/page_objects/donate.page.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,180 @@
import { $, $$ } from '@wdio/globals';
import { $, driver } from '@wdio/globals';
import Page from './page';

class DonatePage extends Page {
constructor () {
super().title = 'Donate - We Vote';
super().title = 'Donate - WeVote';
}

async load () {
await super.open('/donate');
await super.maximizeWindow();
await super.rerender();
}

get getDonatePageContentTitleElement () {
return $('.cZOxNT');
async checkLinkAndTite () {
await expect(driver).toHaveUrl(path + '/donate');
await expect(driver).toHaveTitle('Donate - WeVote');
}

getDonateHeader () {
return $('#want_to_vote');
}

getFirstParagraph () {
return $('(//*[@id="first_paragraph"])[2]');
}

getSecondParagraph () {
return $('(//*[@id="second_paragraph"])[2]');
}

getTextLink () {
return $('#budgets_small');
}

getOneTimeButton () {
return $('#plan_duration_one_time');
}

getDonateAmountButton (amount) {
return $('//span[(text()=' + amount + ')]');
}

getDonorBoxIFrame () {
return $('#donorbox-iframe');
}

getCommentField () {
return $('#ty-msg');
}

getNextButton () {
return $('.next');
}

getPayPalButton () {
return $('.paypal');
}

getPayPalButton2 () {
return $('.paypal-button-container');
}

getPayPalIFrame () {
return $('//iframe[@title="PayPal"]');
}

getPayPalCancelLink () {
return $('#cancelLink');
}

getOptionalFeesCheckbox () {
return $('#ask_for_cover_fee');
}

getOneTimeLabel () {
return $('.donation-interval.plan_duration_one_time');
}

getOneTimeAmount () {
return $('h3 > var > span');
}

getMonthlyButton () {
return $('#plan_duration_monthly');
}

getHeartIcon () {
return $('svg.heart');
}

getCustomAmountField () {
return $('#donation_custom_amount');
}

getCommentCheckbox () {
return $('//span[text()="Write us a comment"]/../span[4]');
}

getDisplayDonationCheckbox () {
return $('//span[contains(text(), "on the donor wall")]/../span[4]');
}

getDisplayFirstNameCheckbox () {
return $('//span[contains(text(), "first name instead")]/../span[4]');
}

getHideDonationAmountCheckbox () {
return $('//span[contains(text(), "Hide donation")]/../span[4]');
}

getDedicateMyDonationCheckbox () {
return $('//span[contains(text(), "Dedicate")]/../span[4]');
}

getInMemoryOfRadioButton () {
return $('label[for="donation_donation_honor_attributes_honor_type_memory"]');
}

getFirstName () {
return $('#donation_first_name');
}

getLasttName () {
return $('#donation_last_name');
}

getEmail () {
return $('#donation_email');
}

getDonateButton () {
return $('#footer_button');
}

getIntervalLabel () {
return $('.plan_duration_monthly.interval');
}

getProcessingFeeLabel () {
return $('(//span[@class="processing_fee"])[2]');
}

getMonthlyAmount () {
return $('(//span[@class="donation-amt"])[3]');
}

getQuarterlyAmount () {
return $('(//span[@class="donation-amt"])[4]');
}

getAnnuallyAmount () {
return $('(//span[@class="donation-amt"])[5]');
}

getQuarterlyButton () {
return $('#plan_duration_quarterly');
}

getAnnuallyButton () {
return $('#plan_duration_annual');
}

getHonoreeNameField () {
return $('#donation_donation_honor_attributes_honoree_name');
}

getRecipientNameField () {
return $('#donation_donation_honor_attributes_recipient_name');
}

getRecipientEmailField () {
return $('#donation_donation_honor_attributes_recipient_email');
}

getRecipientMessageField () {
return $('#donation_donation_honor_attributes_recipient_message');
}

}

export default new DonatePage();
8 changes: 8 additions & 0 deletions tests/browserstack_automation/page_objects/ready.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ class ReadyPage extends Page {
return $('[href = "/donate"]');
}

get getDonateLinkHeader () {
return $('#donateTabHeaderBar');
}

get getDonateLinkFooter () {
return $('#footerMainLinkDonate');
}

get getAboutLinkElement () {
return $('//a[text() = "About & FAQ"]');
}
Expand Down
Loading

0 comments on commit c8362e4

Please sign in to comment.