Skip to content

Commit 970b66b

Browse files
Mohammad Ziaur RahmanMohammad Ziaur Rahman
authored andcommitted
added 3 test cases for bstack demo page
1 parent e145e9b commit 970b66b

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

browserstack.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
# =============================
44
# Add your BrowserStack userName and accessKey here or set BROWSERSTACK_USERNAME and
55
# BROWSERSTACK_ACCESS_KEY as env variables
6-
userName: YOUR_USERNAME
7-
accessKey: YOUR_ACCESS_KEY
6+
userName: mohammadzrahman1
7+
accessKey: 41vQVzKgxozzAxieu4fQ
88

99
# ======================
1010
# BrowserStack Reporting
1111
# ======================
1212
# The following capabilities are used to set up reporting on BrowserStack:
1313
# Set 'projectName' to the name of your project. Example, Marketing Website
14-
projectName: BrowserStack Samples
14+
projectName: BrowserStack Samples
1515
# Set `buildName` as the name of the job / testsuite being run
16-
buildName: browserstack build
16+
buildName: browserstack build
1717
# `buildIdentifier` is a unique id to differentiate every execution that gets appended to
1818
# buildName. Choose your buildIdentifier format from the available expressions:
1919
# ${BUILD_NUMBER} (Default): Generates an incremental counter with every execution
2020
# ${DATE_TIME}: Generates a Timestamp with every execution. Eg. 05-Nov-19:30
2121
# Read more about buildIdentifiers here -> https://www.browserstack.com/docs/automate/selenium/organize-tests
22-
buildIdentifier: '#${BUILD_NUMBER}' # Supports strings along with either/both ${expression}
22+
buildIdentifier: "#${BUILD_NUMBER}" # Supports strings along with either/both ${expression}
2323

2424
# =======================================
2525
# Platforms (Browsers / Devices to test)
@@ -60,9 +60,9 @@ parallelsPerPlatform: 1
6060
browserstackLocal: true # <boolean> (Default false)
6161
# browserStackLocalOptions:
6262
# Options to be passed to BrowserStack local in-case of advanced configurations
63-
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
64-
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
65-
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections
63+
# localIdentifier: # <string> (Default: null) Needed if you need to run multiple instances of local.
64+
# forceLocal: true # <boolean> (Default: false) Set to true if you need to resolve all your traffic via BrowserStack Local tunnel.
65+
# Entire list of arguments available here -> https://www.browserstack.com/docs/automate/selenium/manage-incoming-connections
6666

6767
framework: playwright
6868
source: node-js-playwright-sample-sdk:v1

local.log

-5.3 KB
Binary file not shown.

tests/bstack_test_demo.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const { expect, test } = require("@playwright/test");
2+
3+
test.beforeEach(async ({ page }) => {
4+
await page.goto("https://bstackdemo.com/");
5+
});
6+
7+
test("BStackDemo test home page", async ({ page }) => {
8+
const title = await page.title();
9+
expect(title).toContain("StackDemo");
10+
});
11+
12+
test("BStackDemo test home page logo", async ({ page }) => {
13+
await page.locator(".Navbar_logo__2655Y").isVisible();
14+
});
15+
16+
test("BStackDemo test attribute", async ({ page }) => {
17+
const links = page.locator("a");
18+
const count = await links.count();
19+
for (let i = 0; i < count; i++) {
20+
const href = await links.nth(i).getAttribute("href");
21+
22+
if (i === 0) {
23+
expect(href).toEqual("/");
24+
}
25+
}
26+
});

0 commit comments

Comments
 (0)