Skip to content
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

Add selenium tests for alert pages #34 #116

Merged
merged 7 commits into from
Nov 23, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
PR fixes
  • Loading branch information
Shyam Sundar Mylai authored and Shyam Sundar Mylai committed Nov 22, 2023
commit 6d29f1b58276bbdf26316c491d98c0ac8632cd6e
20 changes: 3 additions & 17 deletions selenium-tests/tests/alerts-test.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
// const {Builder, By, Key, until} = require('selenium-webdriver');

// (async function example() {
// let driver = await new Builder().forBrowser('chrome').build();
// try {
// await driver.get('http://www.google.com/ncr');
// // await driver.findElement(By.name('q'));.sendKeys('webdriver', Key.RETURN);
// // await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
// } finally {
// // await driver.quit();
// console.log("done")
// }
// })();

const { By, Key, Builder, WebElement } = require("selenium-webdriver");
const assert = require("assert");
const chrome = require('selenium-webdriver/chrome');
let driver;
const chromeOptions = new chrome.Options()
chromeOptions.addArguments('--headless');

// chromeOptions.addArguments('--headless');
async function checkIncrementor(Component){
const initialValue = await Component.getAttribute('value');
// Attempt to increment the value
Expand All @@ -40,7 +26,7 @@ async function testAlertPagesButtons() {
.setChromeOptions(chromeOptions)
.build();

//To fetch http://localhost/index.html from the browser with our code.
//To fetch http://localhost/alert.html from the browser with our code.

await driver.get("http://localhost/alert.html");
let cancelBtn = driver.findElement(By.id("cancel-alert-btn"));
Expand Down Expand Up @@ -68,7 +54,7 @@ async function testAlertPagesButtons() {
let logsLanguageDrpDownPresent= await driver.findElement(By.id("logs-language-options")).isDisplayed();
assert.strictEqual(logsLanguageDrpDownPresent, true, 'logs language dropdown is not displayed');
await logsLanguageBtn.click();

let datePickerBtn = await driver.findElement(By.id('date-picker-btn'));
await datePickerBtn.click();
let datePickerDrpDownPresent= await driver.findElement(By.id("daterangepicker ")).isDisplayed();
Expand Down