Skip to content
Snippets Groups Projects
Commit dc81c934 authored by Désirée Chevalier's avatar Désirée Chevalier
Browse files

fix(e2e): wait for tab in e2e code suggestions spec

parent 625148f2
No related branches found
No related tags found
2 merge requests!1795chore: rebase sast-ide dev branch,!1568fix(e2e): wait for tab in e2e code suggestions spec
import { browser } from '@wdio/globals';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
/** /**
...@@ -13,4 +14,16 @@ const generateRandomString = length => { ...@@ -13,4 +14,16 @@ const generateRandomString = length => {
return randomString.slice(0, Number(length)); return randomString.slice(0, Number(length));
}; };
export { generateRandomString }; const waitForEditorTab = async (editorView, filename) => {
await browser.waitUntil(
async () => {
const openTabs = await editorView.getOpenEditorTitles();
return openTabs.includes(filename);
},
{
timeoutMsg: `Tab for ${filename} did not appear.`,
},
);
};
export { generateRandomString, waitForEditorTab };
import { browser } from '@wdio/globals'; import { browser } from '@wdio/globals';
import { completeAuth, generateRandomString, verifyCodeSuggestion } from '../helpers/index.js'; import {
completeAuth,
generateRandomString,
verifyCodeSuggestion,
waitForEditorTab,
} from '../helpers/index.js';
describe('GitLab Workflow Extension Code Suggestions', async () => { describe('GitLab Workflow Extension Code Suggestions', async () => {
let workbench; let workbench;
...@@ -21,6 +26,7 @@ describe('GitLab Workflow Extension Code Suggestions', async () => { ...@@ -21,6 +26,7 @@ describe('GitLab Workflow Extension Code Suggestions', async () => {
await prompt.confirm(); await prompt.confirm();
const editorView = await workbench.getEditorView(); const editorView = await workbench.getEditorView();
await waitForEditorTab(editorView, filename);
tab = await editorView.openEditor(filename); tab = await editorView.openEditor(filename);
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment