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

test(selenium): fix tests for handling lazy iframe #457

Closed
wants to merge 11 commits into from

Conversation

michael-siek
Copy link
Member

chrome v124 made it so we were able to test in unloaded iframes. This changes the test to handle lazy loaded iframes in chrome v124+

qa notes: test to make sure chrome v124+ test lazy loaded iframes while chrome <124 has it in incomplete

@michael-siek michael-siek requested a review from a team as a code owner May 8, 2024 14:26
@@ -37,19 +37,19 @@
import org.junit.BeforeClass;
Copy link
Member Author

Choose a reason for hiding this comment

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

most of this was prettier

Copy link
Contributor

Choose a reason for hiding this comment

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

@michael-siek michael-siek enabled auto-merge (squash) May 8, 2024 17:50
Zidious
Zidious previously requested changes May 8, 2024
Copy link
Contributor

@Zidious Zidious left a comment

Choose a reason for hiding this comment

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

Minor thing - we can remove the new test-dep we already have all the info we need:

selenium/package-lock.json Outdated Show resolved Hide resolved
@@ -37,19 +37,19 @@
import org.junit.BeforeClass;
Copy link
Contributor

Choose a reason for hiding this comment

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

selenium/pom.xml Outdated Show resolved Hide resolved
Comment on lines 634 to 662
AxeBuilder axeBuilder = new AxeBuilder()
.withOnlyRules(Arrays.asList("label", "frame-tested"));
Results axeResults = axeBuilder.analyze(webDriver);

assertNotEquals(title, "Error");
assertEquals(axeResults.getIncomplete().size(), 1);
assertEquals(axeResults.getIncomplete().get(0).getId(), "frame-tested");
assertEquals(axeResults.getIncomplete().get(0).getNodes().size(), 1);
assertTargetEquals(
String[] expected = new String[] { "#ifr-lazy", "#lazy-iframe" };

if (!axeResults.getIncomplete().isEmpty()) {
assertEquals(axeResults.getIncomplete().size(), 1);
assertEquals(axeResults.getIncomplete().get(0).getId(), "frame-tested");
assertEquals(axeResults.getIncomplete().get(0).getNodes().size(), 1);
assertTargetEquals(
axeResults.getIncomplete().get(0).getNodes().get(0).getTarget(),
new String[] {"#ifr-lazy", "#lazy-iframe"});
assertEquals(axeResults.getViolations().size(), 2);
assertEquals(axeResults.getViolations().get(1).getId(), "label");
assertEquals(axeResults.getViolations().get(1).getNodes().size(), 1);
expected
);
} else {
assertEquals(axeResults.getIncomplete().size(), 0);
assertTargetEquals(
axeResults.getPasses().get(0).getNodes().get(1).getTarget(),
expected
);
}
assertNotEquals(title, "Error");
assertEquals(axeResults.getViolations().size(), 1);
assertEquals(axeResults.getViolations().get(0).getId(), "label");
assertEquals(axeResults.getViolations().get(0).getNodes().size(), 1);
assertTargetEquals(
axeResults.getViolations().get(1).getNodes().get(0).getTarget(),
new String[] {"#ifr-lazy", "#lazy-baz", "input"});
axeResults.getViolations().get(0).getNodes().get(0).getTarget(),
new String[] { "#ifr-lazy", "#lazy-baz", "input" }
);
Copy link
Member Author

Choose a reason for hiding this comment

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

changes are here

Zidious
Zidious previously approved these changes May 9, 2024
Copy link
Contributor

@Zidious Zidious left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants