mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-26 17:16:11 -05:00
travis checks
This commit is contained in:
parent
57ab628337
commit
867c95b382
1 changed files with 14 additions and 14 deletions
|
@ -14,15 +14,15 @@ driver.get('https://scratch.ly');
|
||||||
|
|
||||||
//return only the part of the URL that is in the href in the page's html,
|
//return only the part of the URL that is in the href in the page's html,
|
||||||
//and the index that the href was found at
|
//and the index that the href was found at
|
||||||
function getHrefFromUrl(url, expectedHref) {
|
function getHrefFromUrl (url, expectedHref) {
|
||||||
var hrefOnly = "";
|
var hrefOnly = '';
|
||||||
var hrefIndex = url.lastIndexOf(expectedHref);
|
var hrefIndex = url.lastIndexOf(expectedHref);
|
||||||
if (hrefIndex != -1) {
|
if (hrefIndex != -1) {
|
||||||
var hrefOnly = url.substr(hrefIndex);
|
hrefOnly = url.substr(hrefIndex);
|
||||||
};
|
}
|
||||||
return {hrefIndex: hrefIndex,
|
return {hrefIndex: hrefIndex,
|
||||||
hrefOnly: hrefOnly};
|
hrefOnly: hrefOnly};
|
||||||
};
|
}
|
||||||
|
|
||||||
//find the create link within the navbar
|
//find the create link within the navbar
|
||||||
//the create link depends on whether the user is signed in or not (tips window opens)
|
//the create link depends on whether the user is signed in or not (tips window opens)
|
||||||
|
@ -30,17 +30,17 @@ tap.test('checkCreateLinkWhenSignedOut', function (t) {
|
||||||
var xPathLink = '//li[contains(@class, "link") and contains(@class, "create")]/a';
|
var xPathLink = '//li[contains(@class, "link") and contains(@class, "create")]/a';
|
||||||
var createLinkSignedOut = driver.findElement(seleniumWebdriver.By.xpath(xPathLink));
|
var createLinkSignedOut = driver.findElement(seleniumWebdriver.By.xpath(xPathLink));
|
||||||
createLinkSignedOut.getAttribute('href').then( function (url) {
|
createLinkSignedOut.getAttribute('href').then( function (url) {
|
||||||
//expected value of the href
|
//expected value of the href
|
||||||
var expectedHref = '/projects/editor/?tip_bar=home';
|
var expectedHref = '/projects/editor/?tip_bar=home';
|
||||||
var hrefInfo = getHrefFromUrl(url, expectedHref);
|
var hrefInfo = getHrefFromUrl(url, expectedHref);
|
||||||
var hrefIndex = hrefInfo.hrefIndex;
|
var hrefIndex = hrefInfo.hrefIndex;
|
||||||
var hrefOnly = hrefInfo.hrefOnly;
|
var hrefOnly = hrefInfo.hrefOnly;
|
||||||
//the create href should match `/projects/editor/?tip_bar=home`
|
//the create href should match `/projects/editor/?tip_bar=home`
|
||||||
t.equal(expectedHref, hrefOnly);
|
t.equal(expectedHref, hrefOnly);
|
||||||
//the create href should be at the end of the URL
|
//the create href should be at the end of the URL
|
||||||
var urlLength = url.length;
|
var urlLength = url.length;
|
||||||
var urlLengthFromHrefInfo = hrefOnly.length + hrefIndex;
|
var urlLengthFromHrefInfo = hrefOnly.length + hrefIndex;
|
||||||
t.equal(urlLengthFromHrefInfo, urlLength)
|
t.equal(urlLengthFromHrefInfo, urlLength);
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue