jest-environment-browserstack
Version:
an environment for using Browserstack with Jest
51 lines (50 loc) • 2.71 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const selenium_webdriver_1 = require("selenium-webdriver");
describe('should override the default configuration', () => {
let driver;
beforeAll(() => __awaiter(void 0, void 0, void 0, function* () {
// eslint-disable-next-line
// @ts-ignore
driver = yield global.__driver__({
'bstack:options': {
os: 'Windows',
osVersion: '10',
buildName: 'jest-environment-browserstack',
sessionName: 'override capabilities',
},
browserName: 'Firefox',
browserVersion: '75.0 beta',
});
yield driver.get('https://github.com/taktakpeops/jest-environment-browserstack');
}), 20000);
afterAll(() => __awaiter(void 0, void 0, void 0, function* () {
yield driver.quit();
}));
it('has loaded', () => __awaiter(void 0, void 0, void 0, function* () {
yield driver.wait(() => __awaiter(void 0, void 0, void 0, function* () {
const elem = yield driver.findElement(selenium_webdriver_1.By.css('.octicon'));
return elem.isDisplayed();
}), 2000);
expect(yield driver.getTitle()).toBe('GitHub - taktakpeops/jest-environment-browserstack: A Jest environment for using Browserstack and Browserstack-Local with Webdriver-manager');
}));
it('has an author', () => __awaiter(void 0, void 0, void 0, function* () {
const authorSpan = yield driver.findElement(selenium_webdriver_1.By.css('.author > a'));
const author = yield authorSpan.getText();
expect(author).toBe('taktakpeops');
}));
it('has a repository name', () => __awaiter(void 0, void 0, void 0, function* () {
const repoSpan = yield driver.findElement(selenium_webdriver_1.By.css('.pagehead > * strong[itemprop=name] > a'));
const repo = yield repoSpan.getText();
expect(repo).toBe('jest-environment-browserstack');
}));
});