8000 pr checks in travis and sauce labs by zbranzov · Pull Request #481 · nativescript-vue/nativescript-vue · GitHub
[go: up one dir, main page]

Skip to content

pr checks in travis and sauce labs #481

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

Merged
merged 7 commits into from
Jun 12, 2019
Merged
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ samples/package-lock.json
samples/platforms
samples/app/nativescript-vue.js
samples/app/nativescript-vue.js.map
samples/hooks/
samples/mochawesome-report/
samples/e2e/reports/
test-results.xml
dist/
packages/nativescript-vue-template-compiler/index.js
!docs/dist/
Expand Down
96 changes: 96 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
env:
global:
- ANDROID_PACKAGE_VUE='demo-ns-vue.apk'
- ANDROID_PACKAGE_FOLDER_VUE=$TRAVIS_BUILD_DIR/samples/outputs
- SAUCE_STORAGE="https://saucelabs.com/rest/v1/storage/$SAUCE_USER"
- IOS_PACKAGE_VUE='demo-ns-vue.zip'
- IOS_PACKAGE_FOLDER_VUE=$TRAVIS_BUILD_DIR/samples/outputs

git:
depth: 1

branches:
only:
- master

matrix:
include:
- stage: "Unit Tests"
language: node_js
os: linux
node_js: "8"
script: npm i && npm run test
- stage: "Build app"
os: osx
env:
- WebpackiOS="12.0"
- Type="VueJS"
osx_image: xcode10.0
language: node_js
node_js: "8"
jdk: oraclejdk8
script:
- npm i && npm run prepare:test:app
- cd samples && npm i && tns build ios --bundle --env.uglify --copy-to "./outputs/demo-ns-vue.app"
- cd $IOS_PACKAGE_FOLDER_VUE && zip -r $IOS_PACKAGE_VUE demo-ns-vue.app
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $SAUCE_STORAGE/$IOS_PACKAGE_VUE?overwrite=true --data-binary @$IOS_PACKAGE_FOLDER_VUE/$IOS_PACKAGE_VUE"
- language: android
os: linux
env:
- WebpackAndroid="28"
- Type="VueJS"
jdk: oraclejdk8
before_install: nvm install 8
script:
- npm i && npm run prepare:test:app
- cd samples && npm i && tns build android --bundle --env.uglify --copy-to "./outputs/demo-ns-vue.apk"
- "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $SAUCE_STORAGE/$ANDROID_PACKAGE_VUE?overwrite=true --data-binary @$ANDROID_PACKAGE_FOLDER_VUE/$ANDROID_PACKAGE_VUE"
- stage: "UI Tests"
env:
- iOS="12.0"
- Type="VueJS"
language: node_js
os: linux
node_js: "8"
script:
- npm i -g appium
- cd samples && npm i
- travis_wait travis_retry npm run e2e -- --runType sim12iPhoneX --sauceLab --appPath $IOS_PACKAGE_VUE
- os: linux
env:
- Android="24"
- Type="VueJS"
language: node_js
os: linux
node_js: "8"
script:
- npm i -g appium
- cd samples && npm i
- travis_wait travis_retry npm run e2e -- --runType android24.sauce --sauceLab --appPath $ANDROID_PACKAGE_VUE

android:
components:
- tools
- platform-tools
- build-tools-28.0.3
- android-28
- android-23
- extra-android-m2repository

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

cache:
directories:
- .nvm
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

before_install:
- sudo pip install --upgrade pip
- sudo pip install six

