Created
November 3, 2019 23:03
-
-
Save hndr91/361019c980eac5aeabb5807ebfa7d7d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//const { By, until } = require('selenium-webdriver'); | |
const Base = require('../helper/base'); | |
const Elem = require('../helper/selector'); | |
const Constant = require('../Constant'); | |
describe('Test Kompen Login Page', () => { | |
let webDriver, base; | |
beforeEach(async ()=> { | |
base = new Base(); | |
webDriver = base.driver; | |
await base.visitWeb(Constant.WEB_URL); | |
}); | |
afterEach(async ()=> { | |
await base.quit(); | |
}) | |
it('Display Login Page', async () => { | |
const loginPage = await base.getAllPage(); | |
//console.log(loginPage); | |
expect(loginPage).toContain('Login Sebagai'); | |
}); | |
describe('Perform Login as Dosen', () => { | |
let username, password; | |
let loginBtn, dosenBtn; | |
beforeEach(async () => { | |
username = await base.findByName(Elem.inputUname); | |
password = await base.findByName(Elem.inputPass); | |
adminBtn = await base.findById(Elem.btnAdmin); | |
loginBtn = await base.findByXpath('//*[@id="form"]/div/div/div/div[4]/div/button'); | |
}) | |
it('Fill username and password with invalid value', async() => { | |
await base.clickElement(adminBtn); | |
await base.getSleep(5000); | |
await base.writeElement(username, 'dosen'); | |
await base.writeElement(password, 'dosen'); | |
// iki selenium-e gak gelem klik pak dhe, wis iku tok | |
await loginBtn.click(); | |
expect(await base.getAllPage()).toContain('Username atau password salah'); | |
//console.log(await loginBtn.isDisplayed()); | |
//expect(username.getText()).toEqual('dosen'); | |
}) | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment