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

Rewrites unit tests for FirstStep.vue #149

Merged
merged 8 commits into from
Apr 9, 2020
Merged

Rewrites unit tests for FirstStep.vue #149

merged 8 commits into from
Apr 9, 2020

Conversation

JackieBinya
Copy link
Contributor

@JackieBinya JackieBinya commented Mar 31, 2020

Fixes

Fixes to #148 by @JackieBinya

Description

  • After evaluating the problems with the FirstStep.spec.vue file. I decided to rename it to FirstStep1.spec.vue and created a file ~/test/unit/specs/FirstStep.spec.vue and rewrote all the tests completely. Coverage for the unit tests now is 100%

Tests

  • Checkout git branch bg-first-step-unit
  • On the terminal run the command npm run test:unit FirstStep1.spec.js to run the old unit tests
  • The to run the new unit test run the command npm run test:unit FirstStep.spec.js
  • To check the coverage run the command npm run test
  • If you are happy with the implementation then you delete the old tests.
  • To run e2e tests for the component run the command npm run test:e2e -- --tag first on the terminal

Screenshots

The Problem

Screenshot from 2020-03-30 20-52-56

The solution

Note

  • the failing test is the old renamed unit tests i.e FirstStep1.spec.js
  • new tests are listed in the table under components, row FirstStep.vue

Screenshot from 2020-03-31 14-37-04

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the master branch of the repository.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open-source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

Copy link
Contributor

@obulat obulat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start, @JackieBinya ! Could you please delete the old file and lint your tests (there are some quotes, extra spaces etc problems).

const yesRadioSelector = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > div.field.not-selected > label > span.check'
const noRadioSelector = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > div.field.not-selected > label > span.check'
const attributionHeader = '#site-container > div.columns > div.stepper-container.column > div:nth-child(2) > div > h5'
const ccLicenseHeader = '#site-container > div.columns > div.stepper-container.column > div:nth-child(2) > div'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both attributionHeader and ccLicenseHeader basically contain the same text, because parent div of h5 (attributionHeader), and the both should be visible, whether you click yes, no, or don't click at all. What you should better check for is the text inside them: is it Attribution or Creative Commons license.

.init()
.click(yesRadioSelector)
.assert.visible(ccLicenseHeader, 'Click yes:Creative Commons License header is visible in the step below FirstStep')
.assert.visible(nextBtn, 'Next button is visible')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next button is always visible, but it is disabled before you click yes/no, you can test for that before/after you click on radio buttons.

tests/e2e/specs/FirstStep.js Outdated Show resolved Hide resolved
tests/e2e/specs/FirstStep.js Outdated Show resolved Hide resolved
@obulat obulat merged commit ff31a45 into creativecommons:master Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants