Skip to content
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

Nightwatch/tsq #408

Open
wants to merge 36 commits into
base: Dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
89f969c
Tsq nightwatch in progress, ran into bug when loading skills on tsq c…
TrickaTrae Nov 19, 2019
1d52496
Merge pull request #392 from paladinarcher/nightwatch/registerUserAnd…
CraigBuckmaster Nov 20, 2019
c8fd372
Merge branch 'staging' into testsAfterDeploy
FiveOfSeven Nov 25, 2019
3845c32
Merge pull request #396 from paladinarcher/testsAfterDeploy
CraigBuckmaster Nov 25, 2019
1196cf9
Merge branch 'staging' into addJenkinsIstanbulCoverage
FiveOfSeven Nov 29, 2019
fd70b22
Merge pull request #401 from paladinarcher/addJenkinsIstanbulCoverage
CraigBuckmaster Dec 2, 2019
b61e342
nightwatch test for trait spectrum complete
TrickaTrae Dec 4, 2019
5bff423
Merge branch 'staging' of https://github.com/paladinarcher/padawan in…
TrickaTrae Dec 6, 2019
a307d3e
Merge branch 'staging' into remediationJenkinsIstanbul
FiveOfSeven Dec 13, 2019
489e3d8
Merge pull request #405 from paladinarcher/remediationJenkinsIstanbul
CraigBuckmaster Dec 13, 2019
4a36282
Merge branch 'staging' of https://github.com/paladinarcher/padawan in…
TrickaTrae Dec 16, 2019
74f9c11
nightwatch test for tsq done
TrickaTrae Dec 16, 2019
5a50798
tsq nightwatch test tweak
TrickaTrae Dec 16, 2019
a92c0db
Merge branch 'staging' of https://github.com/paladinarcher/padawan in…
TrickaTrae Dec 17, 2019
9c2c46c
tweaks to trait spectrum nightwatch test
TrickaTrae Dec 17, 2019
cd0f7a8
move nav-results into view before trying to click
TrickaTrae Dec 17, 2019
8b707de
just clicking nav-results rather than checking if visible first
TrickaTrae Dec 17, 2019
a5b1c47
trying to select nav-results button by css instead of id
TrickaTrae Dec 17, 2019
4718d11
navigating directly to results rather than clicking the button
TrickaTrae Dec 17, 2019
29ead5d
removed last button click and navigating via url instead
TrickaTrae Dec 17, 2019
36a9641
hopefully last change to get trait spectrum test to pass
TrickaTrae Dec 17, 2019
ac4b7a6
Merge pull request #409 from paladinarcher/nightwatch/traitSpectrum
kginstructor Dec 17, 2019
e4847f7
Merge branch 'staging' of https://github.com/paladinarcher/padawan in…
TrickaTrae Dec 18, 2019
fcc05c2
remove body check
TrickaTrae Dec 18, 2019
33d8446
added check for whether it goes to intro or not
TrickaTrae Dec 18, 2019
eb9f046
tweaking restricted route to allow tsq nightwatch user into tsq
TrickaTrae Dec 18, 2019
4283df7
changed restriced routes back, not the issue. Fixed tsq & trait spect…
TrickaTrae Dec 19, 2019
68a73a5
changing functions so everything runs synchronously
TrickaTrae Dec 19, 2019
a5ca5b0
cleanup
TrickaTrae Dec 19, 2019
0b7cd24
changed tsq intro section nightwatch test
TrickaTrae Dec 19, 2019
3356f12
adjusting if statement, trying to figure out why merge is failing
TrickaTrae Dec 19, 2019
a5d6234
logging url to see where were ending up
TrickaTrae Dec 19, 2019
472788c
changed url
TrickaTrae Dec 20, 2019
7dc88d7
adding test user back to restricted route in case thats the issue
TrickaTrae Dec 20, 2019
9aa5358
checking for error page
TrickaTrae Dec 20, 2019
00bee21
believe I know what the issue is, put restrictedRoutes back
TrickaTrae Dec 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions imports/ui/components/questions/questions.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,12 @@ <h4>
</div>
{{#if currentResultsTrue}}
<div class="btn-group" role="group">
<button class="btn btn-success" id="nav-results">Current Results</button>
<button class="btn btn-success nav-results-button" id="nav-results">Current Results</button>
</div>
{{/if}}
{{#if finalResultsTrue}}
<div class="btn-group" role="group">
<button class="btn btn-success" id="nav-results">Final Results</button>
<button class="btn btn-success nav-results-button" id="nav-results">Final Results</button>
</div>
{{/if}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion imports/ui/pages/results/results.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template name="results">
<div>
<div id="trait_spectrum_results">
<h1 style="margin-top: 8vh; margin-bottom: 7vh; text-align: center;">
Trait Spectrum Results
</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template name="results_descriptions">
<div style="text-align: center">
<div style="text-align: center" id="trait_spectrum_results_descriptions">
{{> select_feedback source='results_descriptions'}}
<h2
style="color:#898; color: rgb(53, 49, 49); background-color:rgba(255, 255, 255, 0.025); margin: 3%; text-align: center;"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h3 class="">Technical Skills Questionnaire</h3>
</div>
{{ #each userSkills }}
<h3>{{ #with name }}{{ name }}{{ /with }}</h3>
<div class="">
<div id="confidence_list">
<div class="btn-group btn-group-sm" role="group" aria-label="Basic example">
<button type="button" class="btn {{ #if equals confidenceLevel 1 }} btn-success {{ else }} btn-secondary {{ /if }} select-confidence" data-index="{{ realIndex @index }}" data-id="{{ _id }}" data-value="1">a month or more</button>
<button type="button" class="btn {{ #if equals confidenceLevel 2 }} btn-success {{ else }} btn-secondary {{ /if }} select-confidence" data-index="{{ realIndex @index }}" data-id="{{ _id }}" data-value="2">a week or two</button>
Expand Down
95 changes: 95 additions & 0 deletions tests/traitSpectrum.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
const randomNumber = (Math.floor(Math.random() * 100000) + 1) + Date.now();

module.exports = {
"Take/Complete Trait Spectrum": function(browser) {
browser.windowSize("current", "1200", "769"); // setting window size for this test
browser.url("http://localhost:3000").waitForElementVisible("body", 12000);

createNewUser(browser);
takeTraitSpectrum(browser);
viewTraitSpectrumResults(browser);
browser.end();
}
};

function createNewUser(browser) {
browser.verify
.visible("#at-signUp")
.click("#at-signUp")
browser
.waitForElementVisible("#at-field-email", 12000)
.setValue("#at-field-email", `testUserForNightwatchTesting${randomNumber}@mydomain.com`)
browser.verify
.visible("#at-field-password")
.setValue("#at-field-password", "password")
browser.verify
.visible("#at-field-password_again")
.setValue("#at-field-password_again", "password")
browser.verify
.visible("#at-field-first_name")
.setValue("#at-field-first_name", "testUserForNightwatchTesting")
browser.verify
.visible("#at-field-last_name")
.setValue("#at-field-last_name", "testing")
browser.verify
.visible("#at-field-access_code")
.setValue("#at-field-access_code", "PADL")
browser.verify
.visible("#at-btn")
.click("#at-btn")
browser.waitForElementVisible("#last-dropdown")
}

function takeTraitSpectrum(browser) {
browser.verify
.visible("#nav-traitSpectrum")
.click("#nav-traitSpectrum")
browser.waitForElementVisible(".size-full", 8000)
browser.verify
.visible(".btn-continue-intro")
.click(".btn-continue-intro")
browser.waitForElementVisible(".size-full", 8000)
browser.verify
.visible(".btn-continue-intro")
.click(".btn-continue-intro")

browser.perform(function() {
for(let i = 0; i <= 20; i++) {
browser.waitForElementVisible(".noUi-base", 8000);
browser.useXpath()
browser.verify
.visible("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[1]/div[3]/div/div/div")
.getLocationInView("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[1]/div[3]/div/div/div")
.moveToElement("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[1]/div[3]/div/div/div", 200, 0).mouseButtonClick(0)
browser.verify
.visible("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[2]/div[3]/div/div/div")
.getLocationInView("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[2]/div[3]/div/div/div")
.moveToElement("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[2]/div[3]/div/div/div", 200, 0).mouseButtonClick(0)
browser.verify
.visible("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[3]/div[3]/div/div/div")
.getLocationInView("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[3]/div[3]/div/div/div")
.moveToElement("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[3]/div[3]/div/div/div", 200, 0).mouseButtonClick(0)
browser.verify
.visible("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[4]/div[3]/div/div/div")
.getLocationInView("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[4]/div[3]/div/div/div")
.moveToElement("//*[@id='__blaze-root']/div[2]/div[2]/div[2]/div[2]/div[1]/div[4]/div[3]/div/div/div", 200, 0).mouseButtonClick(0)
browser.useCss()
browser.verify
.visible("#submitAll")
.getLocationInView("#submitAll")
.click("#submitAll")
}
})
}

function viewTraitSpectrumResults(browser) {
browser.getLocationInView(".nav-results-button")
browser.verify
.visible(".nav-results-button")
.click(".nav-results-button")
browser.waitForElementVisible("#trait_spectrum_results", 12000)
browser.verify.visible("#results_descriptions")
.getLocationInView("#results_descriptions")
.click("#results_descriptions")
browser.waitForElementVisible("#trait_spectrum_results_descriptions", 12000)
}
159 changes: 159 additions & 0 deletions tests/tsq.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
const randomNumber = (Math.floor(Math.random() * 100000) + 1) + Date.now();

module.exports = {
"Take the tsq": function(browser) {
browser.url("http://localhost:3000").waitForElementVisible("body", 12000);

createNewUser(browser);
tsqIntroAndUserLanguageList(browser);
tsqFamiliarUnfamiliar(browser);
tsqConfidenceQnaire(browser);
tsqResult(browser);
browser.end();
}
}

function createNewUser(browser) {
browser.verify
.visible("#at-signUp")
.click("#at-signUp")
browser
.waitForElementVisible("#at-field-email", 12000)
.setValue("#at-field-email", `testUserForTsqNightwatchTest${randomNumber}@mydomain.com`)
browser.verify
.visible("#at-field-password")
.setValue("#at-field-password", "password")
browser.verify
.visible("#at-field-password_again")
.setValue("#at-field-password_again", "password")
browser.verify
.visible("#at-field-first_name")
.setValue("#at-field-first_name", "testUserForTsqNightwatchTest")
browser.verify
.visible("#at-field-last_name")
.setValue("#at-field-last_name", "testing")
browser.verify
.visible("#at-field-access_code")
.setValue("#at-field-access_code", "PADL")
browser.verify
.visible("#at-btn")
.click("#at-btn")
browser.pause(2000);
}

function tsqIntroAndUserLanguageList(browser) {
browser.url("http://localhost:3000/technicalSkillsQuestionaire/userLanguageList?h=2").waitForElementVisible(".container", 12000);

// for testing purposes
browser.element("css selector", ".loading-animation", function(result) {
console.log('.loading-animation result: ', result);
})

browser.url(function(result){
console.log('current url: ', result);
})

browser.element("css selector", ".gotohomepage", function(result) {
console.log('.gotohomepage result: ', result);
})

browser.verify.visible(".btn-continue-intro")
browser.pause(1500)

browser.element("css selector", ".btn-continue-intro", function(result) {
if(result.status === 0){
console.log('Intro page is visible! ', result);
browser.verify
.visible(".btn-continue-intro")
.click(".btn-continue-intro")
browser.waitForElementVisible(".btn-continue-intro", 12000)
browser.verify
.visible(".btn-continue-intro")
.click(".btn-continue-intro")
browser.verify
.visible(".selectize-input")
.click(".selectize-input")
browser.verify
.visible(".selectize-dropdown-content")
browser
.useXpath()
.click("//div[text()='JavaScript']")
.useCss()
.waitForElementVisible(".remove")
browser
.click(".subtitles") // clicking on subtitles to close the dropdown
browser.verify
.visible("#continue")
.click("#continue")
} else {
console.log('Intro page is NOT visible! ', result);

browser.verify
.visible(".selectize-input")
.click(".selectize-input")
browser.verify
.visible(".selectize-dropdown-content")
browser
.useXpath()
.click("//div[text()='JavaScript']")
.useCss()
.waitForElementVisible(".remove")
browser
.click(".subtitles") // clicking on subtitles to close the dropdown
browser.verify
.visible("#continue")
.click("#continue")
}
})
}

function tsqFamiliarUnfamiliar(browser) {
browser.waitForElementVisible(".unfamiliar-item-checkbox", 12000)
browser.verify
.visible(".unfamiliar-item-checkbox")
.click(".unfamiliar-item-checkbox")
browser.verify
.visible("#continue")
.click("#continue")
}

function tsqConfidenceQnaire(browser) {
browser.useXpath().waitForElementVisible("//*[@id='confidence_list'][10]/div/button[1]", 12000)
browser
.click("//*[@id='confidence_list'][1]/div/button[1]")
.click("//*[@id='confidence_list'][2]/div/button[2]")
.click("//*[@id='confidence_list'][3]/div/button[3]")
.click("//*[@id='confidence_list'][4]/div/button[4]")
.click("//*[@id='confidence_list'][5]/div/button[5]")
.click("//*[@id='confidence_list'][6]/div/button[6]")
.click("//*[@id='confidence_list'][7]/div/button[1]")
.click("//*[@id='confidence_list'][8]/div/button[2]")
.click("//*[@id='confidence_list'][9]/div/button[3]")
.click("//*[@id='confidence_list'][10]/div/button[4]")
.useCss()

browser.element("css selector", "#showResults", function(result) {
if(result.status > -1) {
browser.getLocationInView("#showResults").click("#showResults")
} else {
browser.verify.visible(".nextLanguage")
browser.getLocationInView(".nextLanguage").click(".nextLanguage")
browser.pause(2000)
browser.waitForElementVisible("div[class=panel-body]", 12000)
browser.useXpath()
browser.verify.visible("//*[@id='confidence_list']/div/button[3]")
browser.getLocationInView("//*[@id='confidence_list']/div/button[3]").click("//*[@id='confidence_list']/div/button[3]")
browser.useCss()
browser.waitForElementVisible("#showResults", 1000)
browser.verify.visible("#showResults")
browser.getLocationInView("#showResults").click("#showResults")
browser.pause(2000)
}
})
}

function tsqResult(browser) {
browser.waitForElementVisible("#restart")
browser.verify
.visible("#restart")
}