Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT Additional behat tests #226

Merged

Conversation

sabina-talipova
Copy link
Contributor

@sabina-talipova sabina-talipova commented Feb 15, 2024

Description

Additional Behat tests to test user interaction with LinField using the keyboard.
Tests check the ability to create links and sort using "drag and drop".

Manual testing steps

Not required

Issues

Pull request checklist

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    • Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • Code changes follow our coding conventions
  • This change is covered with tests (or tests aren't necessary for this change)
  • Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
  • CI is green

@sabina-talipova sabina-talipova marked this pull request as ready for review February 15, 2024 22:08
/**
* @Given /^I type "([^"]+)" in the field$/
*/
public function iTypeInField(string $data)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public function iTypeInField(string $data)
public function iTypeInTheField(string $data)

Method name should match Given regex

This method should be put into behat-extension BasicContext

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Moved in behat-extension. See

Comment on lines 33 to 36
/**
* @Given /^the active element is "([^"]+)"$/
*/
public function isCurrentActiveElement(string $selector)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/**
* @Given /^the active element is "([^"]+)"$/
*/
public function isCurrentActiveElement(string $selector)
/**
* @Given /^the active element should be "([^"]+)"$/
*/
public function theActiveElementShouldBe(string $selector)

Updated both Given regex and the method name to be a little more standard

You'll need to update references in feature files too

This method should be put into behat-extension BasicContext

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Moved in behat-extension. See

/**
* @Given /^I focus on the "([^"]+)" element$/
*/
public function theHasALinkInLinkField(string $selector)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public function theHasALinkInLinkField(string $selector)
public function iFocusOnTheElement(string $selector)

Method name should match Given regex

This method should be put into behat-extension BasicContext

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Moved in behat-extension. See

use PHPUnit\Framework\Assert;
use SilverStripe\BehatExtension\Context\SilverStripeContext;

class FeatureContext extends SilverStripeContext
Copy link
Member

Choose a reason for hiding this comment

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

Move the methods in this class to behat-extension BasicContext and delete this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

behat.yml Outdated
@@ -10,13 +10,13 @@ default:
paths:
- '%paths.modules.linkfield%/tests/behat/features'
contexts:
- SilverStripe\Framework\Tests\Behaviour\FeatureContext
Copy link
Member

Choose a reason for hiding this comment

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

Just leave this in

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

behat.yml Outdated
- SilverStripe\Framework\Tests\Behaviour\CmsFormsContext
- SilverStripe\Framework\Tests\Behaviour\CmsUiContext
- SilverStripe\BehatExtension\Context\BasicContext
- SilverStripe\BehatExtension\Context\LoginContext
- SilverStripe\LinkField\Tests\Behat\FeatureContext
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- SilverStripe\LinkField\Tests\Behat\FeatureContext

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

behat.yml Outdated
- SilverStripe\Framework\Tests\Behaviour\CmsFormsContext
- SilverStripe\Framework\Tests\Behaviour\CmsUiContext
- SilverStripe\BehatExtension\Context\BasicContext
- SilverStripe\BehatExtension\Context\LoginContext
- SilverStripe\LinkField\Tests\Behat\FeatureContext
- SilverStripe\BehatExtension\Context\FixtureContext:
Copy link
Member

Choose a reason for hiding this comment

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

Could you change the FixtureContext bit to have the exact same indentation as this - it's very weird and it's like that for some reason that I forget, though I do know it definately works

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Comment on lines 7 to 8
Given I add an extension "SilverStripe\FrameworkTest\LinkField\Extensions\LinkPageExtension" to the "Page" class
And I go to "/dev/build?flush"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Given I add an extension "SilverStripe\FrameworkTest\LinkField\Extensions\LinkPageExtension" to the "Page" class
And I go to "/dev/build?flush"
Given I add an extension "SilverStripe\FrameworkTest\LinkField\Extensions\LinkPageExtension" to the "Page" class
And I go to "/dev/build?flush"

Use the same indentation for all the statements within Background/Scenario - that's generally what's done in other feature files in the code base

The this for the entire file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

And I press the "Enter" key globally
And I wait for 2 seconds

# Test accessability of the LinkField drag and drop
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Test accessability of the LinkField drag and drop
# Test accessibility of the LinkField keyboard sorting

Drag and drop is using the mouse :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

And I should see "Page on this site" in the ".modal-header" element
And I wait for 2 seconds

# Test accessability of the modal form
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Test accessability of the modal form
# Test accessibility of the modal form

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@sabina-talipova sabina-talipova force-pushed the pulls/4/behat-accessability-test branch 4 times, most recently from a19bac6 to 7df6170 Compare February 16, 2024 01:34
@sabina-talipova
Copy link
Contributor Author

@sabina-talipova sabina-talipova changed the title ENH Additional behat tests MNT Additional behat tests Feb 16, 2024
Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

Approved, will merge when silverstripe/silverstripe-behat-extension#263 is merged and tagged

@emteknetnz
Copy link
Member

Have merged and released behat-extenstion pr, re-running behat tests on this pr now

@emteknetnz emteknetnz merged commit c74c049 into silverstripe:4 Feb 18, 2024
12 checks passed
@emteknetnz emteknetnz deleted the pulls/4/behat-accessability-test branch February 18, 2024 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants