playwright: add timeout for cockpit tests
Playwright at times is making assertions before the osbuild-worker file is loaded. This is causing some flakiness in the tests, adding a timeout before some of the assertions should hopefully remove some of the flakiness.
This commit is contained in:
parent
6bf800d4d9
commit
661fd29a5e
3 changed files with 44 additions and 19 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import React, { useState } from 'react';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
|
@ -38,7 +38,7 @@ type ToggleGroupProps = Omit<FormGroupProps<boolean>, 'isDisabled'>;
|
|||
const AWSConfigToggle = ({ value, onChange }: ToggleGroupProps) => {
|
||||
const handleChange = (
|
||||
_event: React.FormEvent<HTMLInputElement>,
|
||||
checked: boolean
|
||||
checked: boolean,
|
||||
) => {
|
||||
onChange(checked);
|
||||
};
|
||||
|
|
@ -159,18 +159,23 @@ const AWSCredsPath = ({
|
|||
};
|
||||
|
||||
type AWSConfigProps = {
|
||||
isEnabled: boolean;
|
||||
enabled: boolean;
|
||||
setEnabled: (enabled: boolean) => void;
|
||||
reinit: (config: AWSWorkerConfig | undefined) => void;
|
||||
refetch: () => Promise<{
|
||||
data?: WorkerConfigResponse | undefined;
|
||||
}>;
|
||||
};
|
||||
|
||||
export const AWSConfig = ({ isEnabled, refetch, reinit }: AWSConfigProps) => {
|
||||
export const AWSConfig = ({
|
||||
enabled,
|
||||
setEnabled,
|
||||
refetch,
|
||||
reinit,
|
||||
}: AWSConfigProps) => {
|
||||
const dispatch = useAppDispatch();
|
||||
const bucket = useAppSelector(selectAWSBucketName);
|
||||
const credentials = useAppSelector(selectAWSCredsPath);
|
||||
const [enabled, setEnabled] = useState<boolean>(isEnabled);
|
||||
|
||||
const onToggle = async (v: boolean) => {
|
||||
if (v) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
import React, { MouseEventHandler, useCallback, useEffect } from 'react';
|
||||
import React, {
|
||||
MouseEventHandler,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useState,
|
||||
} from 'react';
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
|
@ -68,6 +73,7 @@ export const CloudProviderConfig = () => {
|
|||
const dispatch = useAppDispatch();
|
||||
const config = useAppSelector(selectAWSConfig);
|
||||
const handleClose = () => navigate(resolveRelPath(''));
|
||||
const [enabled, setEnabled] = useState<boolean>(false);
|
||||
|
||||
const [updateConfig] = useUpdateWorkerConfigMutation();
|
||||
const { data, error, refetch, isLoading } = useGetWorkerConfigQuery({});
|
||||
|
|
@ -76,9 +82,12 @@ export const CloudProviderConfig = () => {
|
|||
(config: AWSWorkerConfig | undefined) => {
|
||||
if (!config) {
|
||||
dispatch(reinitializeAWSConfig());
|
||||
setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
setEnabled(true);
|
||||
|
||||
const { bucket, credentials } = config;
|
||||
if (bucket && bucket !== '') {
|
||||
dispatch(changeAWSBucketName(bucket));
|
||||
|
|
@ -88,7 +97,7 @@ export const CloudProviderConfig = () => {
|
|||
dispatch(changeAWSCredsPath(credentials));
|
||||
}
|
||||
},
|
||||
[dispatch]
|
||||
[dispatch, setEnabled],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -126,7 +135,8 @@ export const CloudProviderConfig = () => {
|
|||
<AWSConfig
|
||||
refetch={refetch}
|
||||
reinit={initAWSConfig}
|
||||
isEnabled={!!(data?.aws && Object.keys(data.aws).length > 0)}
|
||||
enabled={enabled}
|
||||
setEnabled={setEnabled}
|
||||
/>
|
||||
</WizardStep>
|
||||
</Wizard>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue