forked from carbon-design-system/carbon-for-ibm-dotcom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(footer): change cypress intercept for translation to use raw data (…
…carbon-design-system#8244) ### Related Ticket(s) No related issue ### Description This is a followup to the cypress e2e tests for Footer. In some cases the sessionStorage isn't being used and the `cy.intercept` is caught instead. In this case, it should use the raw response from the translation repo. ### Changelog **Changed** - Changed fixture for translation API to use raw response data
- Loading branch information
Showing
20 changed files
with
1,933 additions
and
1,914 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
1 change: 1 addition & 0 deletions
1
packages/react/tests/e2e-storybook/cypress/fixtures/translation-raw.json
Large diffs are not rendered by default.
Oops, something went wrong.
1,589 changes: 1 addition & 1,588 deletions
1,589
packages/react/tests/e2e-storybook/cypress/fixtures/translation.json
Large diffs are not rendered by default.
Oops, something went wrong.
112 changes: 112 additions & 0 deletions
112
packages/react/tests/e2e-storybook/cypress/integration/Masthead/Masthead-L1.e2e.js
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,112 @@ | ||
/** | ||
* Copyright IBM Corp. 2021, 2022 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** | ||
* Sets the correct path (Masthead with L1) | ||
* | ||
* @type {string} | ||
* @private | ||
*/ | ||
const _pathl1 = '/iframe.html?id=components-masthead--with-l-1'; | ||
|
||
describe('Masthead | with L1 (desktop)', () => { | ||
beforeEach(() => { | ||
cy.visit(_pathl1); | ||
cy.viewport(1280, 780); | ||
|
||
cy.waitUntil(() => cy.get('[data-autoid="dds--masthead-eco__l1-nav0"]').first().should('not.be.empty')); | ||
}); | ||
|
||
it('should render platform below the IBM logo', () => { | ||
cy.get('.bx--masthead__l1-name-title').then($platform => { | ||
cy.get('[data-autoid="dds--masthead-eco__l0-logo"]').then($logo => { | ||
expect($logo[0].getBoundingClientRect().down).to.equal( | ||
$platform[0].parentElement.getBoundingClientRect().up | ||
); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should render 5 menu items', () => { | ||
cy.get('.bx--header__menu-bar > li').should('have.length', 5); | ||
}); | ||
|
||
it('should load L1 menu item with selected state', () => { | ||
cy.get('[data-autoid="dds--masthead-eco__l1-nav0"] a').then($menuItem => { | ||
expect($menuItem).to.have.attr('data-selected', 'true'); | ||
}); | ||
|
||
cy.waitUntil(() => | ||
cy.get('.bx--header__nav-caret-right').then($elem => $elem.is(':visible')) | ||
); | ||
|
||
cy.takeSnapshots(); | ||
}); | ||
|
||
it('should load L1 menu - first L1 nav item', () => { | ||
cy.get('[data-autoid="dds--masthead-eco__l1-nav0"]') | ||
.trigger('click') | ||
.find('a') | ||
.then($menuItem => { | ||
expect($menuItem).to.have.attr('aria-expanded', 'true'); | ||
}); | ||
}); | ||
|
||
it('should load L1 menu - second L1 nav item', () => { | ||
cy.get('[data-autoid="dds--masthead-eco__l1-nav1"]') | ||
.trigger('click') | ||
.find('a') | ||
.then($menuItem => { | ||
expect($menuItem).to.have.attr('aria-expanded', 'true'); | ||
}); | ||
}); | ||
|
||
it('should load third nav L1 item', () => { | ||
cy.get('[data-autoid="dds--masthead-eco__l1-nav2"]').then($link => { | ||
const url = $link.prop('href'); | ||
expect(url).not.to.be.empty; | ||
}); | ||
}); | ||
|
||
it('should load L1 menu - fourth L1 nav item', () => { | ||
cy.get('[data-autoid="dds--masthead-eco__l1-nav3"]') | ||
.trigger('click') | ||
.find('a') | ||
.then($menuItem => { | ||
expect($menuItem).to.have.attr('aria-expanded', 'true'); | ||
}); | ||
}); | ||
|
||
it('should load fifth nav L1 item', () => { | ||
cy.get('[data-autoid="dds--masthead-eco__l1-nav4"]').then($link => { | ||
const url = $link.prop('href'); | ||
expect(url).not.to.be.empty; | ||
}); | ||
}); | ||
|
||
it('should scroll the L1 overflow properly', () => { | ||
cy.get('.bx--header__nav-caret-right').trigger('click'); | ||
cy.waitUntil(() => | ||
cy | ||
.get('.bx--header__nav-caret-right') | ||
.then($elem => !$elem.is(':visible')) | ||
); | ||
|
||
cy.get('.bx--header__nav-caret-left').should('be.visible'); | ||
|
||
cy.takeSnapshots(); | ||
}); | ||
|
||
it('should load platform containing a link', () => { | ||
cy.get('.bx--masthead__l1-name-title') | ||
.find('a') | ||
.then($link => { | ||
const url = $link.prop('href'); | ||
expect(url).not.to.be.empty; | ||
}); | ||
}); | ||
}); |
103 changes: 103 additions & 0 deletions
103
packages/react/tests/e2e-storybook/cypress/integration/Masthead/Masthead-custom.e2e.js
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,103 @@ | ||
/** | ||
* Copyright IBM Corp. 2021, 2022 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** | ||
* Sets the correct path (Custom Masthead) | ||
* | ||
* @type {string} | ||
* @private | ||
*/ | ||
const _pathCustom = | ||
'/iframe.html?id=components-masthead--with-custom-navigation'; | ||
|
||
describe('Masthead | custom (desktop)', () => { | ||
beforeEach(() => { | ||
cy.visit(_pathCustom); | ||
cy.viewport(1280, 780); | ||
|
||
cy.waitUntil(() => cy.get('[data-autoid="dds--masthead-default__l0-nav0"]').should('not.be.empty')); | ||
}); | ||
|
||
it('should render 5 custom menu items', () => { | ||
cy.get('.bx--header__menu-bar > li').should('have.length', 5); | ||
}); | ||
|
||
it('should load custom menu item with selected state', () => { | ||
cy.get('[data-autoid="dds--masthead-default__l0-nav0"] a').then( | ||
$menuItem => { | ||
expect($menuItem).to.have.attr('data-selected', 'true'); | ||
} | ||
); | ||
|
||
cy.waitUntil(() => | ||
cy.get('.bx--header__nav-caret-right').then($elem => $elem.is(':visible')) | ||
); | ||
|
||
cy.takeSnapshots(); | ||
}); | ||
|
||
it('should load regular menu - custom first nav item', () => { | ||
cy.get('[data-autoid="dds--masthead-default__l0-nav0"]') | ||
.trigger('click') | ||
.find('a') | ||
.then($menuItem => { | ||
expect($menuItem).to.have.attr('aria-expanded', 'true'); | ||
}); | ||
|
||
cy.takeSnapshots(); | ||
}); | ||
|
||
it('should load regular menu - custom second nav item', () => { | ||
cy.get('[data-autoid="dds--masthead-default__l0-nav1"]') | ||
.trigger('click') | ||
.find('a') | ||
.then($menuItem => { | ||
expect($menuItem).to.have.attr('aria-expanded', 'true'); | ||
}); | ||
|
||
cy.takeSnapshots(); | ||
}); | ||
|
||
it('should load regular menu - custom third nav item', () => { | ||
cy.get('[data-autoid="dds--masthead-default__l0-nav2"]').then($link => { | ||
const url = $link.prop('href'); | ||
expect(url).not.to.be.empty; | ||
}); | ||
}); | ||
|
||
it('should load regular menu - custom fourth nav item', () => { | ||
cy.get('.bx--header__nav-caret-right').trigger('click'); | ||
cy.get('[data-autoid="dds--masthead-default__l0-nav3"]') | ||
.trigger('click') | ||
.find('a') | ||
.then($menuItem => { | ||
expect($menuItem).to.have.attr('aria-expanded', 'true'); | ||
}); | ||
|
||
cy.takeSnapshots(); | ||
}); | ||
|
||
it('should load regular menu - custom fifth nav item', () => { | ||
cy.get('[data-autoid="dds--masthead-default__l0-nav4"]').then($link => { | ||
const url = $link.prop('href'); | ||
expect(url).not.to.be.empty; | ||
}); | ||
}); | ||
|
||
it('should scroll the L0 overflow properly', () => { | ||
cy.get('.bx--header__nav-caret-right').trigger('click'); | ||
cy.waitUntil(() => | ||
cy | ||
.get('.bx--header__nav-caret-right') | ||
.then($elem => !$elem.is(':visible')) | ||
); | ||
|
||
cy.get('.bx--header__nav-caret-left').should('be.visible'); | ||
|
||
cy.takeSnapshots(); | ||
}); | ||
}); |
60 changes: 60 additions & 0 deletions
60
...react/tests/e2e-storybook/cypress/integration/Masthead/Masthead-search-open-onload.e2e.js
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,60 @@ | ||
/** | ||
* Copyright IBM Corp. 2021, 2022 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** | ||
* Sets the correct path (Masthead search open onload) | ||
* | ||
* @type {string} | ||
* @private | ||
*/ | ||
const _pathSearchOpenOnload = | ||
'/iframe.html?id=components-masthead--search-open-onload'; | ||
|
||
describe('Masthead | search open onload (desktop)', () => { | ||
beforeEach(() => { | ||
// TODO: fix the uncaught exception in Firefox only | ||
cy.on('uncaught:exception', (err, runnable) => { | ||
if (err.message.includes('Request aborted')) { | ||
return false; | ||
} | ||
}); | ||
|
||
cy.visit(`/${_pathSearchOpenOnload}`); | ||
cy.viewport(1280, 780); | ||
|
||
cy.waitUntil(() => cy.get('[data-autoid="dds--masthead-default__l0-nav0"]').first().should('not.be.empty')); | ||
}); | ||
|
||
it('should load search field open by default', () => { | ||
cy.get('[data-autoid="dds--masthead__search"]') | ||
.find('input[data-autoid="dds--header__search--input"]') | ||
.should('be.visible'); | ||
|
||
cy.takeSnapshots(); | ||
}); | ||
|
||
it('should have typable search field', () => { | ||
cy.get('[data-autoid="dds--masthead__search"]') | ||
.find('input[data-autoid="dds--header__search--input"]') | ||
.type('test') | ||
.should('have.value', 'test'); | ||
}); | ||
|
||
it('should display 10 auto suggest results', () => { | ||
cy.get('[data-autoid="dds--masthead__search"]') | ||
.find('input[data-autoid="dds--header__search--input"]') | ||
.type('test') | ||
.get('.react-autosuggest__suggestions-list li') | ||
.should('have.length', 10); | ||
|
||
cy.takeSnapshots(); | ||
}); | ||
|
||
it('should not display menu options while search field is open', () => { | ||
cy.get('.bx--header__nav-container').should('have.css', 'display', 'none'); | ||
}); | ||
}); |
50 changes: 50 additions & 0 deletions
50
...ages/react/tests/e2e-storybook/cypress/integration/Masthead/Masthead-with-platform.e2e.js
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,50 @@ | ||
/** | ||
* Copyright IBM Corp. 2021, 2022 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
/** | ||
* Sets the correct path (Masthead with Platform) | ||
* | ||
* @type {string} | ||
* @private | ||
*/ | ||
const _pathPlatform = '/iframe.html?id=components-masthead--with-platform'; | ||
|
||
describe('Masthead | with platform (desktop)', () => { | ||
beforeEach(() => { | ||
cy.visit(_pathPlatform); | ||
cy.viewport(1280, 780); | ||
|
||
cy.waitUntil(() => cy.get('[data-autoid="dds--masthead-eco__l0-nav0"]').first().should('not.be.empty')); | ||
}); | ||
|
||
it('should load platform containing a link', () => { | ||
cy.get('[data-autoid="dds--masthead-eco__l0-ecosystemname"]').then( | ||
$link => { | ||
const url = $link.prop('href'); | ||
expect(url).not.to.be.empty; | ||
} | ||
); | ||
}); | ||
|
||
it('should render platform next to IBM logo', () => { | ||
cy.get('[data-autoid="dds--masthead-eco__l0-ecosystemname"]').then( | ||
$platform => { | ||
cy.get('[data-autoid="dds--masthead-eco__l0-logo"]').then($logo => { | ||
expect($logo[0].getBoundingClientRect().right).to.equal( | ||
$platform[0].parentElement.getBoundingClientRect().left | ||
); | ||
}); | ||
} | ||
); | ||
}); | ||
|
||
it('should open the search bar with platform', () => { | ||
cy.get('[data-autoid="dds--masthead-eco__l0-search"]').trigger('click'); | ||
|
||
cy.takeSnapshots(); | ||
}); | ||
}); |
Oops, something went wrong.