Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Петрова Ксения #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
"version": "0.0.1",
"description": "Selenium",
"scripts": {
"test": "wdio wdio.conf.js"
"test": "wdio wdio.conf.js",
"selenium:install": "selenium-standalone install",
"selenium:start": "selenium-standalone start"
},
"author": "Sergey Zhigalov <[email protected]>",
"license": "MIT",
"devDependencies": {
"moment": "^2.18.1",
"selenium-standalone": "^6.4.1",
"wdio-mocha-framework": "0.5.10",
"wdio-sauce-service": "0.4.0",
"wdio-spec-reporter": "0.1.0",
Expand Down
50 changes: 47 additions & 3 deletions tests/mongomart-test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
const assert = require('assert');
const moment = require ('moment');

describe('Mongomart', () => {
it('should ...', () => {
browser.url('http://urfu-2016-testing.herokuapp.com/');
});
it('should find one product by query "cup"', () => {
const data = browser
.url('/')
.addValue('input[name="query"]','cup')
.click('button[type="submit"]')
.elements('.row img');

assert.equal(data.value.length, 1);
});
it('should be right navigation', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Хлебные крошки есть не только на странице с продуктом: корзина, главная и т.д.
Их тоже хорошо бы проверить

browser.url('/item/11');

const actualTopLevel = browser.getText('.breadcrumb li:nth-child(1) a');
const actualCategory = browser.getText('.breadcrumb li:nth-child(2) a');
const actualItem = browser.getText('.breadcrumb li:nth-child(3)');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я бы ещё проверил что на этом крошки заканчиваются

const actualTopLevelHref = browser.getAttribute('.breadcrumb li:nth-child(1) a', 'href');
const actualCategoryHref = browser.getAttribute('.breadcrumb li:nth-child(2) a', 'href');

assert.equal(actualTopLevel, 'Home');
assert.equal(actualCategory, 'Books');
assert.equal(actualItem, 'MongoDB The Definitive Guide');
assert.equal(actualTopLevelHref, 'http://urfu-2016-testing.herokuapp.com/');
assert.equal(actualCategoryHref, 'http://urfu-2016-testing.herokuapp.com/?category=Books');
});
it('should be same category when click on category link in navigation', () => {
browser.url('/item/11');

const expectedCategory = browser.getText('.breadcrumb li:nth-child(2) a');

browser.click('.breadcrumb li:nth-child(2) a');

const actualCategory = browser.getText('.breadcrumb li:nth-child(2)');

assert.equal(actualCategory, expectedCategory);
});
it('should be right date format', () => {
browser.url('/item/11');

const actualDate = browser.getText('.media-heading small')[0];

assert(moment(actualDate, 'MMMM Do YYYY, h:m:s a', true).isValid());

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В этом тесте нужно добавить новый комментарий и проверить что время его добавления нужное.
Проверки на формат недостаточно

});

});
41 changes: 41 additions & 0 deletions wdio.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
exports.config = {
host: 'hub-cloud.browserstack.com',
port: 4444,
path: '/wd/hub',
user: 'xeniapeter1',
key: 'o7gL4AgWtLzsHnqGekue',
//
// ==================
// Specify Test Files
// ==================
// Define which test specs should run. The pattern is relative to the directory
// from which `wdio` was called. Notice that, if you are calling `wdio` from an
// NPM script (see https://docs.npmjs.com/cli/run-script) then the current working
// directory is where your package.json resides, so `wdio` will be called from there.
//
specs: [
'tests/**'
],


// If you have trouble getting all important capabilities together, check out the
// Sauce Labs platform configurator - a great tool to configure your capabilities:
// https://docs.saucelabs.com/reference/platforms-configurator
//
capabilities: [
{
browserName: 'chrome'
},
{
browserName: 'firefox',
}
],

screenshotPath: 'shots',

baseUrl: 'http://urfu-2016-testing.herokuapp.com/',

waitforTimeout: 1000,

framework: 'mocha'
};