Skip to content

Commit 4c7f74c

Browse files
committed
fix: deprecate appium 1.x
1 parent dd4eb4c commit 4c7f74c

File tree

5 files changed

+969
-2
lines changed

5 files changed

+969
-2
lines changed

.github/workflows/appium.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ on:
44
push:
55
branches:
66
- 3.x
7-
- feat/appium-is-app-installed
8-
7+
-
98
env:
109
CI: true
1110
# Force terminal colors. @see https://www.npmjs.com/package/colors

.github/workflows/appiumV2.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Appium V2 Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- 3.x
7+
- appium-v1-deprecation
8+
9+
env:
10+
CI: true
11+
# Force terminal colors. @see https://www.npmjs.com/package/colors
12+
FORCE_COLOR: 1
13+
14+
jobs:
15+
appium1:
16+
runs-on: ubuntu-20.04
17+
18+
strategy:
19+
matrix:
20+
node-version: [16.x]
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
- run: npm install --legacy-peer-deps
29+
env:
30+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
31+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
32+
- run: 'npm run test:appium-quick'
33+
env: # Or as an environment variable
34+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
35+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
36+
37+
38+
appium2:
39+
40+
runs-on: ubuntu-20.04
41+
42+
strategy:
43+
matrix:
44+
node-version: [16.x]
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
- name: Use Node.js ${{ matrix.node-version }}
49+
uses: actions/setup-node@v4
50+
with:
51+
node-version: ${{ matrix.node-version }}
52+
- run: npm install --legacy-peer-deps
53+
env:
54+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
55+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
56+
- run: 'npm run test:appium-other'
57+
env: # Or as an environment variable
58+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
59+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}

lib/helper/Appium.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ class Appium extends Webdriver {
183183
this.axios = axios.create();
184184

185185
webdriverio = require('webdriverio');
186+
console.log('The Appium core team does not maintain Appium 1.x anymore since the 1st of January 2022. Please migrating to Appium 2.x by adding appiumV2: true to your config.\nThis Appium 1.x support will be removed in next major release');
186187
}
187188

