-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[redhat-3.10] ui: breadcrumbs on new ui (PROJQUAY-5452) (#2490)
* ui: breadcrumbs on new ui (PROJQUAY-5452) (#1893) * UI: Breadcrumbs fix (PROJQUAY-5452) * minor fixes * using a generalized function to fetch the next breadcrumb item * remove building breadcrumbs from browser histroy * add tests * fixing eslint * fetching element from test-id instead of patternfly class * removing overview list from navigation routes
- Loading branch information
1 parent
4d3aa4d
commit fea7c2c
Showing
5 changed files
with
206 additions
and
118 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Tests for Breadcrumbs', () => { | ||
beforeEach(() => { | ||
cy.exec('npm run quay:seed'); | ||
cy.request('GET', `${Cypress.env('REACT_QUAY_APP_API_URL')}/csrf_token`) | ||
.then((response) => response.body.csrf_token) | ||
.then((token) => { | ||
cy.loginByCSRF(token); | ||
}); | ||
}); | ||
|
||
it('Organization list page', () => { | ||
cy.visit('/organization'); | ||
cy.get('nav[test-id="page-breadcrumbs-list"]').should('not.exist'); | ||
}); | ||
|
||
it('Repository list page', () => { | ||
cy.visit('/repository'); | ||
cy.get('nav[test-id="page-breadcrumbs-list"]').should('not.exist'); | ||
}); | ||
|
||
it('Organization page', () => { | ||
cy.visit('/organization/projectquay'); | ||
cy.get('nav[test-id="page-breadcrumbs-list"]').within(() => { | ||
cy.get('li') | ||
.each(($el, index) => { | ||
switch (index) { | ||
case 0: | ||
cy.wrap($el).should('have.text', 'organization'); | ||
cy.wrap($el) | ||
.children('a') | ||
.should('have.attr', 'href', '/organization'); | ||
break; | ||
case 1: | ||
cy.wrap($el).should('have.text', 'projectquay'); | ||
cy.wrap($el).children('a').should('have.class', 'disabled-link'); | ||
cy.wrap($el) | ||
.children('a') | ||
.should('have.attr', 'href', '/organization/projectquay'); | ||
break; | ||
} | ||
}) | ||
.then(($lis) => { | ||
expect($lis).to.have.length(2); | ||
}); | ||
}); | ||
}); | ||
|
||
it('Repository page', () => { | ||
cy.visit('/repository/projectquay/repo1'); | ||
cy.get('nav[test-id="page-breadcrumbs-list"]').within(() => { | ||
cy.get('li') | ||
.each(($el, index) => { | ||
switch (index) { | ||
case 0: | ||
cy.wrap($el).should('have.text', 'repository'); | ||
cy.wrap($el) | ||
.children('a') | ||
.should('have.attr', 'href', '/repository'); | ||
break; | ||
case 1: | ||
cy.wrap($el).should('have.text', 'projectquay'); | ||
cy.wrap($el) | ||
.children('a') | ||
.should('have.attr', 'href', '/organization/projectquay'); | ||
break; | ||
case 2: | ||
cy.wrap($el).should('have.text', 'repo1'); | ||
cy.wrap($el).children('a').should('have.class', 'disabled-link'); | ||
cy.wrap($el) | ||
.children('a') | ||
.should('have.attr', 'href', '/repository/projectquay/repo1'); | ||
break; | ||
} | ||
}) | ||
.then(($lis) => { | ||
expect($lis).to.have.length(3); | ||
}); | ||
}); | ||
}); | ||
|
||
it('Tags list page', () => { | ||
cy.visit('/repository/user1/hello-world/tag/latest'); | ||
cy.get('nav[test-id="page-breadcrumbs-list"]').within(() => { | ||
cy.get('li') | ||
.each(($el, index) => { | ||
switch (index) { | ||
case 0: | ||
cy.wrap($el).should('have.text', 'repository'); | ||
cy.wrap($el) | ||
.children('a') | ||
.should('have.attr', 'href', '/repository'); | ||
break; | ||
case 1: | ||
cy.wrap($el).should('have.text', 'user1'); | ||
cy.wrap($el) | ||
.children('a') | ||
.should('have.attr', 'href', '/organization/user1'); | ||
break; | ||
case 2: | ||
cy.wrap($el).should('have.text', 'hello-world'); | ||
cy.wrap($el) | ||
.children('a') | ||
.should('have.attr', 'href', '/repository/user1/hello-world'); | ||
break; | ||
case 3: | ||
cy.wrap($el).should('have.text', 'latest'); | ||
cy.wrap($el).children('a').should('have.class', 'disabled-link'); | ||
cy.wrap($el) | ||
.children('a') | ||
.should( | ||
'have.attr', | ||
'href', | ||
'/repository/user1/hello-world/tag/latest', | ||
); | ||
break; | ||
} | ||
}) | ||
.then(($lis) => { | ||
expect($lis).to.have.length(4); | ||
}); | ||
}); | ||
}); | ||
}); |
This file was deleted.
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
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
Oops, something went wrong.