Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions packages/sw-appcache-behavior/test/automated-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const fsePromise = promisify('fs-extra');
const testServer = new swTestingHelpers.TestServer();
const expect = chai.expect;
const TIMEOUT = 10 * 1000;
const RETRIES = 3;
let tempDirectory = path.join(__dirname, 'end-to-end-caching', 'temp');

// Helper method to generate the text of an App Cache manifest with a
Expand Down Expand Up @@ -76,6 +77,7 @@ const configureTestSuite = function(browser) {

describe(`sw-appcache-behavior Test Suite with (${browser.getPrettyName()} - ${browser.getVersionNumber()})`, function() {
this.timeout(TIMEOUT);
this.retries(RETRIES);

// Set up the web server before running any tests in this suite.
before(function() {
Expand All @@ -90,13 +92,6 @@ const configureTestSuite = function(browser) {


return generateInitialManifests()
.then(() => {
return browser.getSeleniumDriver();
})
.then((driver) => {
globalDriverReference = driver;
globalDriverReference.manage().timeouts().setScriptTimeout(TIMEOUT);
})
.then(() => {
return testServer.startServer('.');
})
Expand All @@ -114,7 +109,15 @@ const configureTestSuite = function(browser) {
return testServer.killServer();
})
.then(() => {
// return fsePromise.remove(tempDirectory);
return fsePromise.remove(tempDirectory);
});
});

it('should be able to get a global driver.', function() {
return browser.getSeleniumDriver()
.then((driver) => {
globalDriverReference = driver;
globalDriverReference.manage().timeouts().setScriptTimeout(TIMEOUT);
});
});

Expand Down Expand Up @@ -178,7 +181,8 @@ const configureTestSuite = function(browser) {
it('should cache a master entry for initial navigation', function() {
return globalDriverReference.executeAsyncScript((callback) => {
window.caches.match(window.location).then(callback);
}).then((match) => {
})
.then((match) => {
expect(match).to.be.ok;
});
});
Expand Down
10 changes: 9 additions & 1 deletion packages/sw-offline-google-analytics/test/automated-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ require('chromedriver');
require('operadriver');

const TIMEOUT = 10 * 1000;
const RETRIES = 3;

const configureTestSuite = function(browser) {
let globalDriverReference = null;
let baseTestUrl;

describe(`sw-offline-google-analytics Test Suite with (${browser.getPrettyName()} - ${browser.getVersionNumber()})`, function() {
this.retries(RETRIES);
this.timeout(TIMEOUT);

// Set up the web server before running any tests in this suite.
Expand All @@ -49,9 +51,15 @@ const configureTestSuite = function(browser) {

// Kill the web server once all tests are complete.
after(function() {
return testServer.killServer();
});

afterEach(function() {
this.timeout(6000);

return seleniumAssistant.killWebDriver(globalDriverReference)
.then(() => {
return testServer.killServer();
globalDriverReference = null;
});
});

Expand Down