-
-
Save gajus/1fbbd38311959451f9f4ee0367a6e25f to your computer and use it in GitHub Desktop.
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
Rewrite the test spec from one framework to another using the provided examples. | |
Example: *** | |
Input: | |
''' | |
it('check correct url for example projects and services', () => { | |
cy.registerNewTestUser({ | |
onboardingProgress: 'completed' | |
}); | |
cy.visit('/'); | |
cy.log( | |
'check user can click on example project link and redirect user to correct link' | |
); | |
cy.findByRole('link', { | |
name: 'Explore Other Projects', | |
}) | |
.should('be.visible') | |
.invoke('attr', 'href') | |
.should('equal', 'https://contra.com/discover'); | |
cy.findByRole('link', { | |
name: 'Explore Other Projects', | |
}) | |
.invoke('attr', 'target') | |
.should('equal', '_blank'); | |
cy.findByRole('link', { | |
name: 'Services', | |
}).click(); | |
cy.findByRole('link', { | |
name: 'Explore Other Services', | |
}) | |
.should('be.visible') | |
.invoke('attr', 'href') | |
.should('equal', 'https://contra.com/discover'); | |
cy.findByRole('link', { | |
name: 'Explore Other Services', | |
}) | |
.invoke('attr', 'target') | |
.should('equal', '_blank'); | |
const emailAddress = generateTestEmailAddress(); | |
cy.getTestTokensByEmailAddress(emailAddress).then((tokens) => { | |
cy.wrap(tokens.emailConfirmation).should('have.length', 1); | |
}); | |
cy.location('pathname').should('equal', '/auth/confirm'); | |
}); | |
''' | |
Output: | |
''' | |
test('check correct url for example projects and services', async ({ | |
page | |
}) => { | |
await page.goto('/'); | |
await registerNewTestUser({ | |
onboardingProgress: 'COMPLETED', | |
onboardingType: 'CONTRACTOR', | |
page, | |
}); | |
await page.goto('/'); | |
console.log( | |
'check user can click on example project link and redirect user to correct link' | |
); | |
await expect( | |
page.findByRole('link', 'Explore Other Projects') | |
).toBeVisible(); | |
await expect( | |
page.findByRole('link', 'Explore Other Projects') | |
).toHaveAttribute('href', 'https://contra.com/discover'); | |
await expect( | |
page.findByRole('link', 'Explore Other Projects') | |
).toHaveAttribute('target', '_blank'); | |
await page.findByRole('link', 'Services').click(); | |
await expect( | |
page.findByRole('link', 'Explore Other Services') | |
).toHaveAttribute('href', 'https://contra.com/discover'); | |
await expect( | |
page.findByRole('link', 'Explore Other Services') | |
).toHaveAttribute('target', '_blank'); | |
const emailAddress = generateTestEmailAddress(); | |
const {tokens} = await getTestTokensByEmailAddress(emailAddress); | |
await expect(tokens.emailConfirmation).toHaveLength(1); | |
await expect(page.location('pathname')).toEqual('/auth/confirm'); | |
}); | |
''' | |
*** | |
Input: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment