It seems like these lines fail before the 3 minutes, I've set are up.
await expect(this.uploadModal).toBeHidden({ timeout: 180000 });
await expect(this.pdfSuccessfullyRendered.nth(0)).toBeVisible({ timeout: 180000 });
I have to set an unusually large timeout for these specific elements because its dealing with uploading a file to the application, I've tried changing the expect timeout in the config to 180000 for a more global approach,
globalSetup: require.resolve('./global-setup'),
expect: {timeout:180000},
use: {
baseURL: process.env.URL,
headless: true
},
as well as changing the test timeout to 180000 in the before each hook but it still fails around 30 seconds.
test.beforeEach(async ({ page }) => {
test.setTimeout(180000);
});
Error: expect(received).toBeHidden()
Call log:
- expect.toBeHidden with timeout 180000ms
- waiting for selector "//app-upload-document"
- selector resolved to <app-upload-document _nghost-vih-c387="" >…</app-upload-document>
- unexpected value "false"
- selector resolved to <app-upload-document _nghost-vih-c387="" >…</app-upload-document>
- unexpected value "false"
Im not sure what the error is about, as that specific element is interacted with before I wait for it to become hidden so I know it exists on the page, it ends up disappearing once the document is fully uploaded, after which the page auto navigates and I start waiting for the document to start loading
await expect(this.pdfSuccessfullyRendered.nth(0)).toBeVisible({ timeout: 180000 });
I can see the timeout in the console on the exception but the test isnt waiting the 3 minutes before failing, what am I missing?
CodePudding user response:
You need to return the value returned from jest.setTimeout
for it to do anything:
test.beforeEach(async ({ page }) => {
return test.setTimeout(180000);
});