Skip to content

Commit 9663688

Browse files
committed
asd add browsers
1 parent b0b9fb5 commit 9663688

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,14 @@ jobs:
237237
uses: nanasess/setup-chromedriver@v2
238238
with:
239239
chromedriver-version: '130.0.6723.116'
240+
241+
- name: Install Edge
242+
uses: browser-actions/setup-edge@v1
243+
with:
244+
edge-version: stable
245+
246+
- name: Install Geckodriver
247+
uses: browser-actions/setup-geckodriver@latest
240248

241249
- name: Run Browser Test
242250
run: |

apps/frontend/__tests__/browser-tests/browser.test.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
import { Actions, Browser, Builder, By, Key, until, WebDriver } from "selenium-webdriver"
1+
import { Actions, Browser, Builder, By, Capabilities, Key, until, WebDriver } from "selenium-webdriver"
2+
3+
import {Options as ChromeOptions} from "selenium-webdriver/chrome"
4+
import {Options as EdgeOptions} from "selenium-webdriver/edge"
5+
import {Options as FirefoxOptions} from "selenium-webdriver/firefox"
26

3-
import Chrome from "selenium-webdriver/chrome"
47
const URL = 'http://localhost:3000/';
58
const ETERNAL_JWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjk5OTk5OTk5OTk5fQ.Z4_FVGQ5lIcouP3m4YLMr6pGMF17IJFfo2yOTiN58DY"
69

7-
describe("chrome browser", () => {
8-
const options = new Chrome.Options()
9-
.addArguments("--headless=new") as Chrome.Options; // uncomment locally to see the steps in action
10-
const builder = new Builder().forBrowser(Browser.CHROME).setChromeOptions(options);
10+
const CHROME_OPTIONS = new ChromeOptions()
11+
.addArguments("--headless=new") as ChromeOptions; // uncomment locally to see the steps in action
12+
const EDGE_OPTIONS = new EdgeOptions()
13+
.addArguments("--headless=new") as EdgeOptions;
14+
const FIREFOX_OPTIONS = new FirefoxOptions()
15+
.addArguments("--headless") as FirefoxOptions;
16+
17+
const builder = new Builder()
18+
.setChromeOptions(CHROME_OPTIONS)
19+
.setEdgeOptions(EDGE_OPTIONS)
20+
.setFirefoxOptions(FIREFOX_OPTIONS)
21+
22+
describe.each([Browser.CHROME, Browser.EDGE, Browser.FIREFOX])("%s driver test", (browser) => {
1123
let driver: WebDriver;
24+
beforeAll(() => {
25+
const cap = new Capabilities().setBrowserName(browser)
26+
builder.withCapabilities(cap);
27+
})
1228

1329
beforeEach(async () => {
1430
driver = await builder.build();
@@ -18,13 +34,14 @@ describe("chrome browser", () => {
1834
await driver.quit();
1935
})
2036

21-
describe("chrome webdriver installed correctly", () => {
37+
describe.skip("webdriver installed correctly", () => {
2238
it("does google search", async () => {
2339
await driver.get('http://www.google.com');
2440
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
2541
await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
2642
}, 10000);
27-
it("does another google search", async () => {
43+
44+
it.skip("does another google search", async () => {
2845
await driver.get('http://www.google.com');
2946
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
3047
await driver.wait(until.titleIs('webdriver - Google Search'), 1000);

0 commit comments

Comments
 (0)