示例#1
0
 /**
  * @depends openDocfiles
  */
 public function addnewDocfiles(AcceptanceTester $I)
 {
     // excel
     $I->attachFile('UploadDocFile[docFile]', 'files/excel.xlsx');
     $I->wait(2);
     $I->click('//a[contains(@title, "Загрузить выбранные файлы")]');
     $I->wait(2);
     $I->seeElement('//td/a[contains(text(),"excel.xlsx")]/preceding::td/span/i[@class="fa fa-file-excel-o"]/preceding::td/button[@title="Удалить"]');
     $I->dontSeeElement('//span[@style="text-decoration: line-through" and text() = "excel.xlsx"]');
     // word
     $I->attachFile('UploadDocFile[docFile]', 'files/word.docx');
     $I->wait(2);
     $I->click('//a[contains(@title, "Загрузить выбранные файлы")]');
     $I->wait(2);
     $I->seeElement('//td/a[contains(text(),"word.docx")]/preceding::td/span/i[@class="fa fa-file-word-o"]/preceding::td/button[@title="Удалить"]');
     $I->dontSeeElement('//span[@style="text-decoration: line-through" and text() = "word.docx"]');
     // jpg
     $I->attachFile('UploadDocFile[docFile]', 'files/jpg.jpg');
     $I->wait(2);
     $I->click('//a[contains(@title, "Загрузить выбранные файлы")]');
     $I->wait(2);
     $I->seeElement('//td/a[contains(text(),"jpg.jpg")]/preceding::td/span/i[@class="fa fa-file-image-o"]/preceding::td/button[@title="Удалить"]');
     $I->dontSeeElement('//span[@style="text-decoration: line-through" and text() = "jpg.jpg"]');
     // png
     $I->attachFile('UploadDocFile[docFile]', 'files/png.png');
     $I->wait(2);
     $I->click('//a[contains(@title, "Загрузить выбранные файлы")]');
     $I->wait(2);
     $I->seeElement('//td/a[contains(text(),"png.png")]/preceding::td/span/i[@class="fa fa-file-image-o"]/preceding::td/button[@title="Удалить"]');
     $I->dontSeeElement('//span[@style="text-decoration: line-through" and text() = "png.png"]');
     //txt
     $I->attachFile('UploadDocFile[docFile]', 'files/text.txt');
     $I->wait(2);
     $I->click('//a[contains(@title, "Загрузить выбранные файлы")]');
     $I->wait(2);
     $I->seeElement('//td/a[contains(text(),"text.txt")]/preceding::td/span/i[@class="fa fa-file-text-o"]/preceding::td/button[@title="Удалить"]');
     $I->dontSeeElement('//span[@style="text-decoration: line-through" and text() = "text.txt"]');
     //unknown
     $I->attachFile('UploadDocFile[docFile]', 'files/unknown.unk');
     $I->wait(2);
     $I->see('Разрешена загрузка файлов только со следующими расширениями: png, jpg, jpeg, tiff, pdf, xls, xlsx, doc, docx, txt.');
     $I->click('//a[contains(@title, "Загрузить выбранные файлы")]');
     $I->wait(2);
 }
示例#2
0
 /**
  * Submit the project create/update form.
  * @param \AcceptanceTester|\FunctionalTester $I
  * @param array                               $fields
  */
 public static function submit($I, $fields)
 {
     if ($fields['image']) {
         $I->attachFile('#uploadform-newimage', $fields['image']);
     }
     $I->fillField(['name' => 'Project[name]'], $fields['name']);
     $I->selectOption(['name' => 'Project[coordinator]'], $fields['coordinator']);
     $I->fillField(['name' => 'Project[status]'], $fields['status']);
     $I->fillField(['name' => 'UploadForm[newImageDescription][]'], $fields['imageDescription']);
     $I->click('#project-form button');
 }
