Skip to content

added 3 test cases for bstack demo page #45

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ test-results
log/
package-lock.json
local.log

12 changes: 6 additions & 6 deletions browserstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -60,9 +60,9 @@ parallelsPerPlatform: 1
browserstackLocal: true # <boolean> (Default false)
# browserStackLocalOptions:
# Options to be passed to BrowserStack local in-case of advanced configurations
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
# forceLocal: true # <boolean> (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: # <string> (Default: null) Needed if you need to run multiple instances of local.
# forceLocal: true # <boolean> (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
Expand Down
Binary file modified local.log
Binary file not shown.
26 changes: 26 additions & 0 deletions tests/bstack_test_demo.js
Original file line number Diff line number Diff line change
@@ -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("/");
}
}
});