Skip to content

Commit

Permalink
Fix flaky tests (SAP#1669)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndricimrr authored Oct 28, 2020
1 parent 659e1e7 commit c35619a
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 99 deletions.
2 changes: 1 addition & 1 deletion test/e2e-test-application/cypress.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"projectId": "czq7qc",
"retries": 3
"retries": 2
}
1 change: 0 additions & 1 deletion test/e2e-test-application/e2e/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ function onIframeReady($iframe, successFn, errorFn) {
* returns the window instance of an iframe
*/
Cypress.Commands.add('getIframeWindow', (num = 0) => {
cy.wait(100);
return cy
.get('iframe')
.eq(num)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,28 @@ describe('Fiddle', () => {
describe('virtualTree with fromVirtualTreeRoot', () => {
beforeEach(() => {
const newConfig = cloneDeep(fiddleConfig);

newConfig.navigation.nodes.push({
pathSegment: 'virtual',
label: 'Virtual',
virtualTree: true,
viewUrl: '/examples/microfrontends/multipurpose.html#'
viewUrl: '/examples/microfrontends/multipurpose.html#',
context: {
content:
'<button onClick="LuigiClient.linkManager().fromVirtualTreeRoot().navigate(\'/this/is/a/tree\')">virtual</button>'
}
});
cy.visitWithFiddleConfig('/virtual', newConfig);
});
it('navigate', () => {
cy.getIframeWindow().then(win => {
win.LuigiClient.linkManager()
.fromVirtualTreeRoot()
.navigate('/this/is/a/tree');
cy.getIframeBody().then($body => {
cy.wrap($body)
.find('button')
.contains('virtual')
.click();

cy.expectPathToBe('/virtual/this/is/a/tree');
});
cy.expectPathToBe('/virtual/this/is/a/tree');
});
});
describe('ContextSwitcher', () => {
Expand Down Expand Up @@ -382,18 +389,24 @@ describe('Fiddle', () => {
// }
// }
};
newConfig.navigation.nodes.push({
pathSegment: 'theming',
label: 'Theming Test',
viewUrl: '/examples/microfrontends/multipurpose.html#',
context: {
title: 'Welcome <h2 id="themeText"></h2>',
content: `<img src="empty.gif" onerror='document.getElementById("themeText").innerHTML = LuigiClient.uxManager().getCurrentTheme();' />`
}
});
});
it('Client get and set theme', () => {
cy.visitWithFiddleConfig('/', newConfig);

cy.wait(500);
cy.getIframeWindow().then(win => {
const defaultTheme = win.LuigiClient.uxManager().getCurrentTheme();
expect(defaultTheme).to.equal('light');
it('Client get and set theme', () => {
cy.visitWithFiddleConfig('/theming', newConfig);

// not yet implemented
// win.LuigiClient.uxManager().setCurrentTheme('dark');
// expect(defaultTheme).to.equal('dark');
cy.getIframeBody().then($body => {
cy.wrap($body)
.find('h2')
.contains('light');
});
});
it('Iframe Url should get set with value by default', () => {
Expand Down
Loading

0 comments on commit c35619a

Please sign in to comment.