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

Find a way to clear the Selenium WebDriver cache programmatically #26837

Open
ioannakok opened this issue Jan 23, 2024 · 0 comments
Open

Find a way to clear the Selenium WebDriver cache programmatically #26837

ioannakok opened this issue Jan 23, 2024 · 0 comments

Comments

@ioannakok
Copy link
Contributor

ioannakok commented Jan 23, 2024

The Play framework runs integration tests with a TestBrowser that uses a Selenium WebDriver. Play 2.9 (see upgrade PR: #26783) changed the version of Selenium it depends on under the hood from 3.141.59 to 4.14.1. Before the Play 2.9 upgrade the following tests above could run one after the other without the first affecting the outcome of the second:

it should "select the trail picture for the opengraph image when FacebookShareUseTrailPicFirstSwitch is ON" in {
FacebookShareUseTrailPicFirstSwitch.switchOn()
goTo("/lifeandstyle/gallery/2014/nov/24/flying-dogs-in-pictures?page=on") { browser =>
import browser._
$("meta[property='og:image']").attributes("content").asScala.head should include(
"61e027cb-fec8-4aa3-a12b-e50f99493399-2060x1236.jpeg",
)
}
}
it should "select the largest main picture for the opengraph image when FacebookShareUseTrailPicFirstSwitch is OFF" in {
FacebookShareUseTrailPicFirstSwitch.switchOff()
goTo("/lifeandstyle/gallery/2014/nov/24/flying-dogs-in-pictures?page=off") { browser =>
import browser._
$("meta[property='og:image']").attributes("content").asScala.head should include(
"e3867edb-e9d5-4be9-9c51-12258b686869-1498x2040.jpeg",
)
}
}

This is not true anymore, it looks like the TestBrowser we use in our current test configuration does not automatically clear its cache after each test so the second test will always fail. We have similar result if we swap the tests.

In:

we added a flag in the url to make sure the cache gets cleared and the tests run independently. This ticket is to find a way to clear the Selenium WebDriver cache programmatically.

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

No branches or pull requests

1 participant