示例#3
0
 private function createPost(\AcceptanceTester $I)
 {
     $I->wantTo('create post');
     $I->amOnPage('/');
     //button click
     $I->waitForElement('#share-look .btn', 10);
     $I->click('#share-look .btn');
     $I->waitForElement('form[role="share-look"]', 10);
     $I->attachFile('input[type="file"]', 'Brightmelody-or-00_large.jpg');
     $I->fillfield('input[name="item-name[0]"]', 'bag');
     $I->fillfield('input[name="item-store[0]"]', 'zara');
     $I->fillfield('input[name="item-rating[0]"]', '5');
     $I->click('form[role="share-look"] .btn-primary');
     $I->waitForElement('.list-group', 10);
     $I->click('.list-group a:first-child');
     $I->waitForElement('.delete', 10);
     //@todo: remove after deletePost is created
     $I->click('.delete');
     $I->waitForElement('#modal-2 .btn-primary', 10);
     $I->click('#modal-2 .btn-primary');
 }
<?php

$I = new AcceptanceTester($scenario);
$I->am('the administrator');
$I->wantTo('publish a new ad');
$I->login_admin();
$I->activate_theme('basecamp');
$I->amOnPage('/publish-new.html');
$I->see('Publish new advertisement', 'h3');
$I->fillField('#title', "Admin ad basecamp theme");
$I->click('.select-category');
$I->fillField('category', '18');
$I->fillField('location', '57');
$I->fillField('#description', 'This is a new admin ad on basecamp theme');
$I->attachFile('input[id="fileInput0"]', 'photo.jpg');
$I->fillField('#phone', '99885522');
$I->fillField('#address', 'barcelona');
$I->fillField('#price', '25');
$I->fillField('#website', 'https://www.admin.com');
$I->click('submit_btn');
$I->see('Advertisement is posted. Congratulations!');
$I->amOnPage('/apartment/admin-ad-basecamp-theme.html');
$I->see('Admin ad basecamp theme');
$I->see('This is a new admin ad on basecamp theme');
$I->see('Barcelona');
$I->activate_theme('default');
$I->click('Logout');
$I->am('a user');
$I->wantTo('publish a new ad');
$I->login_admin();
$I->activate_theme('newspaper');
$I->click('Logout');
$I->amOnPage('/oc-panel/auth/login');
$I->fillField('email', '*****@*****.**');
$I->fillField('password', '1234');
$I->click('auth_redirect');
$I->amOnPage('/publish-new.html');
$I->see('Publish new advertisement');
$I->fillField('#title', "User ad on newspaper");
$I->click('.select-category');
$I->fillField('category', '18');
$I->fillField('location', '4');
$I->fillField('#description', 'This is a new user ad on newspaper theme');
$I->attachFile('input[type="file"]', 'photo.jpg');
$I->fillField('#phone', '99885522');
$I->fillField('#address', 'barcelona');
$I->fillField('#price', '25');
$I->fillField('#website', 'https://www.user.com');
$I->click('submit_btn');
$I->see('Advertisement is posted. Congratulations!');
$I->amOnPage('/apartment/user-ad-on-newspaper.html');
$I->see('User ad on newspaper');
$I->see('This is a new user ad on newspaper theme');
$I->see('Barcelona');
$I->click('Logout');
$I->login_admin();
$I->activate_theme('default');
$I->click('Logout');
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('Edit User Profile');
$I->amOnPage('/signup');
$user_time = time();
$I->fillField('#username', 'johndoe' . $user_time);
$I->fillField('#email', 'johndoe' . $user_time . '@gmail.com');
$I->fillField('#password', 'password');
$I->fillField('#password_confirmation', 'password');
$I->click('.form-signin button');
$I->reloadPage();
$I->click('.user-menu-desktop');
$I->wait(2);
$I->executeJS('return $(".user-menu-desktop").parent().addClass("open")');
$I->waitForElement('.user-profile-link-desktop', 10);
// secs
$I->click('.user-profile-link-desktop');
$I->click('.edit-user-profile');
$I->fillField('#username', 'bobsburgers');
$I->wait(2);
$I->fillField('#email', '*****@*****.**');
$I->wait(2);
$I->attachFile('input[name="avatar"]', 'bobsburgersavatar.jpg');
$I->click('.submit-update-profile');
$I->wait(2);
$I->see('successful');
<?php

