|
| 1 | +"use strict"; |
| 2 | + |
| 3 | +require("./helpers/setup"); |
| 4 | + |
| 5 | +var wd = require("wd"), |
| 6 | + _ = require('underscore'), |
| 7 | + serverConfigs = require('./helpers/appium-servers'); |
| 8 | + |
| 9 | +describe("ios safari", function () { |
| 10 | + this.timeout(300000); |
| 11 | + var driver; |
| 12 | + var allPassed = true; |
| 13 | + |
| 14 | + before(function () { |
| 15 | + var serverConfig = process.env.SAUCE ? |
| 16 | + serverConfigs.sauce : serverConfigs.local; |
| 17 | + driver = wd.promiseChainRemote(serverConfig); |
| 18 | + require("./helpers/logging").configure(driver); |
| 19 | + |
| 20 | + var desired = _.clone(require("./helpers/caps").ios71); |
| 21 | + desired.browserName = 'safari'; |
| 22 | + if (process.env.SAUCE) { |
| 23 | + desired.name = 'ios - safari'; |
| 24 | + desired.tags = ['sample']; |
| 25 | + } |
| 26 | + return driver.init(desired); |
| 27 | + }); |
| 28 | + |
| 29 | + after(function () { |
| 30 | + return driver |
| 31 | + .quit() |
| 32 | + .finally(function () { |
| 33 | + if (process.env.SAUCE) { |
| 34 | + return driver.sauceJobStatus(allPassed); |
| 35 | + } |
| 36 | + }); |
| 37 | + }); |
| 38 | + |
| 39 | + afterEach(function () { |
| 40 | + allPassed = allPassed && this.currentTest.state === 'passed'; |
| 41 | + }); |
| 42 | + |
| 43 | + |
| 44 | + it("should get the url", function () { |
| 45 | + return driver |
| 46 | + .get('https://www.google.com') |
| 47 | + .sleep(1000) |
| 48 | + .waitForElementByName('q', 5000) |
| 49 | + .sendKeys('sauce labs') |
| 50 | + .sendKeys(wd.SPECIAL_KEYS.Return) |
| 51 | + .sleep(1000) |
| 52 | + .title().should.eventually.include('sauce labs'); |
| 53 | + }); |
| 54 | + |
| 55 | + it("should delete cookie passing domain and path", function () { |
| 56 | + var complexCookieDelete = function(name, path, domain) { |
| 57 | + return function() { |
| 58 | + path = path || '|'; |
| 59 | + return driver.setCookie({name: name, value: '', path: path, |
| 60 | + domain: domain, expiry: 0}); |
| 61 | + }; |
| 62 | + }; |
| 63 | + |
| 64 | + return driver |
| 65 | + .get('http://en.wikipedia.org') |
| 66 | + .waitForElementByCss('.mediawiki', 5000) |
| 67 | + .allCookies() // 'GeoIP' cookie is there |
| 68 | + .deleteCookie('GeoIP') |
| 69 | + .allCookies() // 'GeoIP' is still there, because it is set on |
| 70 | + // the .wikipedia.org domain |
| 71 | + .then(complexCookieDelete('GeoIP', '/', '.wikipedia.org')) |
| 72 | + .allCookies() // now 'GeoIP' cookie is gone |
| 73 | + .sleep(1000); |
| 74 | + }); |
| 75 | + |
| 76 | +}); |
0 commit comments