xwp / unsplash-wp

GNU General Public License v2.0
9 stars 3 forks source link

Improve the end to end testing coverage of the Unsplash plugin #126

Closed bmattb closed 4 years ago

bmattb commented 4 years ago

Feature description

As XWP we want to ensure that we are consistently delivering high quality code to our clients.

@spacedmonkey has previously called out that there is an opportunity within this project to improve the overall testing coverage

As it currently stands we are at 93% on PHP, JS no coverage, no end to end tests


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  1. Onboarding
    • Activate plugin and onboarding message shows.
    • Adding a manual api key.
      • Valid key enter, success message is shown.
      • Invalid key enter, fail message is shown.
  2. Search
    • Search for valid search term results are shown.
    • Search for invalid search term, no results found message is shown.
  3. Insert image via block editor
  4. Insert cover via block editor
  5. Insert gallery block ( not sure that unsplash tab doesn't show )
  6. Insert image via classic editor
  7. Select an unsplash image as featured image via classic editor
  8. Select an unsplash image as featured image via block editor

Implementation brief

  1. Implement e2e code coverage.
  2. Write to cover cases listed above.

QA testing instructions

Demo

Changelog entry

bmattb commented 4 years ago

@spacedmonkey will write the implementation brief for this.

spacedmonkey commented 4 years ago

Worth noting, I tried my hardest to add some tests where image is inserted into content. But this has a number of issues.

  1. Inserting images did not working travis. I think because it is a file permission error, extremely hard to debug.
  2. It is a variable time to import an image, as time will likely timeout.
  3. Reimporting the same image in tests, is not a real test, as the second time around it will not reimport.

The tests for now, get us to clicking the import button and not what happens after that. There is no error handling on clicking import and it failing, so very hard to tests in an automated way right now. I have flagged we need error handling on this import to @bmattb .