Closed Bug 1038618 Opened 10 years ago Closed 8 years ago

[testing] Test that one time tasks are marked completed on finishing

Categories

(Mozilla QA Graveyard :: One and Done, defect, P5)

Version 2
x86_64
Linux
defect

Tracking

(Not tracked)

RESOLVED WONTFIX
Future

People

(Reporter: bitgeeky, Unassigned)

Details

Attachments

(2 files)

This bug is to write a test case to verify that one time tasks are marked completed once they get finished and the user is not able to take them up again.
There is a small challenge here.
How does a user gets to know that the task is one time before actually completing it ?
In the test how would we filter the one time task out of all the other tasks on the staging website ?
Flags: needinfo?(bob.silverberg)
bitgeeky: Here's how: Create the task yourself using the API! That way you can configure it exactly the way you want (i.e., as a one-time task), and then, in the test, you can navigate directly to that task, as you'll know its ID. This is actually the main reason I created the task API in the first place. It wasn't so much to be able to test filtering as it was to be able to create tasks in exactly the state we need for testing.
Flags: needinfo?(bob.silverberg)
Assignee: nobody → mozpankaj1994
Test Case:

1 Create a one time task using Task API
2 Create an existing user using User API
3 Login as an existing user and directly navigate to the one time task
4 Click Get started button
5 Assert that the Save for later, Abandon and Complete task button appear
6 Navigate to home page and assert that the user dashboard shows a task in progress
7 Logout and again login as a different existing user
8 Navigate to task and assert it shows a Taken button and there is not Get started button
9 Logout and again login as the previous user who took the one time task
10 Navigate to the one time task
11 Finish the task and click no thanks on the task feedback page
12 Assert that the one time task appears in the completes tasks list on user profile details page
13 Navigate to one time task
14 Assert that it is mark completed and there is no Get started button
Bob, please let me know if the test case looks fine to you.
Flags: needinfo?(bob.silverberg)
(In reply to Pankaj Malhotra (:bitgeeky) from comment #3)

It looks great, bitgeeky!  The only thing I would change is that you don't need quite so many asserts at step 5, as we are already checking those in another test. I would just assert that "Save for later" is there.

Also, you'll need to create 2 users in step 2, but you would have figured that out as soon as you tried to write the test.

> Test Case:
> 
> 1 Create a one time task using Task API
> 2 Create an existing user using User API
> 3 Login as an existing user and directly navigate to the one time task
> 4 Click Get started button
> 5 Assert that the Save for later, Abandon and Complete task button appear
> 6 Navigate to home page and assert that the user dashboard shows a task in
> progress
> 7 Logout and again login as a different existing user
> 8 Navigate to task and assert it shows a Taken button and there is not Get
> started button
> 9 Logout and again login as the previous user who took the one time task
> 10 Navigate to the one time task
> 11 Finish the task and click no thanks on the task feedback page
> 12 Assert that the one time task appears in the completes tasks list on user
> profile details page
> 13 Navigate to one time task
> 14 Assert that it is mark completed and there is no Get started button
Flags: needinfo?(bob.silverberg)
Bob, There is a problem with what we are trying to do here.

BIDPOM is not allowing logout and login as a different user in a row.

After the first user logs out and when the second one tries to login, BIDPOM doesn't prompts for new email and password, infact it uses the credentials of old user only so there is no use of even supplying the new credentials.

Hence, its not allowing to change user during test run.

Do you know of any possible fix for this ? (Something that would destroy the session completely and prompt for new email and password)

If you want to have a look at the code I am working on is here:
https://github.com/bitgeeky/oneanddone-tests/compare/OneTimeTask#diff-66fab2bff45b30294f29955a303fc6c3R31
Flags: needinfo?(bob.silverberg)
After spending lot of time on this, I also opened an issue for the BIDPOM repository itself.
https://github.com/mozilla/bidpom/issues/82
bitgeeky: It sounds like it may be a limitation of bidpom, that it's not set up to deal with the use case of switching users during a browser session. That is something that could be added to bidpom, but we might want to consider that outside of the scope of this project.

Here's what I'd do: Break it into 2 tests.

In test 1 we'd create a one-time task via the API, log in, take the task, complete the task, and then verify that it is now listed as completed and cannot be taken again.

In test 2 we'd create another one-time task via the API, but this time also create an open attempt for an existing user (the API will likely need to be enhanced in order to be able to do that). That would create the precondition for the test. Then we'd log in as a different user and verify that the task is listed as Taken and cannot be taken by the currently logged in user.

Doing the above will get around the issue of not being able to log in as 2 different users during a test. We will want an API for creating task attempts anyway for other testing.
Flags: needinfo?(bob.silverberg)
Thanks Bob. This sounds good to me.

I also talked to :zac and :bebe about this issue and they advised me to trigger a new browser within the test for new user.

I really liked the idea of launching a new browser. I am trying it that way first(though it will be a bit complex to play with properties of pytest-mozwebqa)

If I am able to pass through then it will be good otherwise I also like your idea of splitting the test in two parts.

Working on this.
Added required css selector.
Attachment #8459006 - Flags: review?(bob.silverberg)
The test works fine on adding the required css selector.
Attachment #8459007 - Flags: review?(bob.silverberg)
Opened a separate bug for updating the Task API Bug 1042213 

Working on updating the API.
API updated.

Splitting the test into two parts.

1 test_one_time_tasks_are_marked_completed_on_completion(already made a pull for this, so would just update it because of the changes in API)

2 test_completed_one_time_task_can_not_be_taken(TBD)
Opened a separate bug for second test Bug 1043794

All requirements for this bug are complete now.
Comment on attachment 8459007 [details] [review]
Link to Github pull-request: https://github.com/mozilla/oneanddone-tests/pull/16

Great work, :bitgeeky. I have made a number of comments in the PR which need to be addressed, but it's a very good start.
Attachment #8459007 - Flags: review?(bob.silverberg) → review-
Priority: -- → P5
Target Milestone: --- → Future
Assignee: mozpankaj1994 → nobody
We are not going to use Bugzilla for required tests. We will use GitHub issues for that.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: