import { expect } from "e2e";
import { test, WEB } from "./t3.ts";

test("Standalone Codex does not offer an undeliverable npm update", WEB, async ({t3, app, screen, browser}) => {
 await t3.project("Native channel proof");
 await t3.open();
 await screen.getByText("Native channel proof", {exact:true}).first().waitFor();
 await app.open("/settings/providers");
 await screen.getByText("v0.163.0", {exact:true}).first().waitFor();
 const advisory = screen.getByRole("button", "Update available, view details");
 await app.screenshot("native-channel-before-update");
 if (await advisory.count()) {
   await advisory.first().tap();
   await screen.getByRole("button", "Update now", {exact:true}).tap();
   await screen.getByText("Codex still needs an update", {exact:false}).first().waitFor();
 }
 await app.screenshot("native-channel-result");
 await expect(screen.getByText("Codex still needs an update", {exact:false})).toHaveCount(0);
 await expect(advisory).toHaveCount(0);
});
