-
Notifications
You must be signed in to change notification settings - Fork 97
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
Signup flow #246
Signup flow #246
Changes from 2 commits
b4755d8
cf8ca09
e74ec93
acd4e8e
4e2f0dc
12e4d2d
e81154b
f8fa733
bad18c8
5d21a8b
70c0915
bb0cd95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ | |
{{/each}} | ||
{{#if this.isSubmitDisabled }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can achieve both the buttons with the |
||
<button | ||
data-test-id='signup-button-disabled' | ||
shreya-mishra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
class='submitButton disabledButton' | ||
type="submit" | ||
disabled={{true}} | ||
|
@@ -55,6 +56,7 @@ | |
</button> | ||
{{else}} | ||
<button | ||
data-test-id='signup-button' | ||
class='submitButton' | ||
type="submit" | ||
{{on 'click' (fn this.handleSubmit)}} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { module, test } from 'qunit'; | ||
import { visit, currentURL, fillIn } from '@ember/test-helpers'; | ||
import { setupApplicationTest } from 'ember-qunit'; | ||
|
||
module('Acceptance | signup flow', function(hooks) { | ||
|
||
setupApplicationTest(hooks); | ||
|
||
test('http://localhost:4200/signup', async function(assert) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a more descriptive name test name will be good instead of |
||
const fields = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: We can move |
||
first_name:"test", | ||
last_name:'user', | ||
username:'test-user', | ||
email:'[email protected]', | ||
yoe:'0', | ||
company:'rds', | ||
designation:'demo', | ||
linkedin_id:'demo@linkedin', | ||
instagram_id:'demo@insta', | ||
twitter_id:'demo@twitter', | ||
website:'test.com' | ||
} | ||
|
||
const originalWindowAlert = window.alert; | ||
window.alert = function() { return true;} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need this? |
||
await visit('/signup'); | ||
assert.equal(currentURL(), '/signup'); | ||
assert.dom('[data-test-id="signup-button-disabled"]').exists() | ||
assert.dom('[data-test-id="signup-button"]').doesNotExist() | ||
|
||
for(let field in fields){ | ||
|
||
await fillIn(`[data-test-id="form-input-${field}"]`,fields[field]) | ||
} | ||
|
||
assert.dom('[data-test-id="form-input-first_name"]').hasProperty('value','test') | ||
assert.dom('[data-test-id="form-input-last_name"]').hasProperty('value','user') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
To check the value of input |
||
|
||
assert.dom('[data-test-id="signup-button-disabled"]').doesNotExist() | ||
assert.dom('[data-test-id="signup-button"]').exists() | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can there also be something like clicking the button and then disabling it, and checking for the same? |
||
await this.pauseTest() | ||
window.alert = originalWindowAlert; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does the test have an alert? 🤔 What does this do for our assertions? |
||
|
||
}); | ||
}); | ||
|
||
|
||
|
||
|
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.
This can be a static named id, so that we can easily grab it in the tests.