188189
_validateConfig(config) {

test/helper/AppiumV2Web_test.js

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
const Appium = require('../../lib/helper/Appium');
2+
global.codeceptjs = require('../../lib');
3+
4+
let I;
5+
const site_url = 'http://davertmik.github.io';
6+
7+
describe('Appium Web', function () {
8+
this.retries(4);
9+
this.timeout(70000);
10+
11+
before(() => {
12+
I = new Appium({
13+
url: site_url,
14+
appiumV2: true,
15+
browser: 'chrome',
16+
restart: false,
17+
desiredCapabilities: {
18+
appiumVersion: '2.0.0',
19+
recordVideo: 'false',
20+
recordScreenshots: 'false',
21+
platformName: 'Android',
22+
platformVersion: '6.0',
23+
deviceName: 'Android Emulator',
24+
},
25+
host: 'ondemand.saucelabs.com',
26+
port: 80,
27+
// port: 4723,
28+
// host: 'localhost',
29+
user: process.env.SAUCE_USERNAME,
30+
key: process.env.SAUCE_ACCESS_KEY,
31+
});
32+
// I.isWeb = true;
33+
I._init();
34+
I._beforeSuite();
35+
});
36+
37+
after(() => I._finishTest());
38+
39+
beforeEach(() => {
40+
I.isWeb = true;
41+
return I._before();
42+
});
43+
44+
afterEach(() => I._after());
45+
46+
describe('current url : #seeInCurrentUrl, #seeCurrentUrlEquals, ...', () => {
47+
it('should check for url fragment', async () => {
48+
await I.amOnPage('/angular-demo-app/#/info');
49+
await I.seeInCurrentUrl('/info');
50+
await I.dontSeeInCurrentUrl('/result');
51+
});
52+
53+
it('should check for equality', async () => {
54+
await I.amOnPage('/angular-demo-app/#/info');
55+
await I.seeCurrentUrlEquals('/angular-demo-app/#/info');
56+
await I.dontSeeCurrentUrlEquals('/angular-demo-app/#/result');
57+
});
58+
});
59+
60+
describe('see text : #see', () => {
61+
it('should check text on site', async () => {
62+
await I.amOnPage('/angular-demo-app/');
63+
await I.see('Description');
64+
await I.dontSee('Create Event Today');
65+
});
66+
67+
it('should check text inside element', async () => {
68+
await I.amOnPage('/angular-demo-app/#/info');
69+
await I.see('About', 'h1');
70+
await I.see('Welcome to event app', { css: 'p.jumbotron' });
71+
await I.see('Back to form', '//div/a');
72+
});
73+
});
74+
75+
describe('see element : #seeElement, #dontSeeElement', () => {
76+
it('should check visible elements on page', async () => {
77+
await I.amOnPage('/angular-demo-app/');
78+
await I.seeElement('.btn.btn-primary');
79+
await I.seeElement({ css: '.btn.btn-primary' });
80+
await I.dontSeeElement({ css: '.btn.btn-secondary' });
81+
});
82+
});
83+
84+
describe('#click', () => {
85+
it('should click by text', async () => {
86+
await I.amOnPage('/angular-demo-app/');
87+
await I.dontSeeInCurrentUrl('/info');
88+
await I.click('Get more info!');
89+
await I.seeInCurrentUrl('/info');
90+
});
91+
92+
it('should click by css', async () => {
93+
await I.amOnPage('/angular-demo-app/');
94+
await I.click('.btn-primary');
95+
await I.wait(2);
96+
await I.seeInCurrentUrl('/result');
97+
});
98+
99+
it('should click by non-optimal css', async () => {
100+
await I.amOnPage('/angular-demo-app/');
101+
await I.click('form a.btn');
102+
await I.wait(2);
103+
await I.seeInCurrentUrl('/result');
104+
});
105+
106+
it('should click by xpath', async () => {
107+
await I.amOnPage('/angular-demo-app/');
108+
await I.click('//a[contains(., "more info")]');
109+
await I.seeInCurrentUrl('/info');
110+
});
111+
112+
it('should click on context', async () => {
113+
await I.amOnPage('/angular-demo-app/');
114+
await I.click('.btn-primary', 'form');
115+
await I.wait(2);
116+
await I.seeInCurrentUrl('/result');
117+
});
118+
119+
it('should click link with inner span', async () => {
120+
await I.amOnPage('/angular-demo-app/#/result');
121+
await I.click('Go to info');
122+
await I.seeInCurrentUrl('/info');
123+
});
124+
125+
it('should click buttons as links', async () => {
126+
await I.amOnPage('/angular-demo-app/');
127+
await I.click('Options');
128+
await I.seeInCurrentUrl('/options');
129+
});
130+
});
131+
132+
describe('#grabTextFrom, #grabValueFrom, #grabAttributeFrom', () => {
133+
it('should grab text from page', async () => {
134+
await I.amOnPage('/angular-demo-app/#/info');
135+
const val = await I.grabTextFrom('p.jumbotron');
136+
val.should.be.equal('Welcome to event app');
137+
});
138+
139+
it('should grab value from field', async () => {
140+
await I.amOnPage('/angular-demo-app/#/options');
141+
const val = await I.grabValueFrom('#ssh');
142+
val.should.be.equal('PUBLIC-SSH-KEY');
143+
});
144+
145+
it('should grab attribute from element', async () => {
146+
await I.amOnPage('/angular-demo-app/#/info');
147+
const val = await I.grabAttributeFrom('a.btn', 'ng-href');
148+
val.should.be.equal('#/');
149+
});
150+
});
151+
152+
describe('#within', () => {
153+
afterEach(() => I._withinEnd());
154+
155+
it('should work using within operator', async () => {
156+
await I.amOnPage('/angular-demo-app/#/options');
157+
await I.see('Choose if you ok with terms');
158+
await I._withinBegin({ css: 'div.results' });
159+
await I.see('SSH Public Key: PUBLIC-SSH-KEY');
160+
await I.dontSee('Options');
161+
});
162+
});
163+
});

0 commit comments

Comments
 (0)