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

Asset discovery failing with "Snapshots must have a resource with 'is-root' true.If more than one is provided" #1151

Closed
itsjwala opened this issue Dec 5, 2022 · 0 comments · Fixed by #1176
Labels
🐛 bug Something isn't working

Comments

@itsjwala
Copy link
Contributor

itsjwala commented Dec 5, 2022

The problem

@pytest.mark.parametrize("url, test_name", ([
    ["https://abc.com/one", "test_1"],
    ["https://abc.com/two", "test_2"],
    ["https://abc.com/three", "test_3"],
    ["https://abc.com/four", "test_4"],
]))
def test_screen_1(url, test_name):
    driver = webdriver.Chrome(executable_path ="/path")
    driver.get(url)
    time.sleep(3)
    percy_snapshot(driver, test_name)
    driver.quit()

consider above example, where in test_1 snapshot is a root resource and is being cached while doing asset discovery in below code line.

getResource: u => snapshot.resources.get(u) || cache.get(u),
saveResource: r => snapshot.resources.set(r.url, r) && cache.set(r.url, r)

when we take snapshots for other URLs say https://abc.com/three, https://abc.com/one is being referenced in the webpage.

and causes us to serve a dirty cache from the previous snapshot for which is-root was true.

Possible Solution

  • We need to invalidate such cross-snapshot resources cache or have stricter checks
@itsjwala itsjwala added the 🐛 bug Something isn't working label Dec 5, 2022
@percy percy locked as too heated and limited conversation to collaborators Dec 20, 2022
@percy percy unlocked this conversation Dec 20, 2022
@percy percy locked and limited conversation to collaborators Dec 20, 2022
@percy percy unlocked this conversation Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant