AutolabJS / autolabcli

Command line client for AutolabJS
https://autolabjs.github.io
GNU General Public License v3.0
10 stars 10 forks source link

bugs in feature tests #60

Closed prasadtalasila closed 6 years ago

prasadtalasila commented 6 years ago

Description

The feature tests need to be updated for init, exit and prefs commands.

Steps to Reproduce

  1. Run npm run cucumber
  2. Wait for tests to fail

Expected behavior: [What you expect to happen] All feature tests pass

Actual behavior: [What actually happens] Four feature tests fail. The log is as follows.

$npm run cucumber

> autolabjs@1.0.0 cucumber /home/vikram/TSRK/professional/PhD/student_projects/autolab/autolabcli
> cucumber-js 'test/feature/features' -r 'test/feature/steps'

? Enter your AutolabJS username: AutolabJS_Tester
? Enter your AutolabJS password: [hidden]
? Enter your AutolabJS username: AutolabJS_Tester
? Enter your AutolabJS password: [hidden]
/ Authenticating you, please wait ........F....F....F.

Failures:

1) Scenario: Init coomand with flags -u and -p for correct login credentials # test/feature/features/init.feature:4
   ✔ Before # test/feature/steps/init.js:16
   ✔ Given a valid username as 'AutolabJS_Tester' and corresponding password as 'autolabjs123' # test/feature/steps/init.js:24
   ✔ When I run init command with 'AutolabJS_Tester' as username and 'autolabjs123' as password using 'flags' # test/feature/steps/init.js:29
   ✖ Then My login credentials and private token should be stored locally # test/feature/steps/init.js:49
       AssertionError
           + expected - actual

           -testuser3
           +AutolabJS_Tester

           at World.Then (/home/vikram/TSRK/professional/PhD/student_projects/autolab/autolabcli/test/feature/steps/init.js:55:30)
   ✔ After # test/feature/steps/init.js:20

2) Scenario: Init command without flags for correct login credentials # test/feature/features/init.feature:9
   ✔ Before # test/feature/steps/init.js:16
   ✔ Given a valid username as 'AutolabJS_Tester' and corresponding password as 'autolabjs123' # test/feature/steps/init.js:24
   ✔ When I run init command with 'AutolabJS_Tester' as username and 'autolabjs123' as password using 'prompt' # test/feature/steps/init.js:29
   ✖ Then My login credentials and private token should be stored locally # test/feature/steps/init.js:49
       AssertionError
           + expected - actual

           -testuser3
           +AutolabJS_Tester

           at World.Then (/home/vikram/TSRK/professional/PhD/student_projects/autolab/autolabcli/test/feature/steps/init.js:55:30)
   ✔ After # test/feature/steps/init.js:20

3) Scenario: Init command with flags -u and -p for incorrect login credentials # test/feature/features/init.feature:14
   ✔ Before # test/feature/steps/init.js:16
   ✔ Given a valid username as 'AutolabJS_Tester' and corresponding password as 'autolabjs123' # test/feature/steps/init.js:24
   ✔ When I run init command with 'AutolabJS_Tester' as username and 'autolabjs121' as password using 'flags' # test/feature/steps/init.js:29
   ✖ Then I should be displayed a warning message when input is given using 'flags' # test/feature/steps/init.js:60
       AssertionError: expected '' to include 'Invalid Username or Password'
           at World.Then (/home/vikram/TSRK/professional/PhD/student_projects/autolab/autolabcli/test/feature/steps/init.js:68:24)
   ✔ After # test/feature/steps/init.js:20

4) Scenario: Prefs command to change language # test/feature/features/prefs.feature:4
   ✔ Before # test/feature/steps/init.js:16
   ✔ Given I have already logged in # test/feature/steps/exit.js:15
   ✔ When I run prefs command with 'changelang' # test/feature/steps/prefs.js:17
   ✖ Then I should be able to change the submission language # test/feature/steps/prefs.js:30
       AssertionError
           + expected - actual

           -python3
           +cpp14

           at World.Then (/home/vikram/TSRK/professional/PhD/student_projects/autolab/autolabcli/test/feature/steps/prefs.js:31:82)
   ✔ After # test/feature/steps/init.js:20

