Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Cleanup scripts and improve the pageobjects
Browse files Browse the repository at this point in the history
  • Loading branch information
Iftikhar Ahmad committed Nov 17, 2016
1 parent cb4b6bf commit b83b5aa
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# [arch ...]: The architectures to build for. By default it will build for
# amd64, arm64, armhf and i386.

set -xe
set -e

if [ "$#" -eq 0 ]; then
architectures=( amd64 arm64 armhf i386 )
Expand Down
4 changes: 3 additions & 1 deletion tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Before running the snapweb automated tests, following should be ready

```shell
cd tests/
./run-tests.sh <USER> <IP> <PORT>
./run-tests.sh <USER> <IP> <PORT> [sudo]
```

Where
Expand All @@ -21,6 +21,8 @@ IP = IP address of DUT

PORT = SSH port of DUT

sudo = specify sudo if sudo permissions are needed to install/remove snaps

After test run finishes, xunit report will be generated under ./results/ directory

If error occurs, screen shots can be found under ./errorShots/ folder
4 changes: 0 additions & 4 deletions tests/get-token.sh

This file was deleted.

6 changes: 3 additions & 3 deletions tests/pageobjects/access-control-page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var page = require('./page')
var basepage = require('./basepage')

var accessControlPage = Object.create(page, {
var accessControlPage = Object.create(basepage, {
/**
* define elements
*/
Expand All @@ -18,7 +18,7 @@ var accessControlPage = Object.create(page, {
*/
open: { value: function () {
browser.deleteCookie();
page.open.call(this, 'access-control');
basepage.open.call(this, 'access-control');
} },

submit_token: { value: function (token_value) {
Expand Down
8 changes: 8 additions & 0 deletions tests/pageobjects/basepage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function BasePage () {
}

BasePage.prototype.open = function (path) {
browser.url('/' + path)
}

module.exports = new BasePage()
8 changes: 4 additions & 4 deletions tests/pageobjects/installed-snaps-page.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var page = require('./page')
var basepage = require('./basepage')
var acPage = require('./access-control-page')

var installedSnapsPage = Object.create(page, {
var installedSnapsPage = Object.create(basepage, {
/**
* define elements
*/
Expand All @@ -12,7 +12,6 @@ var installedSnapsPage = Object.create(page, {
bugreport: { get: function () { return browser.element("div.b-layout__footer a[href*=bugs]"); } },
browsestore: { get: function () { return browser.element("a=Browse store"); } },
addmoresnaps: { get: function () { return browser.element("a=Add more snaps for this device"); } },
snapwebsnap: { get: function () { return browser.element(".p-card-deck").element("h3=snapweb"); } },
installedsnaps: { get: function () { return browser.elements(".p-card h3.js-snap-title"); } },
/**
* define or overwrite page methods
Expand All @@ -38,8 +37,9 @@ var installedSnapsPage = Object.create(page, {
pcarddeck.waitForVisible();
return pcarddeck.element("h3="+snap_name);

} }
} },

snapwebsnap: { get: function () { return this.snapElement("snapweb"); } }
});

module.exports = installedSnapsPage
8 changes: 0 additions & 8 deletions tests/pageobjects/page.js

This file was deleted.

3 changes: 2 additions & 1 deletion tests/wdio.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ exports.config = {
// variables, such as `browser`. It is the perfect place to define custom commands.
before: function (capabilities, specs) {
var sshSnapUtil = require('./utils/ssh-snap-util');
snaputil = new sshSnapUtil(process.env.HOST, process.env.USER, process.env.PORT, process.env.SSH_AUTH_SOCK, process.env.SUDO);
var env = process.env;
snaputil = new sshSnapUtil(env.HOST, env.USER, env.PORT, env.SSH_AUTH_SOCK, env.SUDO);
},
//
// Hook that gets executed before the suite starts
Expand Down

0 comments on commit b83b5aa

Please sign in to comment.