Change verifyCancelButton to return a promise and wait on it
instead of waiting inside verifyCancelButton() make it return the result of waitFor, which is a promise, and wait on it inside each individual test scenario.
This commit is contained in:
parent
3763457b8e
commit
8fcc10006b
1 changed files with 6 additions and 6 deletions
|
|
@ -16,11 +16,11 @@ function verifyButtons() {
|
||||||
return [ next, back, cancel ];
|
return [ next, back, cancel ];
|
||||||
}
|
}
|
||||||
|
|
||||||
async function verifyCancelButton(cancel) {
|
function verifyCancelButton(cancel) {
|
||||||
cancel.click();
|
cancel.click();
|
||||||
|
|
||||||
// this goes back to the landing page
|
// this goes back to the landing page
|
||||||
await waitFor(
|
return waitFor(
|
||||||
() => [
|
() => [
|
||||||
screen.getByTestId('create-image-action'),
|
screen.getByTestId('create-image-action'),
|
||||||
screen.getByTestId('images-table'),
|
screen.getByTestId('images-table'),
|
||||||
|
|
@ -101,7 +101,7 @@ describe('Step Release', () => {
|
||||||
|
|
||||||
test('clicking Cancel loads landing page', async () => {
|
test('clicking Cancel loads landing page', async () => {
|
||||||
const [ , , cancel ] = verifyButtons();
|
const [ , , cancel ] = verifyButtons();
|
||||||
verifyCancelButton(cancel);
|
await verifyCancelButton(cancel);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('allows chosing a release', () => {
|
test('allows chosing a release', () => {
|
||||||
|
|
@ -140,7 +140,7 @@ describe('Step Target environment', () => {
|
||||||
|
|
||||||
test('clicking Cancel loads landing page', async () => {
|
test('clicking Cancel loads landing page', async () => {
|
||||||
const [ , , cancel ] = verifyButtons();
|
const [ , , cancel ] = verifyButtons();
|
||||||
verifyCancelButton(cancel);
|
await verifyCancelButton(cancel);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('choosing S3 shows region and bucket fields', () => {
|
test('choosing S3 shows region and bucket fields', () => {
|
||||||
|
|
@ -232,7 +232,7 @@ describe('Step Registration', () => {
|
||||||
|
|
||||||
test('clicking Cancel loads landing page', async () => {
|
test('clicking Cancel loads landing page', async () => {
|
||||||
const [ , , cancel ] = verifyButtons();
|
const [ , , cancel ] = verifyButtons();
|
||||||
verifyCancelButton(cancel);
|
await verifyCancelButton(cancel);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should allow choosing activation keys', () => {
|
test('should allow choosing activation keys', () => {
|
||||||
|
|
@ -299,7 +299,7 @@ describe('Step Review', () => {
|
||||||
|
|
||||||
test('clicking Cancel loads landing page', async () => {
|
test('clicking Cancel loads landing page', async () => {
|
||||||
const cancel = screen.getByRole('button', { name: /Cancel/ });
|
const cancel = screen.getByRole('button', { name: /Cancel/ });
|
||||||
verifyCancelButton(cancel);
|
await verifyCancelButton(cancel);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue