Skip to content

Commit c1cf191

Browse files
Ankit098francisf
authored andcommitted
update: test file with browserstackDemo
1 parent 4543cd8 commit c1cf191

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

tests/specs/test.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
describe("Google's Search Functionality", () => {
2-
it("can find search results", async () => {
3-
await browser.url("https://www.google.com/ncr");
4-
const inputForm = await $("//input[@name='q']");
5-
await inputForm.setValue(["BrowserStack", "Enter"]); // this helps in majority desktops
6-
7-
try {
8-
await browser.waitUntil(async () => (await browser.getTitle()).match(/BrowserStack/i), { timeout: 5000 });
9-
} catch (e) {
10-
await browser.elementSubmit(inputForm.elementId); // this helps in remaining cases, i.e. iPhone
11-
}
12-
1+
describe("Testing with Bstackdemo", () => {
2+
it("add product to cart", async () => {
3+
await browser.url("https://bstackdemo.com/");
134
await browser.waitUntil(
14-
async () => (await browser.getTitle()).match(/BrowserStack/i),
5+
async () => (await browser.getTitle()).match(/StackDemo/i),
156
5000,
167
"Title didn't match with BrowserStack"
178
);
9+
10+
const productOnScreen = await $('//*[@id="1"]/p');
11+
const productOnScreenText = await productOnScreen.getText();
12+
13+
const addToCart = await $('//*[@id="1"]/div[4]');
14+
await addToCart.click();
15+
16+
const productInCart = await $('//*[@id="__next"]/div/div/div[2]/div[2]/div[2]/div/div[3]/p[1]');
17+
18+
await browser.waitUntil(async () => (
19+
await productInCart.getText()).match(productOnScreenText),
20+
{ timeout: 5000 }
21+
);
1822
});
1923
});

0 commit comments

Comments
 (0)