5) Scenario: Prefs command to change server # test/feature/features/prefs.feature:9
   ✔ Before # test/feature/steps/init.js:16
   ✔ Given I have already logged in # test/feature/steps/exit.js:15
   ✔ When I run prefs command with 'changeserver' # test/feature/steps/prefs.js:17
   ✖ Then I should be able to change the submission server # test/feature/steps/prefs.js:34
       AssertionError
           + expected - actual

            {
           -  "host": "xyz.com"
           -  "port": "9090"
           +  "host": "abc.com"
           +  "port": "5678"
            }

           at Proxy.assertEqual (/home/vikram/TSRK/professional/PhD/student_projects/autolab/autolabcli/node_modules/chai/lib/chai/core/assertions.js:1020:19)
           at Proxy.methodWrapper (/home/vikram/TSRK/professional/PhD/student_projects/autolab/autolabcli/node_modules/chai/lib/chai/utils/addMethod.js:57:25)
           at World.Then (/home/vikram/TSRK/professional/PhD/student_projects/autolab/autolabcli/test/feature/steps/prefs.js:35:79)
   ✔ After # test/feature/steps/init.js:20

6) Scenario: Prefs command to show preferences # test/feature/features/prefs.feature:14
   ✔ Before # test/feature/steps/init.js:16
   ✔ Given I have already logged in # test/feature/steps/exit.js:15
   ✔ When I run prefs command with 'show' # test/feature/steps/prefs.js:17
   ✖ Then I should be able to see the preferences # test/feature/steps/prefs.js:41
       AssertionError: expected log to have been called with arguments ┌───────────────┬─────────────────────────┐
       │ Preferences   │ Values                  │
       ├───────────────┼─────────────────────────┤
       │ Language      │ cpp14                   │
       ├───────────────┼─────────────────────────┤
       │ Server host   │ abc.com                 │
       ├───────────────┼─────────────────────────┤
       │ Server port   │ 5678                    │
       └───────────────┴─────────────────────────┘Call 1:
       ┌───────────────┬─────────────────────────┐
       │ Preferences   │ Values                  │
       ├───────────────┼─────────────────────────┤
       │ Language      │ python3                 │
       │ Language      │ cpp14                   │
       ├───────────────┼─────────────────────────┤
       │ Server host   │ xyz.com                 │
       │ Server host   │ abc.com                 │
       ├───────────────┼─────────────────────────┤
       │ Server port   │ 9090                    │
       │ Server port   │ 5678                    │
       └───────────────┴─────────────────────────┘
       Call 2:
       Your submission server has been chaged to abc.com at port 5678 ┌───────────────┬─────────────────────────┐
       │ Preferences   │ Values                  │
       ├───────────────┼─────────────────────────┤
       │ Language      │ cpp14                   │
       ├───────────────┼─────────────────────────┤
       │ Server host   │ abc.com                 │
       ├───────────────┼─────────────────────────┤
       │ Server port   │ 5678                    │
       └───────────────┴─────────────────────────┘ 
       Call 3:
       Your submission language has been chaged to cpp14 ┌───────────────┬─────────────────────────┐
       │ Preferences   │ Values                  │
       ├───────────────┼─────────────────────────┤
       │ Language      │ cpp14                   │
       ├───────────────┼─────────────────────────┤
       │ Server host   │ abc.com                 │
       ├───────────────┼─────────────────────────┤
       │ Server port   │ 5678                    │
       └───────────────┴─────────────────────────┘ 
           at Timeout.setTimeout [as _onTimeout] (/home/vikram/TSRK/professional/PhD/student_projects/autolab/autolabcli/test/feature/steps/prefs.js:53:36)
           at ontimeout (timers.js:475:11)
           at tryOnTimeout (timers.js:310:5)
           at Timer.listOnTimeout (timers.js:270:5)
   ✔ After # test/feature/steps/init.js:20

9 scenarios (6 failed, 3 passed)
27 steps (6 failed, 21 passed)
0m00.657s
/ Authenticating you, please wait ...^C

Reproduces how often: [What percentage of the time does it reproduce?] Every time npm run cucumber is run

prasadtalasila commented 6 years ago

PR #67 solves the issue.