|
| 1 | +Feature: Using GridFieldConfigurablePaginator in place of GridFieldPaginator |
| 2 | +As a content editor |
| 3 | +I want to use the functionality in GridFieldConfigurablePaginator |
| 4 | + |
| 5 | + Background: |
| 6 | + Given I add an extension "Symbiote\GridFieldExtensions\Tests\Stub\Extension\ConfigurablePaginatorExtension" to the "SilverStripe\FrameworkTest\Model\Company" class |
| 7 | + And I add an extension "Symbiote\GridFieldExtensions\Tests\Stub\Extension\NoCoworkersExtension" to the "SilverStripe\FrameworkTest\Model\Employee" class |
| 8 | + And there are the following SilverStripe\FrameworkTest\Model\Employee records |
| 9 | + """ |
| 10 | + employee1: |
| 11 | + Name: "Adam" |
| 12 | + employee2: |
| 13 | + Name: "Jim" |
| 14 | + employee3: |
| 15 | + Name: "Tom" |
| 16 | + employee4: |
| 17 | + Name: "James" |
| 18 | + employee5: |
| 19 | + Name: "Jane" |
| 20 | + employee6: |
| 21 | + Name: "Chloe" |
| 22 | + employee7: |
| 23 | + Name: "Amy" |
| 24 | + employee8: |
| 25 | + Name: "Sarah" |
| 26 | + employee9: |
| 27 | + Name: "Sam" |
| 28 | + employee10: |
| 29 | + Name: "Ashleigh" |
| 30 | + employee11: |
| 31 | + Name: "Tiago" |
| 32 | + employee12: |
| 33 | + Name: "Catalina" |
| 34 | + employee13: |
| 35 | + Name: "Oscar" |
| 36 | + employee14: |
| 37 | + Name: "Lima" |
| 38 | + employee15: |
| 39 | + Name: "Danie" |
| 40 | + employee16: |
| 41 | + Name: "Lucia" |
| 42 | + """ |
| 43 | + Given there are the following SilverStripe\FrameworkTest\Model\Company records |
| 44 | + """ |
| 45 | + company-1: |
| 46 | + Name: "Company One" |
| 47 | + Employees: |
| 48 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee1 |
| 49 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee2 |
| 50 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee3 |
| 51 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee4 |
| 52 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee5 |
| 53 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee6 |
| 54 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee7 |
| 55 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee8 |
| 56 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee9 |
| 57 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee10 |
| 58 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee11 |
| 59 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee12 |
| 60 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee13 |
| 61 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee14 |
| 62 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee15 |
| 63 | + - =>SilverStripe\FrameworkTest\Model\Employee.employee16 |
| 64 | + """ |
| 65 | + And the "group" "EDITOR" has permissions "Access to 'Pages' section" and "Access to 'GridField Test Navigation' section" and "TEST_DATAOBJECT_EDIT" |
| 66 | + And I am logged in as a member of "EDITOR" group |
| 67 | + And I go to "/admin/gridfield-test-navigation" |
| 68 | + And I click "Company One" in the "#Form_EditForm" element |
| 69 | + And I click the "Employees" CMS tab |
| 70 | + |
| 71 | + Scenario: I can navigate through a paginated gridfield |
| 72 | + When I should see "Company One" in the ".breadcrumbs-wrapper" element |
| 73 | + # Check we have the first and last expected values for page 1 |
| 74 | + Then I should see "Adam" in the "#Form_ItemEditForm" element |
| 75 | + And I should see "Danie" in the "#Form_ItemEditForm" element |
| 76 | + # Check we don't have the first expected value for page 2 |
| 77 | + And I should not see "Lucia" in the "#Form_ItemEditForm" element |
| 78 | + # Check the paginator elements render correctly |
| 79 | + And I should see "1–15 of 16" in the ".grid-field__paginator_numbers" element |
| 80 | + And the ".pagination-page-number" element should contain "<input class=\"text no-change-track\" value=\"1\" data-skip-autofocus=\"true\">" |
| 81 | + And I should see "15" in the ".pagination-page-size-select" element |
| 82 | + # Go to page 2 using buttons |
| 83 | + Given I press the "Next" button |
| 84 | + Then I should not see "Adam" in the "#Form_ItemEditForm" element |
| 85 | + And I should not see "Danie" in the "#Form_ItemEditForm" element |
| 86 | + And I should see "Lucia" in the "#Form_ItemEditForm" element |
| 87 | + And I should see "16–16 of 16" in the ".grid-field__paginator_numbers" element |
| 88 | + And the ".pagination-page-number" element should contain "<input class=\"text no-change-track\" value=\"2\" data-skip-autofocus=\"true\">" |
| 89 | + # Go to page 1 using the page number input field |
| 90 | + Given I click on the ".pagination-page-number input" element |
| 91 | + And I press the "Backspace" key globally |
| 92 | + And I type "1" in the field |
| 93 | + And I press the "Enter" key globally |
| 94 | + Then I should see "Adam" in the "#Form_ItemEditForm" element |
| 95 | + And I should see "Danie" in the "#Form_ItemEditForm" element |
| 96 | + And I should not see "Lucia" in the "#Form_ItemEditForm" element |
| 97 | + And I should see "1–15 of 16" in the ".grid-field__paginator_numbers" element |
| 98 | + And the ".pagination-page-number" element should contain "<input class=\"text no-change-track\" value=\"1\" data-skip-autofocus=\"true\">" |
| 99 | + And I should see "15" in the ".pagination-page-size-select" element |
0 commit comments