Skip to content

Commit b362add

Browse files
juan-fernandezBridgeAR
authored andcommitted
feat(test-optimization): add WebdriverIO optimizations (#9556)
1 parent 638bbc1 commit b362add

31 files changed

Lines changed: 1810 additions & 129 deletions

File tree

.github/workflows/test-optimization.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ jobs:
239239
with:
240240
version: ${{ matrix.node-version }}
241241
- uses: ./.github/actions/install
242-
- run: npm run test:instrumentations
242+
- run: npm run test:instrumentations:ci
243243
env:
244244
PLUGINS: webdriverio
245245
- run: npm run test:integration:webdriverio:coverage
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict'
2+
3+
const assert = require('node:assert/strict')
4+
5+
let attempts = 0
6+
7+
describe('WebdriverIO ATR', () => {
8+
it('passes on retry', () => {
9+
assert.strictEqual(attempts++, 1)
10+
})
11+
})
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict'
2+
3+
const assert = require('node:assert/strict')
4+
5+
describe('WebdriverIO disabled EFD', () => {
6+
it('is new', () => {
7+
assert.fail('disabled test ran')
8+
})
9+
})
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict'
2+
3+
describe('WebdriverIO EFD afterEach failure', () => {
4+
afterEach(() => {
5+
throw new Error('EFD afterEach failure')
6+
})
7+
8+
it('fails every EFD hook attempt', () => {})
9+
})
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
'use strict'
2+
3+
const assert = require('node:assert/strict')
4+
5+
let attempts = 0
6+
7+
describe('WebdriverIO EFD', () => {
8+
it('retries a new test', () => {
9+
assert.strictEqual(attempts++ % 2, 1)
10+
})
11+
})
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict'
2+
3+
const assert = require('node:assert/strict')
4+
5+
const sum = require('./dependency')
6+
7+
let attempts = 0
8+
9+
describe('WebdriverIO Failed Test Replay', () => {
10+
it('captures the failure on retry', () => {
11+
if (attempts++ === 0) {
12+
sum(11, 3)
13+
}
14+
15+
assert.throws(() => sum(11, 3), /a is too big/)
16+
assert.strictEqual(sum(1, 3), 4)
17+
})
18+
})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
'use strict'
2+
3+
describe('WebdriverIO impacted tests', () => {
4+
it('marks a modified test', () => {})
5+
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict'
2+
3+
let earlyFlakeDetectionAttempts = 0
4+
5+
describe('WebdriverIO quarantined hook failure', () => {
6+
beforeEach(() => {
7+
throw new Error('quarantined hook failure')
8+
})
9+
10+
it('is quarantined', () => {})
11+
})
12+
13+
describe('WebdriverIO EFD hook failure', () => {
14+
beforeEach(() => {
15+
if (earlyFlakeDetectionAttempts++ === 1) {
16+
throw new Error('EFD hook failure')
17+
}
18+
})
19+
20+
it('passes an EFD retry', () => {})
21+
})
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict'
2+
3+
const hookType = process.env.WEBDRIVERIO_SUITE_HOOK
4+
5+
describe('WebdriverIO suite hook failure', () => {
6+
if (hookType === 'beforeAll') {
7+
before(() => {
8+
throw new Error('beforeAll failure')
9+
})
10+
} else {
11+
after(() => {
12+
throw new Error('afterAll failure')
13+
})
14+
}
15+
16+
it('is quarantined', () => {})
17+
})
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict'
2+
3+
const assert = require('node:assert/strict')
4+
5+
describe('WebdriverIO Test Management', () => {
6+
it('is disabled', () => {
7+
assert.fail('disabled test ran')
8+
})
9+
10+
it('is quarantined', () => {
11+
assert.fail('quarantined failure')
12+
})
13+
14+
it('is attempt to fix', () => {})
15+
})

0 commit comments

Comments
 (0)