How to use assertExists method in Appium Xcuitest Driver

Best JavaScript code snippet using appium-xcuitest-driver

experiments-delete-spec.js

Source:experiments-delete-spec.js Github

copy

Full Screen

1'use strict';2require('mocha');3const it = require('mocha').it;4require('co-mocha');5const _ = require('lodash');6const chai = require('chai');7const assert = chai.assert;8const should = chai.should();9const r = require('rethinkdbdash')({10 db: process.env.MCDB || 'materialscommons',11 port: process.env.MCDB_PORT || 3081512});13const mcapi_base = '../../../../servers/mcapi';14const backend_base = mcapi_base + "/db/model";15const build_project_base = mcapi_base + "/build-demo";16const dbModelUsers = require(backend_base + '/users');17const projects = require(backend_base + '/projects');18const directories = require(backend_base + '/directories');19const experiments = require(backend_base + '/experiments');20const processes = require(backend_base + '/processes');21const experimentDatasets = require(backend_base + '/experiment-datasets');22const samples = require(backend_base + '/samples');23const testHelpers = require('./test-helpers');24const experimentDelete = require(backend_base + '/experiment-delete');25const base_project_name = "Test directory";26let random_name = function () {27 let number = Math.floor(Math.random() * 10000);28 return base_project_name + number;29};30let userId = "test@test.mc";31let user = null;32let project = null;33let experiment = null;34let processList = null;35let sampleList = null;36let fileList = null;37let datasetList = null;38let experimentNote = null;39let experimentTask = null;40let notes_count = 0;41before(function* () {42 console.log('before experiments-delete-spec.js');43 user = yield dbModelUsers.getUser(userId);44 assert.isOk(user, "No test user available = " + userId);45 assert.equal(userId, user.id);46 console.log('done before experiments-delete-spec.js');47});48describe('Feature - Experiments: ', function () {49 describe('Delete Experiment: ', function () {50 it('does not delete an experiment with a published dataset', function* () {51 this.timeout(80000); // test take up to 8 seconds52 yield setup();53 let project_id = project.id;54 assert.isOk(project_id);55 let experiment_id = experiment.id;56 assert.isOk(experiment_id);57 let idList = [];58 for (let i = 0; i < datasetList.length; i++) {59 idList.push(datasetList[i].id);60 }61 yield testDatasets({assertExists: true});62 // publish one of the datasets63 let datasetId = idList[0];64 let results = yield experimentDatasets.publishDataset(datasetId);65 assert.isOk(results);66 assert.isOk(results.val);67 assert.isOk(results.val.published);68 assert(results.val.published);69 // delete experiment - fails70 results = yield experimentDelete.deleteExperimentFull(project_id, experiment_id);71 assert.isOk(results);72 assert.isOk(results.error);73 yield testDatasets({assertExists: true});74 });75 it('does not delete an experiment with a dataset that has an assigned DOI', function* () {76 this.timeout(80000); // test take up to 8 seconds77 yield setup();78 let project_id = project.id;79 assert.isOk(project_id);80 let experiment_id = experiment.id;81 assert.isOk(experiment_id);82 let idList = [];83 for (let i = 0; i < datasetList.length; i++) {84 idList.push(datasetList[i].id);85 }86 yield testDatasets({assertExists: true});87 // fake a doi on one of the datasets88 let datasetId = idList[0];89 let fakeDOI = "fakeDOI";90 let status = yield r.table('datasets').get(datasetId).update({doi: fakeDOI});91 if (status.replaced != 1) {92 assert.fail(`Update of DOI in dataset, ${datasetId}, failed.`);93 }94 // delete experiment - fails95 let results = yield experimentDelete.deleteExperimentFull(project_id, experiment_id);96 assert.isOk(results);97 assert.isOk(results.error);98 yield testDatasets({assertExists: true});99 });100 it('deletes experiment and all its parts', function* () {101 this.timeout(90000); // test take up to 9 seconds102 yield setup();103 let project_id = project.id;104 assert.isOk(project_id);105 let experiment_id = experiment.id;106 assert.isOk(experiment_id);107 yield testDatasets({assertExists: true});108 yield testBestMearureHistroy({assertExists: true});109 yield testProcessesSamples({assertExists: true});110 yield testFileLinks({assertExists: true});111 yield testNotes({assertExists: true});112 // delete experiment113 let results = yield experimentDelete114 .deleteExperimentFull(project_id, experiment_id, {deleteProcesses: true, dryRun: false});115 checkResults(results);116 yield checkLinks(experiment_id);117 yield testDatasets({assertExists: false});118 yield testBestMearureHistroy({assertExists: false});119 yield testProcessesSamples({assertExists: false});120 yield testFileLinks({assertExists: false});121 yield testNotes({assertExists: false});122 });123 it('with deleteProcess false - deletes experiment, but not process, samples, etc.', function* () {124 this.timeout(80000); // test take up to 8 seconds125 yield setup();126 let project_id = project.id;127 assert.isOk(project_id);128 let experiment_id = experiment.id;129 assert.isOk(experiment_id);130 yield testDatasets({assertExists: true});131 yield testBestMearureHistroy({assertExists: true});132 yield testProcessesSamples({assertExists: true});133 yield testFileLinks({assertExists: true});134 yield testNotes({assertExists: true});135 // delete experiment136 let results = yield experimentDelete137 .deleteExperimentFull(project_id, experiment_id, {deleteProcesses: false, dryRun: false});138 checkResultsForNotDeleteProcess(results);139 yield checkLinks(experiment_id);140 yield testDatasets({assertExists: false});141 yield testBestMearureHistroy({assertExists: true});142 yield testProcessesSamples({assertExists: true});143 yield testFileLinks({assertExists: false});144 yield testNotes({assertExists: false});145 });146 it.skip('with dry run true, delete process true - shows all will be deleted', function* () {147 this.timeout(80000); // test take up to 8 seconds148 yield setup();149 let project_id = project.id;150 assert.isOk(project_id);151 let experiment_id = experiment.id;152 assert.isOk(experiment_id);153 yield testDatasets({assertExists: true});154 yield testBestMearureHistroy({assertExists: true});155 yield testProcessesSamples({assertExists: true});156 yield testFileLinks({assertExists: true});157 yield testNotes({assertExists: true});158 // delete experiment159 let results = yield experimentDelete160 .deleteExperimentFull(project_id, experiment_id, {deleteProcesses: true, dryRun: true});161 checkResults(results);162 yield checkLinks(experiment_id, {forDryRun: true});163 yield testDatasets({assertExists: true});164 yield testBestMearureHistroy({assertExists: true});165 yield testProcessesSamples({assertExists: true});166 yield testFileLinks({assertExists: true});167 yield testNotes({assertExists: true});168 });169 it.skip('with dry run true, delete process false - shows some will be deleted', function* () {170 this.timeout(80000); // test take up to 8 seconds171 yield setup();172 let project_id = project.id;173 assert.isOk(project_id);174 let experiment_id = experiment.id;175 assert.isOk(experiment_id);176 yield testDatasets({assertExists: true});177 yield testBestMearureHistroy({assertExists: true});178 yield testProcessesSamples({assertExists: true});179 yield testFileLinks({assertExists: true});180 yield testNotes({assertExists: true});181 // delete experiment182 let results = yield experimentDelete183 .deleteExperimentFull(project_id, experiment_id, {deleteProcesses: false, dryRun: true});184 checkResultsForNotDeleteProcess(results);185 yield checkLinks(experiment_id, {forDryRun: true});186 yield testDatasets({assertExists: true});187 yield testBestMearureHistroy({assertExists: true});188 yield testProcessesSamples({assertExists: true});189 yield testFileLinks({assertExists: true});190 yield testNotes({assertExists: true});191 });192 });193});194function* setup() {195 let valOrError = yield testHelpers.createDemoTestProject(user);196 assert.isUndefined(valOrError.error, "Unexpected error from createDemoProjectForUser: " + valOrError.error);197 let results = valOrError.val;198 project = results.project;199 experiment = results.experiment;200 processList = results.processList;201 sampleList = results.sampleList;202 fileList = results.fileList;203 assert.equal(project.otype, "project");204 assert.equal(project.owner, userId);205 datasetList = yield testHelpers.createDatasetList(experiment, processList, userId);206 // Note: create fake sample that is not part of a process for testing207 results = yield r.table('samples').insert({'name': 'fake sample', 'otype': 'sample', 'owner': 'noone'});208 let key = results.generated_keys[0];209 yield r.table('experiment2sample').insert({sample_id: key, experiment_id: experiment.id});210 yield r.table('project2sample').insert({sample_id: key, project_id: project.id});211 yield setUpFakeNotes();212}213function checkResults(results) {214 assert.isOk(results);215 assert.isOk(results.val);216 assert.isOk(results.val.datasets);217 assert.equal(results.val.datasets.length, 2);218 assert.isOk(results.val.best_measure_history);219 assert.equal(results.val.best_measure_history.length, 1);220 assert.isOk(results.val.processes);221 assert.equal(results.val.processes.length, 5);222 assert.isOk(results.val.samples);223 assert.equal(results.val.samples.length, 8);224 assert.isOk(results.val.notes);225 assert.equal(results.val.notes.length, 1);226 assert.isOk(results.val.experiments);227 assert.equal(results.val.experiments.length, 1);228 assert.equal(results.val.experiments[0], experiment.id);229}230function checkResultsForNotDeleteProcess(results) {231 assert.isOk(results);232 assert.isOk(results.val);233 assert.isOk(results.val.datasets);234 assert.equal(results.val.datasets.length, 2);235 assert.isOk(results.val.best_measure_history);236 assert.equal(results.val.best_measure_history.length, 0);237 assert.isOk(results.val.processes);238 assert.equal(results.val.processes.length, 0);239 assert.isOk(results.val.samples);240 assert.equal(results.val.samples.length, 0);241 assert.isOk(results.val.notes);242 assert.equal(results.val.notes.length, 1);243 assert.isOk(results.val.experiments);244 assert.equal(results.val.experiments.length, 1);245 assert.equal(results.val.experiments[0], experiment.id);246}247function* checkLinks(experiment_id, options) {248 let forDryRun = options && options.forDryRun;249 let tables = [250 'experiment2datafile',251 'experiment2dataset',252 'experiment2process',253 'experiment2sample',254 'project2experiment'255 ];256 if (forDryRun) {257 let lengths = [16, 2, 1, 1, 5, 8, 1];258 for (let i = 0; i < tables.length; i++) {259 let table = tables[i];260 let list = yield r.table(table).getAll(experiment_id, {index: 'experiment_id'});261 let expectedLength = lengths[i];262 let l = list.length;263 let message = `missing links in ${table} for experment id = ${experiment_id}`264 assert.equal(l, expectedLength, message);265 }266 } else {267 for (let i = 0; i < tables.length; i++) {268 let table = tables[i];269 let list = yield r.table(table).getAll(experiment_id, {index: 'experiment_id'});270 let l = list.length;271 let message = `expected no links in ${table}, but found ${l} for experment id = ${experiment_id}`272 assert.equal(l, 0, message);273 }274 }275}276function* testDatasets(options) {277 let datasetCount = 0;278 let processCount = 0;279 let experimentCount = 0;280 if (options && options.assertExists) {281 datasetCount = 2;282 processCount = 10;283 experimentCount = 2;284 }285 let idList = [];286 for (let i = 0; i < datasetList.length; i++) {287 idList.push(datasetList[i].id);288 }289 let check = yield experimentDatasets.getDatasetsForExperiment(experiment.id);290 let dataset_list = check.val;291 assert.isOk(dataset_list);292 assert.equal(dataset_list.length, datasetCount);293 check = yield r.table('dataset2process').getAll(r.args([...idList]), {index: 'dataset_id'});294 assert.isOk(check);295 assert.equal(check.length, processCount);296 check = yield r.table('experiment2dataset').getAll(r.args([...idList]), {index: 'dataset_id'});297 assert.isOk(check);298 assert.equal(check.length, experimentCount);299}300function* testBestMearureHistroy(options) {301 let count = 0;302 if (options && options.assertExists) {303 count = 1;304 }305 let idList = yield r.table('project2sample')306 .getAll(project.id, {index: 'project_id'})307 .eqJoin('sample_id', r.table('samples')).zip()308 .eqJoin('sample_id', r.table('sample2propertyset'), {index: 'sample_id'}).zip()309 .eqJoin('property_set_id', r.table('propertysets')).zip()310 .eqJoin('property_set_id', r.table('propertyset2property'), {index: 'property_set_id'}).zip()311 .eqJoin('property_id', r.table('properties')).zip()312 .eqJoin('property_id', r.table('best_measure_history'), {index: 'property_id'}).zip()313 .getField('property_id');314 assert.isOk(idList);315 assert.equal(idList.length, count);316}317function* testProcessesSamples(options) {318 let processCount = 0;319 let sampleCount = 0;320 if (options && options.assertExists) {321 processCount = 5;322 sampleCount = 8;323 }324 let sampleList = yield r.table('project2sample')325 .getAll(project.id, {index: 'project_id'})326 .eqJoin('sample_id', r.table('samples')).zip()327 .getField('sample_id');328 assert.isOk(sampleList);329 assert.equal(sampleList.length, sampleCount);330 let results = yield processes.getProjectProcesses(project.id);331 assert.isOk(results);332 assert.isOk(results.val);333 let procList = results.val;334 assert.equal(procList.length, processCount);335}336function* testFileLinks(options) {337 let count = 0;338 if (options && options.assertExists) {339 count = 16;340 }341 let idList = [];342 for (let i = 0; i < fileList.length; i++) {343 idList.push(fileList[i].id);344 }345 let linkList = yield r.table('experiment2datafile').getAll(r.args(idList), {index: 'datafile_id'});346 assert.isOk(linkList);347 assert.equal(linkList.length, count);348}349function* testNotes(options) {350 let counts = [0, 0, 0, 0];351 if (options && options.assertExists) {352 counts = [1, notes_count];353 }354 let countOfNotes = counts[0];355 let countOfNoteItems = counts[1];356 let id_list = [];357 for (let i = 0; i < processList.length; i++) {358 id_list.push(processList[i].id);359 }360 for (let i = 0; i < sampleList.length; i++) {361 id_list.push(sampleList[i].id);362 }363 for (let i = 0; i < fileList.length; i++) {364 id_list.push(fileList[i].id);365 }366 let entities = yield r.table('note2item').getAll(r.args(id_list), {index: 'item_id'});367 assert.equal(entities.length, countOfNoteItems);368 let noteIdSet = new Set();369 for (let i = 0; i < entities.length; i++) {370 noteIdSet = noteIdSet.add(entities[i].note_id);371 }372 assert.equal(noteIdSet.size, countOfNotes);373}374function* setUpFakeNotes() {375 // set up fake note data376 let fake_note_entry = {377 title: 'Fake note entry for testing',378 note: 'Test of fake note',379 owner: project.owner,380 projectId: project.id,381 };382 let insert_msg = yield r.table('notes').insert(fake_note_entry);383 let noteId = insert_msg.generated_keys[0];384 let entities = [];385 for (let i = 0; i < processList.length; i++) {386 let note2item = {387 item_id: processList[i].id,388 item_type: 'process',389 note_id: noteId390 };391 entities.push(note2item);392 }393 for (let i = 0; i < sampleList.length; i++) {394 let note2item = {395 item_id: sampleList[i].id,396 item_type: 'sample',397 note_id: noteId398 };399 entities.push(note2item);400 }401 for (let i = 0; i < fileList.length; i++) {402 let note2item = {403 item_id: fileList[i].id,404 item_type: 'files',405 note_id: noteId406 };407 entities.push(note2item);408 }409 insert_msg = yield r.table('note2item').insert(entities);410 assert.equal(insert_msg.generated_keys.length, entities.length);411 notes_count = entities.length;412 yield testNotes({assertExists: true});...

Full Screen

Full Screen

test.js

Source:test.js Github

copy

Full Screen

...8 casper.start(partialURL, function() {9 this.wait(30000, function() {10 test.assertTitle('Real-Time Mexico City Air Quality Index',11 'homepage title is the one expected');12 test.assertExists('svg g path', 'station square exists');13 test.assertExists('canvas', 'canvas exists');14 test.assertExists('img.leaflet-tile-loaded', 'map tiles exist');15 });16 });17 casper.thenOpen(partialURL + '/es/index.html', function() {18 this.wait(30000, function() {19 test.assertExists('svg g path', 'station square exists');20 test.assertExists('canvas', 'canvas exists');21 test.assertExists('img.leaflet-tile-loaded', 'map tiles exist');22 });23 });24 casper.thenOpen(partialURL + '/es/temperature.html', function() {25 this.wait(30000, function() {26 test.assertExists('svg g path', 'station square exists');27 test.assertExists('canvas', 'canvas exists');28 test.assertExists('img.leaflet-tile-loaded', 'map tiles exist');29 });30 });31 casper.thenOpen(partialURL + '/temperature.html', function() {32 this.wait(30000, function() {33 test.assertExists('svg g path', 'station square exists');34 test.assertExists('canvas', 'canvas exists');35 test.assertExists('img.leaflet-tile-loaded', 'map tiles exist');36 });37 });38 casper.thenOpen(partialURL + '/wind.html', function() {39 this.wait(30000, function() {40 test.assertExists('svg g path', 'station square exists');41 test.assertExists('canvas', 'canvas exists');42 test.assertExists('img.leaflet-tile',43 'en wind map tiles exist');44 });45 });46 casper.thenOpen(partialURL + '/es/wind.html', function() {47 this.wait(30000, function() {48 test.assertExists('svg g path', 'station square exists');49 test.assertExists('canvas', 'canvas exists');50 test.assertExists('img.leaflet-tile-loaded',51 'es wind map tiles exist');52 });53 });54 casper.thenOpen(partialURL + '/es/ozone.html', function() {55 this.wait(30000, function() {56 test.assertExists('div.line-chart svg path',57 'small multiple line chart exists');58 test.assertEval(function() {59 return __utils__60 .findAll('div.line-chart svg path').length >= 10;61 }, 'should have lots of charts');62 });63 });64 casper.thenOpen(partialURL + '/ozone.html', function() {65 this.wait(30000, function() {66 test.assertExists('div.line-chart svg path',67 'small multiple line chart exists');68 test.assertEval(function() {69 return __utils__70 .findAll('div.line-chart svg path').length >= 10;71 }, 'should have lots of charts');72 });73 });74 casper.thenOpen(partialURL + '/es/pm10.html', function() {75 this.wait(30000, function() {76 test.assertExists('div.line-chart svg path',77 'small multiple line chart exists');78 });79 });80 casper.thenOpen(partialURL + '/pm10.html', function() {81 this.wait(30000, function() {82 test.assertExists('div.line-chart svg path',83 'small multiple line chart exists');84 });85 });86 casper.thenOpen(partialURL + '/es/so2.html', function() {87 this.wait(30000, function() {88 test.assertExists('div.line-chart svg path',89 'small multiple line chart exists');90 });91 });92 casper.thenOpen(partialURL + '/so2.html', function() {93 this.wait(30000, function() {94 test.assertExists('div.line-chart svg path',95 'small multiple line chart exists');96 });97 });98 casper.thenOpen(partialURL + '/es/no2.html', function() {99 this.wait(30000, function() {100 test.assertExists('div.line-chart svg path',101 'small multiple line chart exists');102 });103 });104 casper.thenOpen(partialURL + '/no2.html', function() {105 this.wait(30000, function() {106 test.assertExists('div.line-chart svg path',107 'small multiple line chart exists');108 });109 });110 casper.thenOpen(partialURL + '/es/co.html', function() {111 this.wait(30000, function() {112 test.assertExists('div.line-chart svg path',113 'small multiple line chart exists');114 });115 });116 casper.thenOpen(partialURL + '/co.html', function() {117 this.wait(30000, function() {118 test.assertExists('div.line-chart svg path',119 'small multiple line chart exists');120 });121 });122 casper.thenOpen(partialURL + '/es/nox.html', function() {123 this.wait(30000, function() {124 test.assertExists('div.line-chart svg path',125 'small multiple line chart exists');126 });127 });128 casper.thenOpen(partialURL + '/nox.html', function() {129 this.wait(30000, function() {130 test.assertExists('div.line-chart svg path',131 'small multiple line chart exists');132 });133 });134 casper.thenOpen(partialURL + '/es/pm25.html', function() {135 this.wait(30000, function() {136 test.assertExists('div.line-chart svg path',137 'small multiple line chart exists');138 });139 });140 casper.thenOpen(partialURL + '/pm25.html', function() {141 this.wait(30000, function() {142 test.assertExists('div.line-chart svg path',143 'small multiple line chart exists');144 });145 });146 casper.thenOpen(partialURL + '/es/about.html');147 casper.thenOpen(partialURL + '/about.html');148 casper.on('page.error', function(msg, trace) {149 this.echo('Error: ' + msg, 'ERROR');150 this.echo('file: ' + trace[0].file, 'WARNING');151 this.echo('line: ' + trace[0].line, 'WARNING');152 this.echo('function: ' + trace[0]['function'], 'WARNING');153 errors.push(msg);154 test.fail('console error');155 });156 casper.on('resource.received', function(resource) {...

Full Screen

Full Screen

af.annonsera.utan.konto.js

Source:af.annonsera.utan.konto.js Github

copy

Full Screen

...53 }54}55function controllingPageExist_Exists(test) {56 test.assertTextDoesntExist("UTVECKLINGSMILJÖ - (WS/UTV2/U1)", "Inte i Utvecklingsmiljön");57 test.assertExists('form[name="aspnetForm"]', 'ASP.NET-sidan finns');58 test.assertTitle("Annonsera utan konto - Arbetsförmedlingen", "Sidtiteln på Annonsera utan konto finns");59}60function controllingElementsExist_Exists(test) {61 casper.echo("Knappar");62 test.assertExists('input[name$="btnRensa1"]', "");63 test.assertExists('input[name$="btnFortsatt1"]', "");64 test.assertExists('input[name$="btnRensa2"]', "");65 test.assertExists('input[name$="btnFortsatt2"]', "");66 casper.echo("\nInformation om företaget");67 test.assertExists('input[name$="txtForetag"]', "");68 test.assertExists('input[name$="txtOrgNr"]', "");69 test.assertExists('input[name$="txtBesoksadress"]', "");70 test.assertExists('input[name$="txtPostadress"]', "");71 test.assertExists('input[name$="txtPostnummer"]', "");72 test.assertExists('input[name$="txtOrt"]', "");73 test.assertExists('input[name$="txtTelefon"]', "");74 test.assertExists('input[name$="txtFax"]', "");75 test.assertExists('input[name$="txtVaxel"]', "");76 test.assertExists('input[name$="txtHemsida"]', "");77 test.assertExists('input[name$="txtEpost"]', "");78 test.assertExists('textarea[name$="txtForetagsbeskrivning"]', "");79 casper.echo("\nInformation om ledig tjänst");80 test.assertExists('input[name$="txtArbetsplats"]', "");81 test.assertExists('input[name$="txtArbetsplatsPostnummer"]', "");82 test.assertExists('input[name$="txtArbetsplatsOrt"]', "");83 test.assertExists('input[name$="txtYrkesbenamning"]', "");84 test.assertExists('textarea[name$="txtArbetsuppgifter"]', "");85 test.assertExists('textarea[name$="txtKvalifikationer"]', "");86 casper.echo("\nAnställningsvillkor");87 test.assertExists('input[name$="txtTilltradesdatum"]', "");88 test.assertExists('select[name$="ddAnstallningstyp"]', "");89 test.assertExists('select[name$="ddErfarenhet"]', "");90 test.assertExists('select[name$="ddVaraktighet"]', "");91 test.assertExists('select[name$="ddArbetstid"]', "");92 test.assertExists('input[name$="txtArbetstidOvrigt"]', "");93 test.assertExists('select[name$="ddLoneform"]', "");94 test.assertExists('input[name$="txtLoneformOvrigt"]', "");95 test.assertExists('textarea[name$="txtOvrigavillkor"]', "");96 casper.echo("\nAnsökan");97 test.assertExists('input[name$="txtAnsokanSenastDatum"]', "");98 test.assertExists('input[name$="txtAnsokanReferensnummer"]', "");99 test.assertExists('input[name$="cbxAnsokanSkriftlig"]', "");100 test.assertExists('textarea[name$="txtAnsokanAndraUppgifter"]', "");101 casper.echo("\nKontaktpersoner");102 test.assertExists('input[name$="txtKpers1Funktion"]', "");103 test.assertExists('input[name$="txtKpers1Namn"]', "");104 test.assertExists('input[name$="txtKpers1Epost"]', "");105 test.assertExists('input[name$="txtKpers1Telefon"]', "");106 test.assertExists('input[name$="txtKpers1Fax"]', "");107 test.assertExists('input[name$="txtKpers2Funktion"]', "");108 test.assertExists('input[name$="txtKpers2Namn"]', "");109 test.assertExists('input[name$="txtKpers2Epost"]', "");110 test.assertExists('input[name$="txtKpers2Telefon"]', "");111 test.assertExists('input[name$="txtKpers2Fax"]', "");112 test.assertExists('input[name$="txtKpers3Funktion"]', "");113 test.assertExists('input[name$="txtKpers3Namn"]', "");114 test.assertExists('input[name$="txtKpers3Epost"]', "");115 test.assertExists('input[name$="txtKpers3Telefon"]', "");116 test.assertExists('input[name$="txtKpers3Fax"]', "");117 casper.echo("\nInformation till arbetsförmedlingen");118 test.assertExists('input[name$="txtAfAnnonseraFrom"]', "");119 test.assertExists('input[name$="txtAfAnnonseraTom"]', "");120 test.assertExists('textarea[name$="txtAfOvrigaUpplysningar"]', "");121}122function fillFormCorrectly_OnlyMandatory_FilledCorrectly(test) {123 casper.fillSelectors('form[name="aspnetForm"]', {124 ////Information om företaget125 'input[name$="txtForetag"]': 'CasperJS_txtForetag',126 'input[name$="txtOrgNr"]': '0123456789',127 'input[name$="txtBesoksadress"]': 'CasperJS_txtBesoksadress',128 'input[name$="txtPostadress"]': 'CasperJS_txtPostadress',129 'input[name$="txtPostnummer"]': '12345',130 'input[name$="txtOrt"]': 'CasperJS_txtOrt',131 'input[name$="txtTelefon"]': '123456789',132 'textarea[name$="txtForetagsbeskrivning"]': 'CasperJS_txtForetagsbeskrivning',133 'input[name$="txtYrkesbenamning"]': 'CasperJS_txtYrkesbenamning',134 'textarea[name$="txtArbetsuppgifter"]': 'CasperJS_txtArbetsuppgifter',...

Full Screen

Full Screen

onepage-guest.js

Source:onepage-guest.js Github

copy

Full Screen

...6 casper.start(mage.getDirectUrl('apparel.html'), function () {7 test.assertHttpStatus(200);8 test.assertUrlMatch(mage.getDirectUrl('apparel.html'));9 // check that the home page has the link login10 test.assertExists('button.button.btn-cart:first-child');11 this.click('button.button.btn-cart:first-child');12 })13 .waitForUrl(mage.getDirectUrl('coalesce-functioning-on-impatience-t-shirt.html'), function() {14 test.assertHttpStatus(200);15 test.assertUrlMatch(mage.getDirectUrl('coalesce-functioning-on-impatience-t-shirt.html'));16 this.evaluate(function() {17 var elmt = document.querySelector('select#attribute525');18 elmt.selectedIndex = 2;19 elmt.onchange();20 });21 // check that the home page has the link login22 test.assertExists('button.button.btn-cart');23 this.click('button.button.btn-cart');24 })25 .waitForUrl(mage.getUrl('checkout/cart'), function() {26 test.assertHttpStatus(200);27 test.assertUrlMatch(mage.getUrl('checkout/cart'));28 test.assertExists('.messages .success-msg');29 test.assertElementCount('#shopping-cart-table tbody tr', 1);30 test.assertExists('.cart .totals .checkout-types li button.button');31 this.click('.btn-checkout');32 })33 .waitForUrl(mage.getUrl('checkout/onepage'), function() {34 test.assertHttpStatus(200);35 test.assertExists('input[name="checkout_method"]');36 test.assertExists('#onepage-guest-register-button');37 38 this.evaluate(function() {39 document.getElementById('login:guest').checked = true;40 checkout.setMethod();41 });42 test.pass('Try to go trough checkout as Guest');43 })44 /* Billing address step */45 .waitUntilVisible('#opc-billing', function() {46 test.assertExists('input[name="billing[firstname]"]');47 test.assertExists('input[name="billing[lastname]"]');48 test.assertExists('input[name="billing[company]"]');49 test.assertExists('input[name="billing[email]"]');50 test.assertExists('input[name="billing[street][]"]');51 test.assertExists('input[name="billing[city]"]');52 test.assertExists('select[name="billing[region_id]"]');53 test.assertExists('input[name="billing[postcode]"]');54 test.assertExists('select[name="billing[country_id]"]');55 test.assertExists('input[name="billing[telephone]"]');56 test.assertExists('input[name="billing[fax]"]');57 test.assertExists('input[name="billing[use_for_shipping]"]');58 this.fill('form#co-billing-form', {59 'billing[firstname]' : login_user_firstname,60 'billing[lastname]' : login_user_lastname,61 'billing[company]' : user_address_company,62 'billing[email]' : login_user_username,63 'billing[street][]' : user_address_street,64 'billing[city]' : user_address_city,65 'billing[postcode]' : user_address_postcode,66 'billing[telephone]' : user_address_telephone,67 'billing[fax]' : user_address_fax68 }, false);69 /* Set country and region_id dropdowns */70 this.evaluate(function(regionId, countryId) {71 function setSelectedValue(selectObj, valueToSet) {72 for (var i = 0; i < selectObj.options.length; i++) {73 if (selectObj.options[i].text== valueToSet) {74 selectObj.options[i].selected = true;75 return;76 }77 }78 }79 try {80 var regionIdObject = document.getElementById('billing:region_id');81 var countryIdObject = document.getElementById('billing:country_id');82 83 setSelectedValue(regionIdObject, regionId);84 setSelectedValue(countryIdObject, countryId);85 document.getElementById('billing:use_for_shipping_yes').checked = true;86 billing.save();87 } catch (err) {88 console.log(err);89 }90 }, { regionId: user_address_region, countryId: user_address_country });91 test.pass('Filling the billing address form and use this address as shipping');92 })93 /* Shipping method step */94 .waitUntilVisible('#checkout-step-shipping_method', function() {95 test.assertExists('.sp-methods');96 this.evaluate(function() {97 shippingMethod.save();98 });99 test.pass('Using flat rate as shipping method');100 })101 /* Payment method step */102 .waitUntilVisible('#checkout-step-payment', function() {103 this.evaluate(function() {104 document.getElementById('p_method_checkmo').checked = true;105 payment.save();106 });107 test.pass('Using "Check / Money order" as payment method');108 })109 /* Order review step */110 .waitUntilVisible('#checkout-step-review', function() {111 test.assertExists('#checkout-review-table');112 test.assertExists('button.btn-checkout');113 this.click('button.btn-checkout');114 test.pass('Placing the order');115 })116 /* Order success page */117 .waitForUrl(mage.getUrl('checkout/onepage/success'), function() {118 test.assertHttpStatus(200);119 test.assertExists('.checkout-onepage-success');120 test.pass('The order has been placed successfully');121 })122 .run(function () {123 test.done();124 });...

Full Screen

Full Screen

casperjs-test-login.js

Source:casperjs-test-login.js Github

copy

Full Screen

1casper.test.begin('The heading exists', 37, function suite(test) {2 casper.start('http://localhost/Lunch/loginpage.html', function() {3 test.assertTitle('Log In', 'Title is exist');4 test.assertTitleMatch(/Log In/, 'Ok');5 test.assertExists('head');6 test.assertExists('head > meta');7 test.assertExists('head > link');8 test.assertElementCount('link', 2);9 test.assertExists('head > script');10 test.assertExists('head > title');11 test.assertSelectorHasText('title', 'Log In');12 test.assertElementCount('div', 9);13 test.assertExists('div#test');14 test.assertExists('div.loginbox');15 test.assertExists('div > center');16 test.assertSelectorHasText('div > center', 'Sign in');17 test.assertExists('div#login-content');18 test.assertExists('center');19 test.assertExists('center#errormsg');20 test.assertElementCount('div.login-component', 2);21 test.assertExists('div.login-component>input[type="email"]');22 test.assertExists('div.login-component>input[id="email"]');23 test.assertExists('div.login-component>input[placeholder="Email"]');24 test.assertExists('div.login-component>input[required]');25 test.assertExists('div > input');26 test.assertElementCount('input', 4);27 test.assertExists('div.login-component>input[type="password"]');28 test.assertExists('div.login-component>input[id="pswd"]');29 test.assertExists('div.login-component>input[placeholder="Password"]');30 test.assertExists('div#checkbox>input[type="checkbox"]');31 test.assertSelectorHasText('div#checkbox', 'Remember me');32 test.assertExists('div#botton');33 test.assertExists('div#botton>input[name="signin"]');34 test.assertExists('div#botton.parentNode>input[type="botton"]');35 test.assertExists('div#botton>input[value="Sign in"]');36 test.assertExists('div#botton>input[id="botton"]');37 test.assertExists('div#botton>input[onclick="return login()"]');38 test.assertHttpStatus(200);39 test.assertUrlMatch(/^http:\/\//, 'localhost is served in http://');40 }).run(function() {41 test.done();42 });43});44casper.thenClick('div#botton', function() {45 this.echo("PASS I clicked on first link found, the page is now loaded.");46});...

Full Screen

Full Screen

casperjs-test-order.js

Source:casperjs-test-order.js Github

copy

Full Screen

1casper.test.begin('The heading exists', 38, function suite(test) {2 casper.start('http://localhost/Lunch/orderpage.html', function() {3 test.assertTitle('Let\'s have tasty break', 'Title is exist');4 test.assertTitleMatch(/Let\'s have tasty break/, 'Ok');5 test.assertExists('head');6 test.assertExists('head > meta');7 test.assertExists('head > link');8 test.assertElementCount('link', 2);9 test.assertExists('head > script');10 test.assertExists('head > title');11 test.assertSelectorHasText('title', 'Let\'s have tasty break');12 test.assertElementCount('div', 14);13 test.assertElementCount('input', 2);14 test.assertHttpStatus(200, 'Successfully opened page.');15 test.assertUrlMatch(/^http:\/\//, 'localhost is served in http://');16 test.assertExists('body[onload="printOldOrders(),getPlaces()"]');17 test.assertExists('div#main');18 test.assertExists('form[name="orders"]');19 test.assertExists('form>div#placesDiv');20 test.assertExists('form>div > select');21 test.assertExists('form>div > select#places');22 test.assertExists('form>div#productsDiv');23 test.assertExists('div>input');24 test.assertExists('div>input[name="products"]');25 test.assertExists('div>input[id="products"]');26 test.assertExists('div>input[type="text"]');27 test.assertExists('div>input[placeholder="Type product name"]');28 test.assertExists('div>input[onkeyup="setTimeout(function() { loadproducts(); }, 1500)"]');29 test.assertExists('div#product_list');30 test.assertExists('div#countDiv');31 test.assertExists('div>input[min="1"]');32 test.assertExists('div>input[id="count"]');33 test.assertExists('div>input[type="number"]');34 test.assertExists('div>input[placeholder="Input count"]');35 test.assertExists('form>button');36 test.assertExists('form>button[name="addButton"]');37 test.assertExists('form>button[id="addButton"]');38 test.assertSelectorHasText('form>button', 'Add');39 test.assertExists('div#table');40 test.assertExists('div#table', "empty");41 42 }).run(function() {43 test.done();44 });45});...

Full Screen

Full Screen

casperjs-test-distributorpage.js

Source:casperjs-test-distributorpage.js Github

copy

Full Screen

1casper.test.begin('The heading exists', 25, function suite(test) {2 casper.start('http://localhost/Lunch/distributorpage.html', function() {3 test.assertTitle('Distributor', 'Title is exist');4 test.assertTitleMatch(/Distributor/, 'Ok');5 test.assertExists('head');6 test.assertExists('head > meta');7 test.assertExists('head > link');8 test.assertElementCount('link', 2);9 test.assertExists('head > script');10 test.assertExists('head > title');11 test.assertSelectorHasText('title', 'Distributor');12 test.assertElementCount('div', 2);13 test.assertHttpStatus(200, 'Successfully opened page.');14 test.assertUrlMatch(/^http:\/\//, 'localhost is served in http://');15 test.assertExists('div#distributorMainField');16 test.assertExists('div.clearfix');17 test.assertExists('div#distributors');18 test.assertExists('div>table');19 test.assertExists('div>table.table');20 test.assertExists('div>table[border="1"]');21 test.assertSelectorHasText('tr>th', 'Place');22 test.assertSelectorHasText('tr>th', 'Distributor');23 test.assertSelectorHasText('tr>td>a', 'Tashir');24 test.assertSelectorHasText('tr>td>a', 'Valod');25 test.assertExists('tr>td>a[id="tashir"]');26 test.assertExists('tr>td>a[id="valod"]');27 test.assertExists('tr>td>a[href="placespage.html"]');28 29 }).run(function() {30 test.done();31 });32});33casper.thenEvaluate(function(term) {34}, 'CasperJS');35casper.then(function() {36 this.click('tr>td>a#valod');37 this.click('tr>td>a#tashir');38});39casper.then(function() {40 console.log('PASS clicked ok, new location is ' + this.getCurrentUrl());41});...

Full Screen

Full Screen

casperjs-test-placespage.js

Source:casperjs-test-placespage.js Github

copy

Full Screen

1casper.test.begin('The heading exists', 27, function suite(test) {2 casper.start('http://localhost/Lunch/placespage.html', function() {3 test.assertTitle('Orders', 'Title is exist');4 test.assertTitleMatch(/Orders/, 'Ok');5 test.assertExists('head');6 test.assertExists('head > meta');7 test.assertExists('head > link');8 test.assertElementCount('link', 2);9 test.assertExists('head > script');10 test.assertExists('head > title');11 test.assertSelectorHasText('title', 'Orders');12 test.assertElementCount('div', 4);13 test.assertHttpStatus(200, 'Successfully opened page.');14 test.assertUrlMatch(/^http:\/\//, 'localhost is served in http://');15 test.assertExists('body[onload="changeName(); addProductList(); addUserList()"]');16 test.assertExists('div#distributorMainField');17 test.assertExists('div.clearfix'); 18 test.assertExists('h1#placeName');19 test.assertExists('div#productList1');20 test.assertExists('table#productTable');21 test.assertExists('table.table');22 test.assertSelectorHasText('tr', 'ProductList');23 test.assertSelectorHasText('tr > td > h5', 'Product');24 test.assertSelectorHasText('tr > td > h5', 'Count');25 test.assertSelectorHasText('tr > td > h5', 'Name');26 test.assertExists('div.productList2');27 test.assertExists('table#nameTable');28 test.assertExists('table#orderTable');29 test.assertElementCount('div > table', 3);30 }).run(function() {31 test.done();32 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const assert = require('assert');2const wdio = require('webdriverio');3const opts = {4 capabilities: {5 }6}7const client = wdio.remote(opts);8client.init()9 .then(() => client.assertExists('elementId', 'error message'))10 .then(() => client.end());11const assert = require('assert');12const wdio = require('webdriverio');13const opts = {14 capabilities: {15 }16}17const client = wdio.remote(opts);18client.init()19 .then(() => client.assertExists('elementId', 'error message'))20 .then(() => client.end());21assertExists (elementId, errorMessage) ¶22Example: client.assertExists('elementId', 'error message')23assertNotExist (elementId, errorMessage) ¶24Example: client.assertNotExist('elementId', 'error message')25assertAttribute (elementId, attributeName, expectedAttributeValue, errorMessage) ¶

Full Screen

Using AI Code Generation

copy

Full Screen

1const assert = require('assert');2const wd = require('wd');3const path = require('path');4const { assertExists } = require('appium-xcuitest-driver/lib/commands/element.js');5const { getDriver } = require('./helpers');6const { HOST, PORT, BUNDLE_ID } = require('./helpers');7describe('Sample Test', function () {8 this.timeout(600000);9 let driver;10 before(async () => {11 driver = await getDriver();12 });13 after(async () => {14 await driver.quit();15 });16 it('should find the element', async () => {17 const el = await driver.elementByAccessibilityId('Alert Views');18 await assertExists.call(driver, el);19 });20});21 at assertExists (/Users/username/appium-xcuitest-driver/lib/commands/element.js:10:10)22 at Object.it (/Users/username/appium-xcuitest-driver/test.js:27:13)23 at process._tickCallback (internal/process/next_tick.js:68:7)24 at assertExists (/Users/username/appium-xcuitest-driver/lib/commands/element.js:10:10)25 at Object.it (/Users/username/appium-xcuitest-driver/test.js:31:13)26 at process._tickCallback (internal/process/next_tick.js:68:7)

Full Screen

Using AI Code Generation

copy

Full Screen

1const assertExists = require('appium-xcuitest-driver').assertExists;2assertExists('someElement');3const assertExists = require('appium-uiautomator2-driver').assertExists;4assertExists('someElement');5const assertExists = require('appium-espresso-driver').assertExists;6assertExists('someElement');7const assertExists = require('appium-windows-driver').assertExists;8assertExists('someElement');9const assertExists = require('appium-mac-driver').assertExists;10assertExists('someElement');11const assertExists = require('appium-youiengine-driver').assertExists;12assertExists('someElement');13const assertExists = require('appium-tizen-driver').assertExists;14assertExists('someElement');15const assertExists = require('appium-android-driver').assertExists;16assertExists('someElement');17const assertExists = require('appium-selendroid-driver').assertExists;18assertExists('someElement');19const assertExists = require('appium-fake-driver').assertExists;20assertExists('someElement');21const assertExists = require('appium-chromedriver').assertExists;22assertExists('someElement');23const assertExists = require('appium-selendroid-driver').assertExists;24assertExists('someElement');25const assertExists = require('appium-fake-driver').assertExists;26assertExists('someElement');27const assertExists = require('appium-chromedriver').assertExists;28assertExists('someElement');

Full Screen

Using AI Code Generation

copy

Full Screen

1var webdriver = require('selenium-webdriver');2var assert = require('assert');3var driver = new webdriver.Builder()4 .forBrowser('firefox')5 .build();6promise.then(function(){7 return driver.findElement(webdriver.By.name('q'));8}).then(function(element){9 return driver.assertExists(element);10}).then(function(isExist){11 assert.equal(isExist, true);12 console.log('Element is present in the page');13}).then(null, function(err){14 console.log(err);15});16driver.quit();

Full Screen

Using AI Code Generation

copy

Full Screen

1const assert = require('assert');2describe('iOS Native App', () => {3 it('should assert element exists', async () => {4 const element = await driver.$('~test-Assert');5 await element.assertExists();6 });7});8const assert = require('assert');9describe('iOS Native App', () => {10 it('should assert element exists', async () => {11 const element = await driver.$('~test-Assert');12 await element.assertExists();13 });14});15const assert = require('assert');16describe('iOS Native App', () => {17 it('should assert element exists', async () => {18 const element = await driver.$('~test-Assert');19 await element.assertExists();20 });21});22const assert = require('assert');23describe('iOS Native App', () => {24 it('should assert element exists', async () => {25 const element = await driver.$('~test-Assert');26 await element.assertExists();27 });28});29const assert = require('assert');30describe('iOS Native App', () => {31 it('should assert element exists', async () => {32 const element = await driver.$('~test-Assert');33 await element.assertExists();34 });35});36const assert = require('assert');37describe('iOS Native App', () => {38 it('should assert element exists', async () => {39 const element = await driver.$('~test-Assert');40 await element.assertExists();41 });42});43const assert = require('assert');44describe('iOS Native App', () => {45 it('should assert element exists', async () => {46 const element = await driver.$('~test-Assert');47 await element.assertExists();48 });49});

Full Screen

Using AI Code Generation

copy

Full Screen

1var assertExists = require('appium-xcuitest-driver').assertExists;2assertExists('test', 'test');3var assertMapping = require('appium-xcuitest-driver').assertMapping;4assertMapping('test', 'test');5var assertRequiredOptions = require('appium-xcuitest-driver').assertRequiredOptions;6assertRequiredOptions('test', 'test');7var assertRequiredParams = require('appium-xcuitest-driver').assertRequiredParams;8assertRequiredParams('test', 'test');9var assertWebview = require('appium-xcuitest-driver').assertWebview;10assertWebview('test', 'test');11var assertWindow = require('appium-xcuitest-driver').assertWindow;12assertWindow('test', 'test');13var checkParams = require('appium-xcuitest-driver').checkParams;14checkParams('test', 'test');15var checkParamsAndThrow = require('appium-xcuitest-driver').checkParamsAndThrow;16checkParamsAndThrow('test', 'test');17var checkParamsAndThrow = require('appium-xcuitest-driver').checkParamsAndThrow;18checkParamsAndThrow('test', 'test');19var checkParamsAndThrow = require('appium-xcuitest-driver').checkParamsAndThrow;20checkParamsAndThrow('test', 'test');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wd = require('wd');2var assert = require('assert');3var app = 'Calculator.app';4var device = 'iPhone 6';5var platform = 'iOS';6var platformVersion = '9.3';7var xcodeProject = 'Calculator';8var scheme = 'Calculator';9var configuration = 'Debug';10var appPath = '/Users/username/Projects/Calculator/build/Debug-iphonesimulator/Calculator.app';11var ipaPath = '/Users/username/Projects/Calculator/build/Debug-iphonesimulator/Calculator.ipa';12var archivePath = '/Users/username/Projects/Calculator/build/Debug-iphonesimulator/Calculator.xcarchive';13var testRunPath = '/Users/username/Projects/Calculator/build/Debug-iphonesimulator/Calculator.xctestrun';14var wdaLocalPort = 8100;15var wdaLaunchTimeout = 50000;16var wdaConnectionTimeout = 50000;17var wdaUseNewWDA = true;18var wdaUseSimpleBuildTest = true;19var wdaStartupRetries = 5;20var wdaStartupRetryInterval = 10000;21var wdaMaxTypingFrequency = 60;

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Appium Xcuitest Driver automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Sign up Free
_

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful