This repository was archived by the owner on Oct 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Campaign tests #2833
Merged
Merged
Campaign tests #2833
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9a5f175
Rename test to be clear it is testing pitch page.
DFurnes b1a1c1e
Add optional username & password parameters to login helper.
DFurnes 3fefd8d
Some cleanup to pre-test script.
DFurnes 877230e
Update tests for new modals in Neue 4.3.
DFurnes 5abf4fd
Added function to sign user up for a given campaign.
DFurnes 1298343
Add tests for campaign action page content & functionality.
DFurnes 8f97b33
Each test should start at the homepage.
DFurnes f6c0821
Adding tmp directory to gitignore.
DFurnes 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 |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| tmp/ | ||
| .vagrant | ||
| *.DS_Store | ||
| html/ | ||
|
|
||
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
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
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,123 @@ | ||
| /** | ||
| * action.js | ||
| * Test action page is rendered correctly | ||
| */ | ||
|
|
||
| var x = require('casper').selectXPath; | ||
|
|
||
| casper.test.begin("Test action page is rendered correctly", 22, function suite(test) { | ||
| casper.login("QA_TEST_CAMPAIGN_ACTION@example.com", "QA_TEST_CAMPAIGN_ACTION"); | ||
|
|
||
| // ## Header | ||
| casper.thenOpen(url + "/campaigns/test-campaign", function() { | ||
| // We expect to see the title and subtitle of the campaign | ||
| test.assertSelectorHasText("header[role='banner'].-hero .__title", "Test Campaign", "Title of campaign is printed in H1."); | ||
| test.assertSelectorHasText("header[role='banner'].-hero .__subtitle", "This is a test unsponsored campaign.", "Subtitle of campaign is printed in H2."); | ||
| }); | ||
|
|
||
| // ## Know It | ||
| casper.then(function() { | ||
| test.assertSelectorHasText("#know .container__title", "Step 1: Know It", "\"Know It\" banner exists."); | ||
| this.captureSelector("tmp/tests/step1.png", "#know"); | ||
|
|
||
| test.assertNotVisible("[data-modal]", "Modals are hidden on page load.") | ||
|
|
||
| casper.click(x('//*[text()="Check out our FAQs"]')); | ||
| this.waitUntilVisible("#modal-faq", function() { | ||
| test.assertSelectorHasText("#modal-faq", "Why is 'fee awesome?", "FAQ modal displays on click."); | ||
| }); | ||
| }); | ||
|
|
||
| casper.then(function() { | ||
| casper.click("#modal-faq .js-close-modal"); | ||
| this.waitWhileVisible("#modal-faq", function() { | ||
| test.assert(true, "Clicking the close button hides the modal.") | ||
| }); | ||
| }); | ||
|
|
||
| casper.then(function() { | ||
| casper.click(x('//*[text()="Learn more about Coffee"]')); | ||
| this.waitUntilVisible("#modal-facts", function() { | ||
| test.assertSelectorHasText("#modal-facts", "1 in 3 teenagers have slept through math", "Fact modal displays on click."); | ||
| }); | ||
| }); | ||
|
|
||
| // ## Plan It | ||
| casper.then(function() { | ||
| test.assertSelectorHasText("#plan .container__title", "Step 2: Plan It", "\"Plan It\" banner exists."); | ||
| this.captureSelector("tmp/tests/step2.png", "#plan"); | ||
| }); | ||
|
|
||
| // ## Do It | ||
| casper.then(function() { | ||
| test.assertSelectorHasText("#do .container__title", "Step 3: Do It", "\"Do It\" banner exists."); | ||
| this.captureSelector("tmp/tests/step3.png", "#do"); | ||
|
|
||
|
|
||
| // @NOTE: Can't use assertVisible() because of "visually-hidden" mixin trickiness. | ||
| test.assertExists("#tip-1.is-active", "First tip is visible on page load."); | ||
| test.assertDoesntExist("#tip-2.is-active", "Second tip is hidden on page load."); | ||
|
|
||
| casper.click(x('//*[text()="Give Him \'Fee"]')); | ||
|
|
||
| test.assertDoesntExist("#tip-1.is-active", "First tip is hidden after clicking second tip link."); | ||
| test.assertExists("#tip-2.is-active", "Second tip is visible after clicking second tip link."); | ||
| }); | ||
|
|
||
| // ## Prove It | ||
| casper.then(function() { | ||
| test.assertSelectorHasText("#prove .container__title", "Step 4: Prove It", "\"Prove It\" banner exists."); | ||
| this.captureSelector("tmp/tests/step4.png", "#prove"); | ||
|
|
||
| casper.click(".info-bar .help a"); | ||
| this.waitUntilVisible("#modal-contact-form", function() { | ||
| test.assertSelectorHasText("#modal-contact-form", "Enter your question below.", "Zendesk modal displays on click."); | ||
| }); | ||
| }); | ||
|
|
||
| casper.then(function() { | ||
| casper.click("#modal-contact-form .js-close-modal"); | ||
| }); | ||
|
|
||
| // ## Report Back | ||
| casper.then(function() { | ||
| casper.click(x('//*[text()="Submit Your Pic"]')); | ||
| this.waitUntilVisible("[data-modal]", function() { | ||
| test.assertSelectorHasText("#modal-report-back", "Prove It", "Report Back modal displays on click."); | ||
| }); | ||
| }); | ||
|
|
||
| casper.then(function() { | ||
| this.fill("form[action='/campaigns/test-campaign']", { | ||
| "files[reportback_file]": "tests/fixtures/reportback-image.png", | ||
| "quantity": "10", | ||
| "why_participated": "Test response." | ||
| }, true); | ||
| }); | ||
|
|
||
|
|
||
| // Confirmation page | ||
| casper.then(function() { | ||
| test.assertSelectorHasText("header[role='banner'] .__title", "You did it!", "Confirmation page shown after report back."); | ||
| test.assertSelectorHasText("header[role='banner'] .__subtitle", "You sure drank that 'fee. Good work!", "Campaign confirmation message is shown in subtitle."); | ||
|
|
||
| test.assertElementCount(".gallery .gallery-item", 3, "Three suggested campaigns are shown."); | ||
|
|
||
| casper.click(x('//*[text()="Back to Test Campaign"]')); | ||
| }); | ||
|
|
||
| // Check that reportback submitted successfully. | ||
| casper.then(function() { | ||
| casper.click(x('//*[text()="Update Submission"]')); | ||
| this.waitUntilVisible("[data-modal]", function() { | ||
| test.assertExists("#modal-report-back .submitted-image img", "Submitted report back image is shown.") | ||
| test.assertField("quantity", "10", "Submitted quantity is shown for editing.") | ||
| test.assertField("why_participated", "Test response.", "Submitted 'Why Participated?' is shown for editing.") | ||
| }); | ||
| }); | ||
|
|
||
| casper.run(function() { | ||
| test.done(); | ||
| }); | ||
| }); | ||
|
|
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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.
way to bash