scratch-www/test/integration-legacy/smoke-testing/test_project_page.js

62 lines
2.1 KiB
JavaScript
Raw Normal View History

2019-07-17 14:56:48 -04:00
const SeleniumHelper = require('../selenium-helpers.js');
const helper = new SeleniumHelper();
var tap = require('tap');
const test = tap.test;
const driver = helper.buildDriver('www-smoke test_sign_in_out_homepage');
const {
clickText,
clickXpath,
dragFromXpathToXpath,
findByXpath,
waitUntilGone
} = helper;
const rootUrl = process.env.ROOT_URL || 'https://scratch.ly';
const projectId = 1;
const projectUrl = `${rootUrl}/projects/${projectId}`;
tap.plan(3);
tap.tearDown(function () {
driver.quit();
});
tap.beforeEach(function () {
return driver.get(projectUrl);
});
test('Find fullscreen button', {skip: true}, t => {
findByXpath('//div[starts-with(@class, "loader_background")]')
.then(el => waitUntilGone(el))
.then(() => clickXpath('//div[starts-with(@class, "stage_green-flag-overlay")]'))
.then(() => clickXpath('//img[contains(@alt, "Enter full screen mode")]'))
.then(() => t.end());
});
test('Open and close Copy Link modal', {skip: true}, t => {
findByXpath('//div[starts-with(@class, "loader_background")]')
.then(el => waitUntilGone(el))
.then(() => clickText('Copy Link'))
.then(() => clickXpath('//div[contains(@class, "social-label-title")]'))
.then(() => clickXpath('//img[contains(@alt, "close-icon")]'))
.then(() => clickXpath('//img[contains(@alt, "Enter full screen mode")]'))
.then(() => t.end());
});
test('Dragging out of modal should not close modal', {skip: true}, t => {
findByXpath('//div[starts-with(@class, "loader_background")]')
.then(el => waitUntilGone(el))
.then(() => clickXpath('//div[starts-with(@class, "stage_green-flag-overlay")]'))
.then(() => clickText('Copy Link'))
.then(() => clickXpath('//div[contains(@class, "social-label-title")]'))
.then(() => dragFromXpathToXpath(
'//div[contains(@class, "social-label-title")]',
'//li[contains(@class, "logo")]'
))
.then(() => clickXpath('//div[contains(@class, "social-label-title")]'))
.then(() => t.end());
});