Reputation:
Is there a way to do an IF condition on the metadata in the test script? For e.g
test.meta({ tablet: ‘true’, portrait: 'false', landscape: 'true' })(‘L0 | Tablet device’, async t => {
// Verify component exists in portrait and landscape mode
await t.expect(abc).ok();
// Verify component exists in landscape mode only
if (t.metadata.landscape == 'true') {
......
}
});
Upvotes: 1
Views: 86
Reputation: 6318
You can get the meta inside a test using the following code:
t.testRun.test.meta
However, I need to note that it's not a documented API, and it can be changed in the future, so you need to use it carefully.
I think in your case, the best solution will be something like this:
const isTablet = true;
test.meta({ tablet: isTablet })(‘L0 | Tablet device’, async t => {
if (isTablet) {
......
}
});
Upvotes: 2