I have an exercise that cant solve
Check that the page loaded is the expected one.
a. Yes: Continue with the test.
b. No: Return an Error notifying that the page loaded is not the expected one.
How can write these conditions below in my test case?
I am 100% sure its wrong but cant find the correct way how to write it.
const {element, by} = require ("protractor")
const {ExpectedConditions} = require('protractor')
describe('wefox task', function(){
it('login', async function(){
await browser.get('URL');
if (window.location.href=='URL')
{
const user_input = element(by.css("body > wf-root > wf-public-layout > section > div > div > wf-login-page > section > form > div > div > div.wf-c-field.wf-u-pb-24 > div"))
const username = element(by.id('user_name'))
const pass_input = element(by.css("body > wf-root > wf-public-layout > section > div > div > wf-login-page > section > form > div > div > div.wf-c-field.--password.wf-u-pb-32 > div"))
const password = element(by.id('password'))
const btn_login = element(by.css('body > wf-root > wf-public-layout > section > div > div > wf-login-page > section > form > div > div > button'))
const button = element(by.buttonText('Anmeldung'))
await browser.wait(ExpectedConditions.visibilityOf(username),10*1000)
await browser.wait(ExpectedConditions.elementToBeClickable(user_input),10*1000)
await browser.wait(ExpectedConditions.visibilityOf(password),10*1000)
await browser.wait(ExpectedConditions.elementToBeClickable(pass_input),10*1000)
await user_input.click ()
await username.sendKeys ("login")
await pass_input.click ()
await password.sendKeys ("password")
await btn_login.click()
await browser.sleep(50000);
} else {
console.log ("error")
}
});
});