-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
525 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<validation result="failed"> | ||
<error message="Invalid e-mail format" /> | ||
</validation> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
const PRESET = process.env.ALLURE_PRESET ?? 'default'; | ||
const ALLURE_PRESET = process.env.ALLURE_PRESET ?? 'default'; | ||
|
||
module.exports = require(`./configs/${PRESET}`); | ||
module.exports = require(`./configs/${ALLURE_PRESET}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
import path from 'node:path'; | ||
import { | ||
allure, | ||
$Description, | ||
$Owner, | ||
$Severity, | ||
$Link, | ||
} from 'jest-allure2-reporter'; | ||
import {LoginHelper} from "./utils/LoginHelper"; | ||
|
||
$Description('Sanity test for Allure reporter'); | ||
$Owner('Yaroslav Serhieiev <[email protected]>'); | ||
describe('Simple suite', () => { | ||
beforeAll(() => { | ||
console.log('beforeAll'); | ||
allure.fileAttachment( | ||
allure.createFileAttachment( | ||
'Project Logo', | ||
'/home/x/Projects/wix-incubator/jest-allure2-reporter/docs/img/logo.svg', | ||
path.resolve('../docs/img/logo.svg'), | ||
'image/svg+xml', | ||
); | ||
}); | ||
|
@@ -32,12 +34,8 @@ describe('Simple suite', () => { | |
}); | ||
|
||
allure.step('Inner step 2', () => { | ||
allure.attachment( | ||
'Some code', | ||
'console.log("Hello, World!");', | ||
'text/plain', | ||
); | ||
expect(true).toBe(false); | ||
const helper = new LoginHelper(); | ||
expect(helper.typeEmail('[email protected]')).toBe('Entered: [email protected]'); | ||
}); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {Attachment, FileAttachment, Step} from 'jest-allure2-reporter'; | ||
|
||
class LoginHelper { | ||
@Step('Type e-mail', ['E-mail']) | ||
@Attachment('email.txt') | ||
async typeEmail(email: string) { | ||
return 'Entered: ' + email; | ||
} | ||
|
||
@FileAttachment('summary.xml', 'text/xml') | ||
getValidationSummary() { | ||
return 'fixtures/invalid-email.xml'; | ||
} | ||
} | ||
|
||
export default new LoginHelper(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
export function Attachment() { | ||
// TODO: Implement | ||
import realm from '../realms'; | ||
|
||
const allure = realm.runtime; | ||
|
||
export function Attachment(filename: string, contentType?: string) { | ||
return function ( | ||
_target: object, | ||
_propertyName: string, | ||
descriptor: TypedPropertyDescriptor<(...arguments_: any[]) => any>, | ||
Check warning on line 9 in src/decorators/Attachment.ts GitHub Actions / Sanity
|
||
) { | ||
descriptor.value = allure.createAttachment( | ||
filename, | ||
descriptor.value!, | ||
contentType, | ||
); | ||
|
||
return descriptor; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
export function FileAttachment() { | ||
// TODO: Implement | ||
import realm from '../realms'; | ||
|
||
const allure = realm.runtime; | ||
|
||
export function FileAttachment(fileName: string, contentType: string) { | ||
return function ( | ||
_target: object, | ||
_propertyName: string, | ||
descriptor: TypedPropertyDescriptor<(...arguments_: any[]) => any>, | ||
Check warning on line 9 in src/decorators/FileAttachment.ts GitHub Actions / Sanity
|
||
) { | ||
descriptor.value = allure.createFileAttachment( | ||
fileName, | ||
descriptor.value!, | ||
contentType, | ||
); | ||
|
||
return descriptor; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
export function Step() { | ||
// TODO: Implement | ||
import realm from '../realms'; | ||
import type { ParameterOrString } from '../utils/types'; | ||
|
||
const allure = realm.runtime; | ||
|
||
export function Step(name: string, arguments_?: ParameterOrString[]) { | ||
return function ( | ||
_target: object, | ||
_propertyName: string, | ||
descriptor: TypedPropertyDescriptor<(...arguments_: any[]) => Promise<any>>, | ||
Check warning on line 10 in src/decorators/Step.ts GitHub Actions / Sanity
|
||
) { | ||
descriptor.value = arguments_ | ||
? allure.createStep(name, arguments_, descriptor.value!) | ||
: allure.createStep(name, descriptor.value!); | ||
|
||
return descriptor; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.