diff --git a/.gitignore b/.gitignore index 706a798..2d9e686 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ test-results log/ package-lock.json local.log + diff --git a/browserstack.yml b/browserstack.yml index 931609d..ad061d9 100644 --- a/browserstack.yml +++ b/browserstack.yml @@ -11,15 +11,15 @@ accessKey: YOUR_ACCESS_KEY # ====================== # The following capabilities are used to set up reporting on BrowserStack: # Set 'projectName' to the name of your project. Example, Marketing Website -projectName: BrowserStack Samples +projectName: BrowserStack Samples # Set `buildName` as the name of the job / testsuite being run -buildName: browserstack build +buildName: browserstack build # `buildIdentifier` is a unique id to differentiate every execution that gets appended to # buildName. Choose your buildIdentifier format from the available expressions: # ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution # ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30 # Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests -buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression} +buildIdentifier: "#${BUILD_NUMBER}" # Supports strings along with either/both ${expression} # ======================================= # Platforms (Browsers / Devices to test) @@ -60,9 +60,9 @@ parallelsPerPlatform: 1 browserstackLocal: true # (Default false) # browserStackLocalOptions: # Options to be passed to BrowserStack local in-case of advanced configurations - # localIdentifier: # (Default: null) Needed if you need to run multiple instances of local. - # forceLocal: true # (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel. - # Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections +# localIdentifier: # (Default: null) Needed if you need to run multiple instances of local. +# forceLocal: true # (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel. +# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections framework: playwright source: node-js-playwright-sample-sdk:v1 diff --git a/local.log b/local.log index e1e494e..f06f83e 100644 Binary files a/local.log and b/local.log differ diff --git a/tests/bstack_test_demo.js b/tests/bstack_test_demo.js new file mode 100644 index 0000000..c15fbf0 --- /dev/null +++ b/tests/bstack_test_demo.js @@ -0,0 +1,26 @@ +const { expect, test } = require("@playwright/test"); + +test.beforeEach(async ({ page }) => { + await page.goto("https://bstackdemo.com/"); +}); + +test("BStackDemo test home page", async ({ page }) => { + const title = await page.title(); + expect(title).toContain("StackDemo"); +}); + +test("BStackDemo test home page logo", async ({ page }) => { + await page.locator(".Navbar_logo__2655Y").isVisible(); +}); + +test("BStackDemo test attribute", async ({ page }) => { + const links = page.locator("a"); + const count = await links.count(); + for (let i = 0; i < count; i++) { + const href = await links.nth(i).getAttribute("href"); + + if (i === 0) { + expect(href).toEqual("/"); + } + } +});