Skip to content
Snippets Groups Projects
Commit a84e7fa7 authored by Paul Kaplan's avatar Paul Kaplan
Browse files

Rework for import

parent bd6e64d0
Branches
Tags
No related merge requests found
/* eslint-env jest */
jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; // eslint-disable-line no-undef
const webdriver = require('selenium-webdriver');
import webdriver from 'selenium-webdriver';
const {By, until} = webdriver;
......@@ -9,10 +9,6 @@ const driver = new webdriver.Builder()
.forBrowser('chrome')
.build();
const clickScriptsTab = () => driver.findElement(By.id('react-tabs-0')).click();
const clickCostumeTab = () => driver.findElement(By.id('react-tabs-2')).click();
const clickSoundsTab = () => driver.findElement(By.id('react-tabs-4')).click();
const findByXpath = (xpath) => {
return driver.wait(until.elementLocated(By.xpath(xpath), 5 * 1000));
};
......@@ -24,6 +20,7 @@ const clickXpath = (xpath) => {
const clickText = (text) => {
return clickXpath(`//*[contains(text(), '${text}')]`);
};
const clickButton = (text) => {
return clickXpath(`//button[contains(text(), '${text}')]`);
};
......@@ -48,13 +45,10 @@ const getLogs = (whitelist) => {
};
export {
getLogs,
clickText,
clickButton,
clickXpath,
driver,
findByXpath,
clickCostumeTab,
clickScriptsTab,
clickSoundsTab,
driver
getLogs
};
/* eslint-env jest */
const {
getLogs,
import path from 'path';
import {
clickText,
clickButton,
clickXpath,
driver,
findByXpath,
clickCostumeTab,
clickScriptsTab,
clickSoundsTab,
driver
} = require('../helpers/selenium-helpers');
getLogs
} from '../helpers/selenium-helpers';
const path = require('path');
const uri = path.resolve(__dirname, '../../build/index.html');
const errorWhitelist = [
......@@ -25,7 +22,7 @@ describe('costumes, sounds and variables', () => {
test('Adding a costume', () => {
return driver.get('file://' + uri)
.then(() => clickCostumeTab())
.then(() => clickText('Costumes'))
.then(() => clickText('Add Costume'))
.then(() => findByXpath("//input[@placeholder='what are you looking for?']"))
.then((el) => el.sendKeys('abb'))
......@@ -38,7 +35,7 @@ describe('costumes, sounds and variables', () => {
test('Adding a sound', () => {
return driver.get('file://' + uri)
.then(() => clickSoundsTab())
.then(() => clickText('Sounds'))
.then(() => clickText('Add Sound'))
.then(() => findByXpath("//input[@placeholder='what are you looking for?']"))
.then((el) => el.sendKeys('chom'))
......@@ -73,7 +70,7 @@ describe('costumes, sounds and variables', () => {
test('Creating a variable', () => {
return driver.get('file://' + uri)
.then(() => clickScriptsTab())
.then(() => clickText('Blocks'))
.then(() => clickText('Data'))
.then(() => clickText('Create variable...'))
.then(() => findByXpath("//input[@placeholder='']"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment