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"
47const URL = 'http://localhost:3000/' ;
58const 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