install:
- echo no | npm install -g nativescript
- tns usage-reporting disable
- tns error-reporting disable
9 changes: 5 additions & 4 deletions samples/app/app-with-radsidedrawer-tabs-and-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ const Home = {

const Tabs = {
template: `
<TabView
androidTabsPosition="bottom"
<GridLayout>
<TabView androidTabsPosition="bottom"
:selectedIndex="selectedTabIndex" >
<TabViewItem title="Tab 1">
<StackLayout>
Expand All @@ -34,7 +34,8 @@ const Tabs = {
<Label text="You are on Tab 2" />
</StackLayout>
</TabViewItem>
</TabView>`,
</TabView>
</GridLayout>`,
data() {
return {
selectedTabIndex: 0,
Expand Down Expand Up @@ -103,7 +104,7 @@ new Vue({
</RadSideDrawer>
</Page>
</Frame>
`,
`,
data() {
return {}
},
Expand Down
1 change: 1 addition & 0 deletions samples/app/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import '~nativescript-theme-core/css/core.light.css';
/* Your CSS goes here */

.even {
Expand Down
2 changes: 1 addition & 1 deletion samples/app/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main": "modals.js",
"main": "app-with-radsidedrawer-tabs-and-router.js",
"name": "nativescript-template-tutorial",
"version": "1.0.1"
}
83 changes: 83 additions & 0 deletions samples/e2e/config/appium.capabilities.json
A36C
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"android23.local": {
"platformName": "Android",
"platformVersion": "6.0",
"deviceName": "Emulator_Api23_Default",
"avd": "Emulator_Api23_Default",
"noReset": true
},
"android23": {
"platformName": "Android",
"platformVersion": "6.0",
"deviceName": "Android Emulator",
"appium-version": "1.7.1",
"noReset": true
},
"android25": {
"platformName": "Android",
"platformVersion": "7.1",
"deviceName": "Android GoogleAPI Emulator",
"appium-version": "1.7.1",
"noReset": true
},
"android24": {
"platformName": "Android",
"platformVersion": "7.0",
"deviceName": "Android GoogleAPI Emulator",
"appium-version": "1.9.1",
"noReset": true,
"lt": 60000,
"newCommandTimeout": 720,
"fullReset": false,
"idleTimeout": 120,
"automationName": "Appium"
},
"android24.sauce": {
"platformName": "Android",
"platformVersion": "7.0",
"deviceName": "Android GoogleAPI Emulator",
"lt": 60000,
"newCommandTimeout": 720,
"appiumVersion": "1.9.1",
"noReset": true,
"fullReset": false,
"app": "",
"idleTimeout": 120,
"automationName": "Appium"
},
"sim11iPhone6": {
"platformName": "iOS",
"platformVersion": "11.0",
"deviceName": "iPhone 6",
"appium-version": "1.7.1",
"app": ""
},
"sim103iPhone6": {
"browserName": "",
"appium-version": "1.7.1",
"platformName": "iOS",
"platformVersion": "10.3",
"deviceName": "iPhone 6",
"app": ""
},
"sim10iPhone6": {
"platformName": "iOS",
"platformVersion": "10.0",
"deviceName": "iPhone 6",
"appium-version": "1.7.1",
"app": ""
},
"sim12iPhoneX":{
"platformName": "iOS",
"platformVersion": "12.0",
"deviceName": "iPhone X",
"appiumVersion": "1.9.1",
"app": "",
"noReset": true,
"fullReset": false,
"density": 3,
"offsetPixels": 87,
"idleTimeout": 120,
"automationName": "Appium"
}
}
5 changes: 5 additions & 0 deletions samples/e2e/config/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--timeout 200000
--recursive e2e
--reporter mocha-multi
--reporter-options mochawesome=-,mocha-junit-reporter=test-results.xml
--exit
9 changes: 9 additions & 0 deletions samples/e2e/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const nsAppium = require("nativescript-dev-appium");

before("start appium server", async () => {
await nsAppium.startServer();
});

after("stop appium server", async () => {
await nsAppium.stopServer();
});
75 changes: 75 additions & 0 deletions samples/e2e/tests.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
const nsAppium = require("nativescript-dev-appium");
const expect = require("chai").expect;
const fs = require('fs');
const addContext = require('mochawesome/addContext');
const rimraf = require('rimraf');

describe("Vue", () => {
let driver, isSauceRun;

before(async function () {
driver = await nsAppium.createDriver();
driver.defaultWaitTime = 15000;
isSauceRun = driver.nsCapabilities.isSauceLab;
let dir = "mochawesome-report";
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
rimraf('mochawesome-report/*', function () { });
});

after(async () => {
if (isSauceRun) {
driver.sessionId().then(function (sessionId) {
console.log("Report https://saucelabs.com/beta/tests/" + sessionId);
});
}
await driver.quit();
console.log("Quit driver!");
});

afterEach(async function () {
if (this.currentTest.state && this.currentTest.state === "failed") {
let png = await driver.logScreenshot(this.currentTest.title);
fs.copyFile(png, './mochawesome-report/' + this.currentTest.title + '.png', function (err) {
if (err) {
throw err;
}
console.log('Screenshot saved.');
});
addContext(this, './' + this.currentTest.title + '.png');
}
});

describe("app-with-radsidedrawer-tabs-and-router", () => {
it("Open sidedrawer", async () => {
const home = await driver.findElementByText("Home");
expect(home).to.exist;
const menu = await driver.findElementByText("Menu");
await menu.click();
});

it("Open a menu item", async () => {
const item = await driver.findElementByText("Hello1");
await item.click();
const detail = await driver.findElementByText("Hello world");
expect(detail).to.exist;
});

it("Open Tabs item", async () => {
const menu = await driver.findElementByText("Menu");
await menu.click();
const item = await driver.findElementByText("Tabs");
await item.click();
const tab1 = await driver.findElementByText("You are on Tab 1");
expect(tab1).to.exist;
});

it("Click Tab 2", async () => {
const tab = await driver.findElementByText("Tab 2");
await tab.click();
const tab2Content = await driver.findElementByText("You are on Tab 2");
expect(tab2Content).to.exist;
});
});
});
10 changes: 10 additions & 0 deletions samples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"version": "5.4.0"
}
},
"scripts": {
"e2e": "node ./node_modules/nativescript-dev-appium/check-dev-deps.js && mocha --opts ./e2e/config/mocha.opts"
}
"dependencies": {
"@vue/devtools": "5.1.0",
"nativescript-pager": "9.5.4",
Expand All @@ -23,6 +26,13 @@
"vuex": "3.1.1"
},
"devDependencies": {
"@types/chai": "~4.1.7",
"@types/mocha": "~5.2.5",
"@types/node": "~10.12.18",
"mocha": "~5.2.0",
"mocha-junit-reporter": "~1.18.0",
"mocha-multi": "~1.0.1",
"mochawesome": "^3.1.1",
"@babel/core": "7.4.5",
"@babel/preset-env": "7.4.5",
"babel-loader": "8.0.6",
Expand Down
8 changes: 4 additions & 4 deletions samples/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = env => {
const projectRoot = __dirname;
const nsVueRoot = resolve(projectRoot, '../');

// Default destination inside platforms/<platform>/...
// Default destination inside platforms/<platform>/...
const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS";

Expand Down Expand Up @@ -65,7 +65,8 @@ module.exports = env => {
if (platform === "ios") {
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules.js";
};
console.log(`Bundling application for entryPath ${entryPath}...`);

console.log(`Bundling application for entryPath ${entryPath}...`);

let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist);

Expand All @@ -81,7 +82,6 @@ module.exports = env => {
],
},
target: nativescriptTarget,
// target: nativeScriptVueTarget,
entry: entries,
output: {
pathinfo: false,
Expand Down Expand Up @@ -277,7 +277,7 @@ module.exports = env => {
);
}

// Copy the native app resources to the out dir
// Copy the native app resources to the out dir
// only if doing a full build (tns run/build) and not previewing (tns preview)
if (!externals || externals.length === 0) {
config.plugins.push(new CopyWebpackPlugin([
Expand Down
0