-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(e2e): fix to fixtures in e2e integration tests (#8350)
### Related Ticket(s) No related issue ### Description This makes adjustments to the fixtures in cypress for the e2e integration tests to behave properly (like the e2e storybook tests). ### Changelog **Changed** - Moved cypress fixtures to load globally in all tests - Removed the custom command for mocking fixtures
- Loading branch information
Showing
25 changed files
with
3,307 additions
and
99 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
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,8 @@ | ||
/** | ||
* Copyright IBM Corp. 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. | ||
*/ | ||
|
||
module.exports = {} |
1,567 changes: 1,567 additions & 0 deletions
1,567
packages/react/tests/e2e/cypress/fixtures/translation-raw.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "response" : [ ["test", "0"],["testing", "1"],["tester", "2"],["test automation", "3"],["testing jobs", "4"],["test realtime", "5"],["test of between subjects effects", "6"],["test data management", "7"],["test specialist", "8"],["test tls 1.2", "9"] ] } |
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 |
---|---|---|
@@ -1,23 +1,6 @@ | ||
/** | ||
* Copyright IBM Corp. 2021 | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* Mocks the Masthead/Footer data | ||
*/ | ||
Cypress.Commands.add('mockMastheadFooterData', () => { | ||
cy.intercept( | ||
'https://1.www.s81c.com/common/js/dynamicnav/www/countrylist/jsononly/usen-utf8.json', | ||
{ fixture: 'countrylist.json' } | ||
); | ||
cy.intercept( | ||
'https://1.www.s81c.com/common/carbon-for-ibm-dotcom/translations/masthead-footer/usen.json', | ||
{ fixture: 'translation.json' } | ||
); | ||
cy.intercept('https://login.ibm.com/v1/mgmt/idaas/user/status/', { | ||
fixture: 'status.json', | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,9 +1,81 @@ | ||
/** | ||
* Copyright IBM Corp. 2021 | ||
* 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. | ||
*/ | ||
|
||
import '@percy/cypress'; | ||
import './commands'; | ||
|
||
beforeEach(() => { | ||
// Mock the country list | ||
cy.intercept( | ||
'https://1.www.s81c.com/common/js/dynamicnav/www/countrylist/jsononly/usen-utf8.json', | ||
{ | ||
fixture: 'countrylist.json', | ||
} | ||
); | ||
|
||
// Mock the translation file | ||
cy.intercept( | ||
'https://1.www.s81c.com/common/carbon-for-ibm-dotcom/translations/masthead-footer/usen.json', | ||
{ | ||
fixture: 'translation-raw.json', | ||
} | ||
); | ||
|
||
// Mock the user status | ||
cy.intercept('https://login.ibm.com/v1/mgmt/idaas/user/status/\n', { | ||
fixture: 'status.json', | ||
}); | ||
|
||
cy.intercept('https://prepiam.ice.ibmcloud.com/v1/mgmt/idaas/user/status/', { | ||
fixture: 'status.json', | ||
}); | ||
|
||
// Mock search typeahead API | ||
cy.intercept('**/search/typeahead/v1?*', { | ||
fixture: 'typeahead.json', | ||
}); | ||
|
||
// Block ibm-common.js | ||
cy.intercept('https://1.www.s81c.com/common/stats/ibm-common.js', { | ||
fixture: 'ibm-common.js', | ||
}); | ||
|
||
// Mock Kaltura API | ||
// cy.intercept('https://cdnapisec.kaltura.com/api_v3/index.php?*', { | ||
// fixture: 'kaltura.json', | ||
// }); | ||
|
||
// Set an initial `digitalData` object | ||
cy.window().then(win => { | ||
win.digitalData = { | ||
page: { | ||
category: { | ||
primaryCategory: '', | ||
}, | ||
pageInfo: { | ||
effectiveDate: '', | ||
expiryDate: '', | ||
language: 'en-US', | ||
publishDate: '', | ||
publisher: '', | ||
version: 'Carbon for IBM.com', | ||
ibm: { | ||
contentDelivery: '', | ||
contentProducer: '', | ||
country: 'US', | ||
industry: '', | ||
owner: '', | ||
siteID: '', | ||
subject: '', | ||
type: '', | ||
}, | ||
}, | ||
isDataLayerReady: true, | ||
}, | ||
}; | ||
}); | ||
}); |
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
8 changes: 8 additions & 0 deletions
8
packages/web-components/tests/e2e/cypress/fixtures/ibm-common.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,8 @@ | ||
/** | ||
* Copyright IBM Corp. 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. | ||
*/ | ||
|
||
module.exports = {} |
Oops, something went wrong.