Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54241 closed enhancement (fixed)

e2e tests for applications password feature

Reported by: justinahinon's profile justinahinon Owned by: hellofromtonya's profile hellofromTonya
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.9
Component: Build/Test Tools Keywords: has-patch has-unit-tests commit
Focuses: Cc:

Description

This ticket is a sub ticket of #52895.


The applications password feature in WordPress Core is one new introduced feature in WordPress Core a few releases back.

This ticket aims to add e2e tests for this feature.

Change History (13)

This ticket was mentioned in PR #1746 on WordPress/wordpress-develop by JustinyAhin.


3 years ago
#1

  • Keywords has-unit-tests added

Related Trac ticket: https://core.trac.wordpress.org/ticket/54241.


# Test scenarios

## Create a new application password

Given that a test user exists
When I go to Users > Profile, and I create a new application password
I see the new application password success message
And the application name appears in the app password table
And the application password information are present in the response of GET /wp/v2/users/<user_id>/application-passwords

## Create an application password with an existing name

Given that a test user exists
And has an existing application password
When I go to Users > Profile, and I create a new application password with the same name
I should receive an error message, and the new application password should not be created

## Revoke a single application password

Given that a test user exists
And has an existing application password
When I go to Users > Profile
And I click on the Revoke button
The application password should be revoked with a displayed success message
And the application password information should not be present in the response of GET /wp/v2/users/<user_id>/application-passwords

## Bulk revoke applications passwords

Given that a test user exists
And has two existing applications passwords
When I go to Users > Profile
And I click on the Revoke all application passwords button
Then all applications passwords should be removed with a displayed success message
And the applications passwords information should not be present in the response of GET /wp/v2/users/<user_id>/application-passwords

hellofromtonya commented on PR #1746:


3 years ago
#2

@kevin940726 and @tellthemachines this PR is ready for your review. Once approved, I'll get it committed.

#3 @hellofromTonya
3 years ago

  • Keywords needs-testing removed
  • Owner set to hellofromTonya
  • Status changed from new to assigned

kevin940726 commented on PR #1746:


3 years ago
#4

Just found out there's a console error warning in the test output:

https://github.com/WordPress/wordpress-develop/pull/1746/checks?check_run_id=3902891514#step:13:17

I don't think it's a big deal, but would be great if we could get rid of it somehow.

JustinyAhin commented on PR #1746:


3 years ago
#5

Thanks for all the reviews @kevin940726. This is exactly the kind of feedback I was hoping :).

JustinyAhin commented on PR #1746:


3 years ago
#6

Thanks for all the reviews @kevin940726. This is exactly the kind of feedback I was hoping :).

kevin940726 commented on PR #1746:


3 years ago
#7

One more thing I noticed, I think we should follow the coding style guide in tests as well? Not sure why eslint isn't picking those up. Might worth to fix that too in another PR.

JustinyAhin commented on PR #1746:


3 years ago
#8

Just found out there's a console error warning in the test output:

I haven't figured out yet where the console error came from. I remember though it started when making API calls.

JustinyAhin commented on PR #1746:


3 years ago
#9

Still some places not following the style guide though but we can tackle them in another PR (which should fix the eslint issue).

What is needed for the ESLint PR @kevin940726
I can have a look maybe

#10 @hellofromTonya
3 years ago

  • Keywords commit added
  • Status changed from assigned to reviewing

PR has been approved. Marking for commit.

#11 @hellofromTonya
3 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 51966:

Application Passwords: Add end-to-end (e2e) tests.

Adds end-to-end (e2e) tests for the following test scenarios:

  • Create a new application password.
  • Create an application password with an existing name.
  • Revoke a single application password.
  • Bulk revoke applications passwords.

Follow-up to [49109], [49276], [49562], [50001], [50367], [51463].

Props justinahinon, swissspidy, juhise, kevin940726, isabel_brison.
Fixes #54241.

hellofromtonya commented on PR #1746:


3 years ago
#12

Committed via changeset https://core.trac.wordpress.org/changeset/51966.

Thank you everyone for your contribution 🎉

kevin940726 commented on PR #1746:


3 years ago
#13

What is needed for the ESLint PR @kevin940726? I can have a look maybe

Oops, totally missed this. We should configure ESLint so that it'll correctly use the @wordpress/eslint-plugin rulesets and lint the test files. I'm not sure if it's been done before in core though, but it's standard in gutenberg.

Note: See TracTickets for help on using tickets.