-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #853 from dhis2/DHIS2-11939-DHIS2-12054_Complete_h…
…omepage_and_navigation_tests refactor(sidenav): use @dhis2/ui & add tests for homepage and sidenav
- Loading branch information
Showing
24 changed files
with
2,784 additions
and
991 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
771 changes: 771 additions & 0 deletions
771
...ss/fixtures/network/38/show_tiles_with_list_and_add_action_to_all_available_sections.json
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
505 changes: 505 additions & 0 deletions
505
cypress/fixtures/network/38/the_app_has_a_main_navigation.json
Large diffs are not rendered by default.
Oops, something went wrong.
295 changes: 164 additions & 131 deletions
295
cypress/fixtures/network/38/the_user_group_list_can_be_searched.json
Large diffs are not rendered by default.
Oops, something went wrong.
387 changes: 214 additions & 173 deletions
387
cypress/fixtures/network/38/the_user_list_can_be_searched.json
Large diffs are not rendered by default.
Oops, something went wrong.
298 changes: 164 additions & 134 deletions
298
cypress/fixtures/network/38/the_user_role_list_can_be_searched.json
Large diffs are not rendered by default.
Oops, something went wrong.
270 changes: 150 additions & 120 deletions
270
cypress/fixtures/network/38/user_groups_can_be_listed.json
Large diffs are not rendered by default.
Oops, something went wrong.
242 changes: 136 additions & 106 deletions
242
cypress/fixtures/network/38/user_roles_can_be_listed.json
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps' | ||
|
||
Given('the user-manager is on the homepage', () => { | ||
cy.visit('/') | ||
}) | ||
|
||
When('the user-manager clicks on the user list icon of the user tile', () => { | ||
cy.findByRole('heading', { name: 'User' }) | ||
.parents('[data-test="dhis2-uicore-card"]') | ||
.findByRole('button', { name: 'List' }) | ||
.click() | ||
}) | ||
|
||
When('the user-manager clicks on the add user icon of the user tile', () => { | ||
cy.findByRole('heading', { name: 'User' }) | ||
.parents('[data-test="dhis2-uicore-card"]') | ||
.findByRole('button', { name: 'Add' }) | ||
.click() | ||
}) | ||
|
||
When( | ||
'the user-manager clicks on the add user group icon of the user group tile', | ||
() => { | ||
cy.findByRole('heading', { name: 'User group' }) | ||
.parents('[data-test="dhis2-uicore-card"]') | ||
.findByRole('button', { name: 'Add' }) | ||
.click() | ||
} | ||
) | ||
|
||
When( | ||
'the user-manager clicks on the add user role icon of the user role tile', | ||
() => { | ||
cy.findByRole('heading', { name: 'User role' }) | ||
.parents('[data-test="dhis2-uicore-card"]') | ||
.findByRole('button', { name: 'Add' }) | ||
.click() | ||
} | ||
) | ||
|
||
When( | ||
'the user-manager clicks on the user group list icon of the user group tile', | ||
() => { | ||
cy.findByRole('heading', { name: 'User group' }) | ||
.parents('[data-test="dhis2-uicore-card"]') | ||
.findByRole('button', { name: 'List' }) | ||
.click() | ||
} | ||
) | ||
|
||
When( | ||
'the user-manager clicks on the user role list icon of the user role tile', | ||
() => { | ||
cy.findByRole('heading', { name: 'User role' }) | ||
.parents('[data-test="dhis2-uicore-card"]') | ||
.findByRole('button', { name: 'List' }) | ||
.click() | ||
} | ||
) | ||
|
||
Then('the user-manager should be redirected to the user list page', () => { | ||
cy.url().should('match', /[/]users/) | ||
cy.findByRole('nav').should('exist') | ||
}) | ||
|
||
Then('the user-manager should be redirected to the add user form page', () => { | ||
cy.url().should('match', /[/]users[/]new/) | ||
cy.get('form').should('exist') | ||
}) | ||
|
||
Then( | ||
'the user-manager should be redirected to the add user group form page', | ||
() => { | ||
cy.url().should('match', /[/]user-groups[/]new/) | ||
} | ||
) | ||
|
||
Then( | ||
'the user-manager should be redirected to the add user role form page', | ||
() => { | ||
cy.url().should('match', /[/]user-roles[/]new/) | ||
} | ||
) | ||
|
||
Then( | ||
'the user-manager should be redirected to the user group list page', | ||
() => { | ||
cy.url().should('match', /[/]user-groups/) | ||
} | ||
) | ||
|
||
Then('the user-manager should be redirected to the user role list page', () => { | ||
cy.url().should('match', /[/]user-roles/) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Feature: The app has a main navigation | ||
|
||
Scenario: No link is active | ||
Given the user is on the homepage | ||
Then no link in the main navigation should be active | ||
|
||
Scenario: The user navigates to the users page | ||
Given the user is on the homepage | ||
When the user clicks the users link in the main navigation | ||
Then the user should be redirected to the user list page | ||
|
||
Scenario: The user navigates to the user groups page | ||
Given the user is on the homepage | ||
When the user clicks the user groups link in the main navigation | ||
Then the user should be redirected to the user group list page | ||
|
||
Scenario: The user navigates to the user roles page | ||
Given the user is on the homepage | ||
When the user clicks the user roles link in the main navigation | ||
Then the user should be redirected to the user role list page | ||
|
||
Scenario: The users link is active | ||
Given the user is on the user list page | ||
Then the users link in the main navigation should be active | ||
|
||
Scenario: The user groups link is active | ||
Given the user is on the user group list page | ||
Then the user groups link in the main navigation should be active | ||
|
||
Scenario: The user roles link is active | ||
Given the user is on the user role list page | ||
Then the user roles link in the main navigation should be active |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps' | ||
|
||
Given('the user is on the homepage', () => { | ||
cy.visit('/') | ||
}) | ||
|
||
Given('the user is on the user group list page', () => { | ||
cy.visit('/') | ||
cy.findByRole('nav').findByText('User group').click() | ||
}) | ||
|
||
Given('the user is on the user list page', () => { | ||
cy.visit('/') | ||
cy.findByRole('nav').findByText('User').click() | ||
}) | ||
|
||
Given('the user is on the user role list page', () => { | ||
cy.visit('/') | ||
cy.findByRole('nav').findByText('User role').click() | ||
}) | ||
|
||
When('the user clicks the user groups link in the main navigation', () => { | ||
cy.findByRole('nav').findByText('User group').click() | ||
}) | ||
|
||
When('the user clicks the user roles link in the main navigation', () => { | ||
cy.findByRole('nav').findByText('User role').click() | ||
}) | ||
|
||
When('the user clicks the users link in the main navigation', () => { | ||
cy.findByRole('nav').findByText('User').click() | ||
}) | ||
|
||
Then('no link in the main navigation should be active', () => { | ||
cy.findByRole('nav').find('li.active').should('not.exist') | ||
}) | ||
|
||
Then('the users link in the main navigation should be active', () => { | ||
cy.findByRole('nav').find('li.active').should('have.length', 1) | ||
cy.findByRole('nav') | ||
.findByText('User') | ||
.parents('li') | ||
.should('have.class', 'active') | ||
}) | ||
|
||
Then('the user groups link in the main navigation should be active', () => { | ||
cy.findByRole('nav').find('li.active').should('have.length', 1) | ||
cy.findByRole('nav') | ||
.findByText('User group') | ||
.parents('li') | ||
.should('have.class', 'active') | ||
}) | ||
|
||
Then('the user roles link in the main navigation should be active', () => { | ||
cy.findByRole('nav').find('li.active').should('have.length', 1) | ||
cy.findByRole('nav') | ||
.findByText('User role') | ||
.parents('li') | ||
.should('have.class', 'active') | ||
}) | ||
|
||
Then('the user should be redirected to the user list page', () => { | ||
cy.url().should('match', /[/]users$/) | ||
}) | ||
|
||
Then('the user should be redirected to the user group list page', () => { | ||
cy.url().should('match', /[/]user-groups/) | ||
}) | ||
|
||
Then('the user should be redirected to the user role list page', () => { | ||
cy.url().should('match', /[/]user-roles$/) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.container { | ||
display: grid; | ||
grid-template-columns: 220px 1fr; | ||
height: 100%; | ||
} | ||
|
||
.content { | ||
padding: 16px; | ||
} |
Oops, something went wrong.