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

Add frame-tested for unloaded iframes #313

Closed
straker opened this issue Jun 20, 2023 · 4 comments
Closed

Add frame-tested for unloaded iframes #313

straker opened this issue Jun 20, 2023 · 4 comments
Assignees
Labels
bug in sprint Ticket is in current sprint QA SIGNOFF: passed This ticket has passed QA

Comments

@straker
Copy link
Contributor

straker commented Jun 20, 2023

The change was made to our javascript APIs but needs to be ported to here.

@dequejenn dequejenn added bug and removed tech debt labels Jun 30, 2023
@dequejenn dequejenn added the in sprint Ticket is in current sprint label Jul 17, 2023
@padmavemulapati
Copy link

@AdnoC , Is this ticket QA-Required? If yes please add few QA-Notes

@AdnoC
Copy link
Contributor

AdnoC commented Oct 9, 2023

Basic test is that we can scan a page like https://github.com/dequelabs/axe-test-fixtures/blob/v1/fixtures/lazy-loaded-iframe.html and not have it hang. More can be that we get a frame-tested for the frame.

@padmavemulapati
Copy link

Tested the following steps:

  1. Created a lazy loaded iframes test file
  2. Ran it using Cucumber and Rspec

To check the violations and incompletes following the steps.rb

for violations

Then('I verify the page has {string} accessibility issues') do |expected_issues_count|
  begin
    results = Axe.run(@driver)
    json_results = results.to_json
    
    # Parse the JSON results
    accessibility_data = JSON.parse(json_results)

    # Count the number of violations
    actual_issues_count = accessibility_data['violations'].length

    expect(actual_issues_count).to eq(expected_issues_count.to_i), "Accessibility issues count mismatch"
  rescue => e
    puts(e.message)
  end
end

for incomplete

Then('I verify the page has {string} accessibility issues') do |expected_issues_count|
  begin
    results = Axe.run(@driver)
    json_results = results.to_json
    
    # Parse the JSON results
    accessibility_data = JSON.parse(json_results)

    # Count the number of incompletes
    actual_issues_count = accessibility_data['incomplete'].length

    expect(actual_issues_count).to eq(expected_issues_count.to_i), "Accessibility issues count mismatch"
  rescue => e
    puts(e.message)
  end
end

But we are seeing only for violations results frame-title

not for incomplete - frame-tested

As per @adam - as lazyloaded iframes fix should work for selenium related frameworks, it should work for axe-core-gems both frameworks - cucumber and rspec using all three drivers capybara, watir and selenium. But not seeing the data for frame-tested
@adam can you please help us to get the data for incomplete results

@dequejenn dequejenn assigned michael-siek and unassigned AdnoC Oct 31, 2023
@padmavemulapati
Copy link

Verified with the latest axe-core-gems_4.8.2 version, getting frame-tested result for lazy loaded iframes.

Test conditions:

  1. Lazy loaded iframes:
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Lazy</title>
  </head>
  <body>
    <h1>Lazy</h1>
    <div style="margin-top: 300vh">
      <iframe id="lazy-iframe" src="https://www.youtube.com/embed/REDRiwmNunA" title="MONTHLY SPOTLIGHT" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" loading="lazy"></iframe>
      <iframe src="baz.html" id="lazy-baz"></iframe>
    </div>
  </body>
</html>
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="en" id="lazy-loading-iframe-root">
  <head>
    <title>Lazy Loading Iframe Root</title>
  </head>
  <body>
    <main>
      <h1>iframe context test</h1>
      <div style="margin-top: 300vh">
        <iframe src="iframes/lazy.html" id="ifr-lazy" loading="lazy"></iframe>
      </div>
    </main>
  </body>
</html>

Code for rspec-selenium - test.rb

require "spec_helper"
require 'axe/core'
require 'axe/api/run'
require "selenium-webdriver"
require "json"

# Typical example using standard RSpec dsl
describe "ABCD CompuTech (RSpec DSL)",
         :type => :feature, :driver => :selenium do
  # before :each do
  #   @driver.page.navigate.to "http://qateam.dequecloud.com/attest/api/test.html"
  # end

  it "prints out version number" do
    @driver.page.navigate.to "http://localhost:8081/iframesfixture.html"
    axe_results = Axe::Core.new(@driver.page).call Axe::API::Run.new
    puts(axe_results.results.testEngine["version"])
    violations = axe_results.results.violations
    violations.each do |violation|
        puts "Rule ID: #{violation.id}" # Print Rule ID for each violation
        puts "Description: #{violation.description}" # Print description of the violation
        # You can access other properties of the violation as needed
    end
    incomplete = axe_results.results.incomplete
    incomplete.each do |incomplete|
    puts "Rule ID: #{incomplete.id}" # Print Rule ID for each violation
    puts "Description: #{incomplete.description}" # Print description of the violation
    # You can access other properties of the violation as needed
  end
end
end

Execute: bundle install and bundle exec rspec

Expectation:
On lazy loaded iframes, page should load and scan successfully. the above mensioned test file get frame-title as violation and frame-tested as incomplete results.

image

Environment:

Label Value
Product axe-core-gems/rspec-selenium
Version 4.8.2
OS-Details _MAC- Intel Core i7 - 11.6.8 && Windows 11 _
BrowserDetails Chrome Version 121.0.6167.139 && Firefox 122.0.1

@padmavemulapati padmavemulapati added the QA SIGNOFF: passed This ticket has passed QA label Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug in sprint Ticket is in current sprint QA SIGNOFF: passed This ticket has passed QA
Projects
None yet
Development

No branches or pull requests

5 participants