$I = new AcceptanceTester($scenario);
$I->am('Site Administrator');
$I->wantTo('Add a new Product');
$I->amLoggedAs($I->aSiteAdministrator());
$I->amOnPage('/admin/products');
$I->click('Add Product');
$I->seeCurrentUrlEquals('/admin/products/create');
$category = \App\Repositories\Category::get()->toArray();
$I->selectOption('category', $category[0]['id']);
$I->fillField('name', 'Malt Liquor');
$I->fillField('description', 'Malt Liquor for you to describe');
$I->fillField('price', '34.00');
$I->fillField('quantity', '150');
$I->selectOption('status', '1');
$I->attachFile('image', 'roundrect8537796.gif');
$I->click('Create Product');
$I->seeCurrentUrlEquals('/admin/products');
$I->see('New Product: Malt Liquor Created');
$I->checkOption('firefood');
$I->checkOption('pot');
$I->checkOption('juice');
$I->checkOption('soup');
$I->checkOption('salad');
$I->checkOption('dessert');
$I->checkOption('snack');
$I->checkOption('farmland');
$I->checkOption('wetland');
$I->checkOption('forest');
$I->checkOption('moor');
$I->checkOption('coast');
/*
 * He also uploads four photos of the plant.
 */
$I->attachFile('input[name=photo_0]', 'test.jpg');
$I->attachFile('input[name=photo_1]', 'test.jpg');
$I->attachFile('input[name=photo_2]', 'test.jpg');
$I->attachFile('input[name=photo_3]', 'test.jpg');
/*
 * Then he clicks on the submit button.
 */
$I->click('addNewPlant');
/*
 * Now the website redirects him to the cropping page for the photos.
 * The title of the page has now change to "Beskær billeder" and
 * a welcome message says "Beskær billeder".
 */
