Advertisement
dmimaz

Untitled

Jun 20th, 2019
112
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //const expect = require('chai').expect;
  2. //const equal = require('chai').equal;
  3. const assert = require('assert');
  4. const webdriver = require('selenium-webdriver');
  5. const driver = new webdriver.Builder().forBrowser('chrome').build();
  6. const Key = require('selenium-webdriver');
  7. const By = webdriver.By;
  8.  
  9. describe('Desktop Login', () => {
  10.     it('Retail', () => {
  11.         driver.get('https://gepur.com').then(async () => {
  12.             await driver.manage().window().maximize();    
  13.             await driver.findElement(By.className('h-account'))
  14.             .then(el => el.click())
  15.             .then(() => driver.findElement(By.id('loginform-email')))
  16.             .then(el => el.sendKeys('login'))
  17.             .then(() => driver.findElement(By.id('loginform-password')))
  18.             .then(el => el.sendKeys('password'))
  19.             .then(() => driver.findElement(By.css('button.btn-basik.btn-sm.btn-black')))
  20.             .then(el => el.click());
  21.            
  22.             await driver.sleep(500);
  23.             let siteUrl = await driver.getCurrentUrl();
  24.             assert.equal(siteUrl, 'https://gepur.com/');
  25.             //expect(siteUrl).to.equal('https://gepur.com/');
  26.             await driver.quit();
  27.         });  
  28.     });
  29.  
  30.     it('Wholesale', () => {
  31.         driver.get('https://gepur.com').then(async () => {
  32.             await driver.manage().window().maximize();    
  33.             await driver.findElement(By.className('h-account'))
  34.             .then(el => el.click())
  35.             .then(() => driver.findElement(By.id('loginform-email')))
  36.             .then(el => el.sendKeys('login'))
  37.             .then(() => driver.findElement(By.id('loginform-password')))
  38.             .then(el => el.sendKeys('password'))
  39.             .then(() => driver.findElement(By.css('button.btn-basik.btn-sm.btn-black')))
  40.             .then(el => el.click());
  41.            
  42.             await driver.sleep(500);
  43.             let siteUrl = await driver.getCurrentUrl();
  44.             assert.equal(siteUrl, 'https://gepur.com/');
  45.             //expect(siteUrl).to.equal('https://gepur.com/');
  46.             await driver.quit();
  47.         });      
  48.     });
  49. });
Advertisement
RAW Paste Data Copied
Advertisement