Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-138943 POC Integration test #496

Merged
merged 2 commits into from
Dec 14, 2023
Merged

MWPW-138943 POC Integration test #496

merged 2 commits into from
Dec 14, 2023

Conversation

TsayAdobe
Copy link
Collaborator

  • Add pilot tests for accordian, merch card, and review blocks
  • Accordian and merch card blocks use screenshot verification
  • Review block uses action and element verification
  • Work around CORS using page route

To do:

  • Eliminate unnecessary components and improve stability
  • Add tests to a GitHub Actions workflow
  • Cover more blocks

Tu run integration tests on Chromium only:

npm run int

To run integration tests on 3 browsers:

npm run int3

@TsayAdobe TsayAdobe added the test Fix or stabilize the current test label Dec 5, 2023
Copy link

aem-code-sync bot commented Dec 5, 2023

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

Comment on lines +11 to +48
) => new Promise((resolve) => {
const el = document.querySelector(selector);

if (el) {
resolve(el);
return;
}
if (el) {
resolve(el);
return;
}

const observer = new MutationObserver((mutations, obsv) => {
mutations.forEach((mutation) => {
const nodes = [...mutation.addedNodes];
nodes.some((node) => {
if (node.matches && node.matches(selector)) {
if (textContent && node.textContent !== textContent) return false;

const observer = new MutationObserver((mutations, obsv) => {
mutations.forEach((mutation) => {
const nodes = [...mutation.addedNodes];
nodes.some((node) => {
if (node.matches && node.matches(selector)) {
if (textContent && node.textContent !== textContent) return false;
obsv.disconnect();
resolve(node);
return true;
}

// check for child in added node
const treeWalker = document.createTreeWalker(node);
let { currentNode } = treeWalker;
while (currentNode) {
if (currentNode.matches && currentNode.matches(selector)) {
obsv.disconnect();
resolve(node);
resolve(currentNode);
return true;
}

// check for child in added node
const treeWalker = document.createTreeWalker(node);
let { currentNode } = treeWalker;
while (currentNode) {
if (currentNode.matches && currentNode.matches(selector)) {
obsv.disconnect();
resolve(currentNode);
return true;
}
currentNode = treeWalker.nextNode();
}
return false;
});
currentNode = treeWalker.nextNode();
}
return false;
});
});

observer.observe(rootEl, options);
});

observer.observe(rootEl, options);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <compat/compat> reported by reviewdog 🐶
Promise is not supported in op_mini all

Comment on lines +56 to +62
) => new Promise((resolve) => {
const observer = new MutationObserver((mutations, obsv) => {
obsv.disconnect();
resolve();
});
observer.observe(el, options);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <compat/compat> reported by reviewdog 🐶
Promise is not supported in op_mini all

Comment on lines +70 to +93
) => new Promise((resolve) => {
const el = document.querySelector(selector);

if (!el) {
resolve();
return;
}
if (!el) {
resolve();
return;
}

const observer = new MutationObserver((mutations, obsv) => {
mutations.forEach((mutation) => {
const nodes = [...mutation.removedNodes];
nodes.some((node) => {
if (node.matches(selector)) {
obsv.disconnect();
resolve();
return true;
}
return false;
});
const observer = new MutationObserver((mutations, obsv) => {
mutations.forEach((mutation) => {
const nodes = [...mutation.removedNodes];
nodes.some((node) => {
if (node.matches(selector)) {
obsv.disconnect();
resolve();
return true;
}
return false;
});
});

observer.observe(el.parentElement, options);
});

observer.observe(el.parentElement, options);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <compat/compat> reported by reviewdog 🐶
Promise is not supported in op_mini all

Comment on lines +101 to +105
export const delay = (timeOut, cb) => new Promise((resolve) => {
setTimeout(() => {
resolve((cb && cb()) || null);
}, timeOut);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <compat/compat> reported by reviewdog 🐶
Promise is not supported in op_mini all

Comment on lines +115 to 129
return new Promise((resolve, reject) => {
if (predicate()) resolve();

const intervalId = setInterval(() => {
if (predicate()) {
clearInterval(intervalId);
resolve();
}
}, interval);

setTimeout(() => {
resolve((cb && cb()) || null);
}, timeOut);
clearInterval(intervalId);
reject(new Error('Timed out waiting for predicate to be true'));
}, timeout);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <compat/compat> reported by reviewdog 🐶
Promise is not supported in op_mini all

});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [eslint] <eol-last> reported by reviewdog 🐶
Newline required at end of file but not found.

Suggested change
}
}

@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4347fab) 97.86% compared to head (37a6019) 97.90%.

Additional details and impacted files
@@            Coverage Diff             @@
##            stage     #496      +/-   ##
==========================================
+ Coverage   97.86%   97.90%   +0.03%     
==========================================
  Files          26       26              
  Lines        2907     2907              
==========================================
+ Hits         2845     2846       +1     
+ Misses         62       61       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TsayAdobe TsayAdobe merged commit 26f56a9 into stage Dec 14, 2023
5 of 7 checks passed
@TsayAdobe TsayAdobe deleted the MWPW-138943 branch January 10, 2024 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Fix or stabilize the current test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants