Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/ci-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,17 @@
java-version: 17
run: |
bazel test --flaky_test_attempts 3 //java/test/org/openqa/selenium/chrome:ChromeDriverFunctionalTest-remote

safari-tests:
name: Safari Tests
uses: ./.github/workflows/bazel.yml
with:
name: Safari Tests
os: macos
cache-key: java-safari-tests
java-version: 17
run: >
bazel test
--flaky_test_attempts 3
--test_tag_filters=safari
//java/test/...
Comment on lines +78 to +89

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 16 days ago

Generally, to fix this kind of issue you explicitly define a permissions: block either at the top level of the workflow (applying to all jobs that don’t override it) or inside each job. For test-only workflows that just need to check out code and run Bazel, the minimal safe choice is typically permissions: contents: read, which allows reading the repository contents while preventing unintended write operations with the GITHUB_TOKEN.

For this specific workflow, the simplest, non‑intrusive fix is to add a single root‑level permissions: block, just after the on: section and before jobs:. This will apply to all jobs (browser-tests-windows, browser-tests-macos, remote-tests, and safari-tests) and address the CodeQL warning at line 78, since that warning is about the absence of any explicit permissions for the job. There is no evidence in the snippet that any job needs write access (no step uses the token to modify issues, PRs, etc.), so setting contents: read is appropriate and should not break existing functionality.

Concretely:

  • Edit .github/workflows/ci-java.yml.

  • Insert:

    permissions:
      contents: read

    on its own indentation level after the on: block (after line 5 and a blank line), shifting the existing jobs: definition down. No imports or other definitions are required.

Suggested changeset 1
.github/workflows/ci-java.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/ci-java.yml b/.github/workflows/ci-java.yml
--- a/.github/workflows/ci-java.yml
+++ b/.github/workflows/ci-java.yml
@@ -4,6 +4,9 @@
   workflow_call:
   workflow_dispatch:
 
+permissions:
+  contents: read
+
 jobs:
   browser-tests-windows:
     name: Browser Tests
EOF
@@ -4,6 +4,9 @@
workflow_call:
workflow_dispatch:

permissions:
contents: read

jobs:
browser-tests-windows:
name: Browser Tests
Copilot is powered by AI and may make mistakes. Always verify output.
4 changes: 0 additions & 4 deletions java/test/org/openqa/selenium/ClickScrollingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ public void testShouldScrollOverflowElementsIfClickPointIsOutOfViewButElementIsI

@SwitchToTopAfterTest
@Test
@NotYetImplemented(SAFARI)
@Ignore(
value = FIREFOX,
reason = "frame not scrolled into view",
Expand All @@ -185,7 +184,6 @@ void testShouldBeAbleToClickElementThatIsOutOfViewInAFrame() {

@SwitchToTopAfterTest
@Test
@NotYetImplemented(SAFARI)
public void testShouldBeAbleToClickElementThatIsOutOfViewInAFrameThatIsOutOfView() {
driver.get(appServer.whereIs("scrolling_tests/page_with_scrolling_frame_out_of_view.html"));
driver.switchTo().frame("scrolling_frame");
Expand Down Expand Up @@ -215,7 +213,6 @@ public void testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrame() {
value = FIREFOX,
reason = "horizontal scroll bar gets in the way",
issue = "https://github.com/mozilla/geckodriver/issues/2013")
@NotYetImplemented(SAFARI)
public void testShouldBeAbleToClickElementThatIsOutOfViewInANestedFrameThatIsOutOfView() {
driver.get(
appServer.whereIs("scrolling_tests/page_with_nested_scrolling_frames_out_of_view.html"));
Expand All @@ -242,7 +239,6 @@ private long getScrollTop() {

@SwitchToTopAfterTest
@Test
@NotYetImplemented(SAFARI)
@Ignore(
value = FIREFOX,
reason = "frame not scrolled into view",
Expand Down
1 change: 0 additions & 1 deletion java/test/org/openqa/selenium/FormHandlingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ void testSendKeysKeepsCapitalization() {

@Test
@NotYetImplemented(FIREFOX)
@NotYetImplemented(SAFARI)
public void testShouldSubmitAFormUsingTheNewlineLiteral() {
driver.get(pages.formPage);
WebElement nestedForm = driver.findElement(By.id("nested_form"));
Expand Down
3 changes: 0 additions & 3 deletions java/test/org/openqa/selenium/SvgDocumentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@
package org.openqa.selenium;

import static org.assertj.core.api.Assertions.assertThat;
import static org.openqa.selenium.testing.drivers.Browser.SAFARI;

import org.junit.jupiter.api.Test;
import org.openqa.selenium.testing.JupiterTestBase;
import org.openqa.selenium.testing.NotYetImplemented;

class SvgDocumentTest extends JupiterTestBase {

@Test
@NotYetImplemented(SAFARI)
public void testClickOnSvgElement() {
driver.get(pages.svgTestPage);
WebElement rect = driver.findElement(By.id("rect"));
Expand Down
2 changes: 0 additions & 2 deletions java/test/org/openqa/selenium/VisibilityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ void testShouldCountElementsAsVisibleIfStylePropertyHasBeenSet() {
}

@Test
@NotYetImplemented(SAFARI)
public void testShouldModifyTheVisibilityOfAnElementDynamically() {
driver.get(pages.javascriptPage);

Expand Down Expand Up @@ -107,7 +106,6 @@ void testShouldNotBeAbleToTypeToAnElementThatIsNotDisplayed() {
}

@Test
@NotYetImplemented(SAFARI)
public void testZeroSizedDivIsShownIfDescendantHasSize() {
driver.get(pages.javascriptPage);

Expand Down
1 change: 1 addition & 0 deletions java/test/org/openqa/selenium/WebNetworkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.openqa.selenium.testing.NeedsFreshDriver;
import org.openqa.selenium.testing.drivers.Browser;

@Ignore(value = Browser.SAFARI, reason = "Safari does not support BiDi")
class WebNetworkTest extends JupiterTestBase {

private String page;
Expand Down
3 changes: 3 additions & 0 deletions java/test/org/openqa/selenium/WebScriptExecuteTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@
import org.openqa.selenium.bidi.script.RemoteValue;
import org.openqa.selenium.print.PrintOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.testing.Ignore;
import org.openqa.selenium.testing.JupiterTestBase;
import org.openqa.selenium.testing.drivers.Browser;

@Ignore(value = Browser.SAFARI, reason = "Safari does not support BiDi")
class WebScriptExecuteTest extends JupiterTestBase {

@Test
Expand Down
3 changes: 3 additions & 0 deletions java/test/org/openqa/selenium/WebScriptTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@
import org.openqa.selenium.remote.DomMutation;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.testing.Ignore;
import org.openqa.selenium.testing.JupiterTestBase;
import org.openqa.selenium.testing.NeedsFreshDriver;
import org.openqa.selenium.testing.drivers.Browser;

@Ignore(value = Browser.SAFARI, reason = "Safari does not support BiDi")
class WebScriptTest extends JupiterTestBase {

String page;
Expand Down
Loading