$I->seeInTitle('Beskær billeder');
$I->see('Beskær billeder');
/*
$I->fillField('city', '');
$I->click("//form[contains(@action,'http://eshop.lo/oc-panel/profile/billing')]/div/div/button[@type='submit']");
$I->see('Billing information changed');
$I->seeElement('.alert.alert-success');
// Change password
$I->amOnPage('/oc-panel/profile/edit');
$I->fillField('password1', '4321');
$I->fillField('password2', '4321');
$I->click("//form[contains(@action,'http://eshop.lo/oc-panel/profile/changepass')]/div/div/button[@type='submit']");
$I->seeElement('.alert.alert-success');
$I->see('Password is changed');
$I->amOnPage('/oc-panel/profile/edit');
$I->fillField('password1', '1234');
$I->fillField('password2', '1234');
$I->click("//form[contains(@action,'http://eshop.lo/oc-panel/profile/changepass')]/div/div/button[@type='submit']");
$I->seeElement('.alert.alert-success');
$I->see('Password is changed');
// Change profile pic
$I->amOnPage('/oc-panel/profile/edit');
$I->attachFile('profile_image', 'photo.jpg');
$I->click("//form[contains(@action,'http://eshop.lo/oc-panel/profile/image')]/div/div/button[@type='submit']");
$I->see('photo.jpg Image is uploaded.');
$I->seeElement('.alert.alert-success');
// Delete profile pic
$I->amOnPage('/oc-panel/profile/edit');
$I->click('//button[@class="btn btn-danger index-delete index-delete-inline"]');
$I->seeElement('.alert.alert-success');
$I->see('Photo deleted.');
// Logout
$I->amOnPage('/oc-panel/auth/logout');
$I->see('Login', 'a');
示例#10
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that Material create works');
// CUSTOMER
$I->customerLogin();
$I->go(['/material/item/create']);
// wrong data
$I->attachFile('#item-file', 'mmc.pdf');
// small dpi
$I->testForm('#item-form', 'Item', [], ['file' => 123, 'type' => 123, 'owner_id' => 3, 'valid_from' => '28/12/2015', 'valid_to' => '2015-12-28']);
// correct data
$I->attachFile('#item-file', 'material.jpg');
$I->testForm('#item-form', 'Item', ['file' => 'material.jpg', 'type' => 0, 'owner_id' => 2, 'description' => 'asdasd', 'valid_from' => date('Y-m-d'), 'valid_to' => date('Y-m-d')]);
$I->seeElement('.alert-success');
// CUSTOMER
$I->partnerLogin();
$I->go(['/material/item/create']);
// wrong data
$I->attachFile('#item-file', 'mmc.pdf');
// small dpi
$I->testForm('#item-form', 'Item', ['owner_id' => 123], ['file' => 123, 'type' => 123, 'valid_from' => '28/12/2015', 'valid_to' => '2015-12-28']);
// correct data
$I->attachFile('#item-file', 'material.jpg');
$I->testForm('#item-form', 'Item', ['file' => 'material.jpg', 'type' => 0, 'description' => 'asdasd', 'valid_from' => date('Y-m-d'), 'valid_to' => date('Y-m-d')]);
$I->seeElement('.alert-success');
// PARTNER
// no upload role
$partner = \bariew\yii2Tools\tests\FixtureManager::get('user_user', 'test_partner1');
$I->login($partner->username, 'admin');
$I->go(['/material/item/create']);
示例#11
0
 private function createPost(\AcceptanceTester $I)
 {
     codecept_debug('createPost');
     $I->amOnPage('/');
     //button click
     $I->waitForElement('#share-look .btn', 10);
     $I->click('#share-look .btn');
     //$I->waitForElement('.glyphicon-edit',10);
     //$I->click('.glyphicon-edit');
     $I->waitForElement('form[role="share-look"]', 10);
     $I->attachFile('input[type="file"]', 'ryankim.png');
     $I->fillfield('input[name="item-name[0]"]', 'bag');
     $I->fillfield('input[name="item-store[0]"]', 'zara');
     $I->selectOption('select[name="item-rating[0]"]', 'Excellent');
     $I->wait(1);
     $I->click('form[role="share-look"] .btn-primary');
     $I->waitForElement('.list-group', 10);
     $href = $I->grabAttributeFrom('.list-group a:first-child', 'href');
     $temp = explode('/', $href);
     $this->post_id = $temp[count($temp) - 1];
     $I->amOnPage('/post/' . $this->post_id);
     $I->waitForElement('.user', 10);
     $href = $I->grabAttributeFrom('.user a', 'href');
     $temp = explode('/', $href);
     $this->user_slug = $temp['1'];
     //$this->postgroup_slug = $temp['5'];
 }
示例#12
0
$I->seeElement('.alert.alert-success');
$I->see('Category created');
// READ CATEGORY
$I->amOnPage('/');
$I->see('themes', 'a');
$I->amOnPage('/themes');
$I->see('Themes', 'h1');
$I->see('Premium themes and templates for Open Classifieds.', 'p');
// CREATE PRODUCT
$I->amOnPage('/oc-panel/Product/create');
$I->selectOption('#radio_themes', '3');
$I->fillField('#price', '200');
$I->selectOption('#currency', 'USD');
$I->fillField('#title', 'Default');
$I->fillField('#description', 'Default theme');
$I->attachFile('image0', 'photo.jpg');
$I->click('submit');
$I->seeElement('.alert.alert-success');
$I->see('Product is created.');
$I->amOnPage('/oc-panel/Product/update/1');
$I->checkOption('status');
$I->click('submit');
// READ PRODUCT
$I->amOnPage('/');
$I->see('Latest', 'h2');
$I->seeElement('.active.item');
$I->seeElement('.min-h');
$I->seeElement('.caption');
$I->see('$200', 'a');
$I->amOnPage('/all');
$I->seeElement('.item.grid-group-item.col-xs-4.col-lg-4');
示例#13
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('Test User Uploads Work Successful');
$I->amOnPage('/signup');
$I->fillField('#username', 'bobsburgers' . time());
$I->fillField('#email', 'bob' . time() . '@bobsburgers.com');
$I->fillField('#password', 'password');
$I->fillField('#password_confirmation', 'password');
$I->click('.form-signin button');
$I->wait(2);
// Upload picture from file
$I->click('.upload-btn-desktop');
$I->seeElement('.icon-cloud-upload');
$I->fillField('#title', 'Bobs Burgers');
$I->attachFile('#pic_url', 'bobs-burgers.jpg');
$I->click('.submit-media');
$I->see('Bobs Burgers');
$I->wait(2);
// Upload picture from URL
$I->click('.upload-btn-desktop');
$I->seeElement('.icon-cloud-upload');
$I->fillField('#title', 'Cool Burgers Bob');
$I->fillField('#img_url', 'http://pmcdeadline2.files.wordpress.com/2011/04/bobs-burgers_20110407175535.jpg');
$I->click('.submit-media');
$I->see('Cool Burgers Bob');
$I->wait(2);
// Upload Youtube Video from URL
$I->click('.upload-btn-desktop');
$I->seeElement('.icon-cloud-upload');
$I->click('.vid-radio-btn');
示例#14
0
<?php

$i = rand(1, 1000);
$I = new AcceptanceTester($scenario);
$I->wantTo('Add a new Template');
$I->amOnPage('/login');
$I->fillField('email', '*****@*****.**');
$I->fillField("password", "123456");
$I->click(['class' => 'btn-raised']);
$I->seeLink('Logout', '/logout');
$I->click('Templates');
$I->see('TEMPLATE');
$I->click(['class' => 'btn-primary']);
$I->see('Template');
$I->fillField('name', 'QA Temp' . $i . '');
$I->attachFile('input[type="file"]', 'fit-rasp-qa.zip');
$I->click(['class' => 'btn-primary']);
$I->see('Template added successfully');
$I->click('Logout');
$I->see('Login');
示例#15
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('Add a new Image');
$I->amOnPage('/login');
$I->fillField('email', '*****@*****.**');
$I->fillField("password", "123456");
$I->click(['class' => 'btn-raised']);
$I->seeLink('Logout', '/logout');
$I->click('Images');
$I->seeInCurrentUrl('/images');
$I->click(['class' => 'btn-primary']);
$I->see('Upload new images');
$I->selectOption('image_category', '2');
$I->attachFile('input[type="file"]', 'banner.jpg');
$I->click('Start upload');
$I->dontSeeElement(['class' => 'btn-danger delete']);
/* $I->click('Images');
$I->seeInCurrentUrl('/images');
$I->click('Logout');
$I->see('Login'); */
示例#16
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that SectionPreview create works');
// ADMIN
$I->login();
$I->go(['/template/section-preview/create']);
// wrong data
$I->attachFile('#sectionpreview-file', 'mmc.pdf');
$I->testForm('#preview-form', 'SectionPreview', [], ['file' => 123, 'owner_id' => 123, 'img_width' => 'asd', 'img_height' => 'sdf', 'img_top' => '', 'img_left' => '', 'section_content' => '', 'material_content' => '']);
// correct data
$I->attachFile('#sectionpreview-file', 'template_background.png');
$I->testForm('#preview-form', 'SectionPreview', ['owner_id' => 2, 'sections[]' => 1, 'img_width' => '756', 'img_height' => '410', 'img_top' => '702', 'img_left' => '19', 'section_content' => 'Section content', 'material_content' => 'Material content']);
$I->seeElement('.alert-success');