Skip to content

Move notifications context API steps used by core into core - #31665

Merged
patrickjahns merged 4 commits into
masterfrom
notifications-context-test-steps-to-core
Jun 7, 2018
Merged

patrickjahns merged 4 commits into
masterfrom
notifications-context-test-steps-to-core

Conversation

@phil-davis

@phil-davis phil-davis commented Jun 6, 2018 •

Copy link
Copy Markdown
Contributor

Description

  1. Make a NotificationsCoreContext that has the relevant step code for examining notifications through its API.
  2. Move WebUINotificationsContext into core - all the code there was relevant to testing behavior from core or from other apps.
  3. Move the other notifications page objects also - they were all needed to let WebUINotificationsContext do its thing.
  4. Adjust behat.yml and bootstrap.php so they do not try to look inside the notifications app for acceptance test code.

Related Issue

Motivation and Context

Acceptance test code (scenario steps...) that is needed/used by core acceptance test scenarios needs to be in core. In this case, move relevant scenario steps (and related page objects that define the webUI elements) out of the notifications app and into core, so they can be used by core or any other app, without that app having to find a way to get hold of NotificationsContext... from somewhere inside the notifications app.

After this change, other apps can just enable or disable the notifications app and then can use any of the acceptance test steps in core to examine the behavior of their app when it produces notifications.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Acceptance test refactoring

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@phil-davis

phil-davis commented Jun 6, 2018 •

Copy link
Copy Markdown
Contributor Author

1st commit removes the need for core API acceptance tests to load NotificationsContext from inside the notifications app. The needed scenario steps are put into NotificationsCoreContext in core. Basically they are the Then steps that test what notifications have arrived, what they say, and how many of them there are. This lets core (or other apps) see/test what has happened to notifications that they expect to have generated from their own actions.

2nd commit does the same for the core webUI acceptance tests related to notifications.

3rd commit gets rid of some unneeded notifications app enabling in the drone yml code.

4th commit tags the features that need the notifications app with:

@app-required @notifications-app-required

So anything that cares can easily run (or not) scenarios that use/need the notifications app. In future we can tag other stuff like:

@app-required @activity-app-required

And you can always avoid running any scenario that needs an extra app installed, by doing

--tags ~@app-required

Purposely generating "dummy" notifications for testing is just the responsibility of the notifications app test code, and so that stays where it is now.

@codecov

codecov Bot commented Jun 6, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #31665 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #31665   +/-   ##
=========================================
  Coverage     62.89%   62.89%           
  Complexity    18418    18418           
=========================================
  Files          1154     1154           
  Lines         69157    69157           
  Branches       1260     1260           
=========================================
  Hits          43499    43499           
  Misses        25289    25289           
  Partials        369      369
Flag Coverage Δ Complexity Δ
#javascript 52.39% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 64.1% <ø> (ø) 18418 <ø> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 031fded...d0b1c37. Read the comment docs.

@phil-davis
phil-davis force-pushed the notifications-context-test-steps-to-core branch from 140e908 to 94dc31b Compare June 7, 2018 01:45
@phil-davis phil-davis changed the title [WIP] Move notifications context API steps used by core into core Move notifications context API steps used by core into core Jun 7, 2018
@phil-davis
phil-davis force-pushed the notifications-context-test-steps-to-core branch from d17223b to 77c3402 Compare June 7, 2018 08:46
@phil-davis
phil-davis force-pushed the notifications-context-test-steps-to-core branch from 77c3402 to d1b18fd Compare June 7, 2018 08:51
@phil-davis

phil-davis commented Jun 7, 2018 •

Copy link
Copy Markdown
Contributor Author

This should let us, in files_primary_s3 either:

  • clone notifications app when doing API and webUI tests, then let all the tests run (notifications app will get enabled for test scenarios that use it)
    or
  • run all tests except those tagged @notifications-app-required
    or
  • run all tests except those tagged @app-required (which will avoid running other scenarios in future that might need some "random" app to be installed)

@patrickjahns @DeepDiver1975 @PVince81 - anyone like to approve and this can be merged to get in the overnight build?

@phil-davis
phil-davis requested a review from PVince81 June 7, 2018 16:08
@phil-davis

Copy link
Copy Markdown
Contributor Author

Note: backport needs to be added to Accept user share stable10 #31613

require_once 'bootstrap.php';

/**
* Defines application features from the specific context.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what does this essentially mean?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Cut and paste from ``NotificationsContext``` in notifications app. I guess someone wrote this so as to have text in the docblock to pass a code style checker :)

* @author Joas Schilling <[email protected]>
* @author Thomas Müller <[email protected]>
*
* @copyright Copyright (c) 2016, ownCloud, Inc.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

missing you as author?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The code is cut from ``NotificationsContext``` in notifications app. These were the authors there. I have no idea who wrote which functions... so am preserving what was in the header.

}

/**
* @When /^the user reacts with "(Accept|Decline)" to all notifications on the webUI$/

@patrickjahns patrickjahns Jun 7, 2018 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isn't that more related to accepting/rejecting shares?

meaning - while it is done in the notification ui part - the accepting/rejecting is a function of the sharing app?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This whole file is copied as-is from notifications app (all the functions were needed by core).
I agree, the words could have "sharing" somewhere - e.g.

the user reacts with "(Accept|Decline)" to all sharing notifications on the webUI

and the step itself could live in a Sharing Context (but it needs both sharing and notifications together to be functional).

Anyway, this refactoring was about moving existing code. We can review the content of existing code any time we like.

@patrickjahns
patrickjahns self-requested a review June 7, 2018 22:47

@patrickjahns patrickjahns left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@patrickjahns
patrickjahns merged commit 9d12b63 into master Jun 7, 2018
@phil-davis

Copy link
Copy Markdown
Contributor Author

Backported commits to #31613 and that is now merged to stable10

@PVince81 PVince81 modified the milestones: development, QA Jun 13, 2018
@lock

lock Bot commented Jul 31, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants